Skip to content

feat(core): epoch:seq engine-side sequencing — the P1a port of #1803 (#1806) - #1807

Merged
aarontrowbridge merged 1 commit into
live-test/stack-e2efrom
opencode/issue-1806-engine-sequencing
Oct 17, 2026
Merged

aarontrowbridge merged 1 commit into
live-test/stack-e2efrom
opencode/issue-1806-engine-sequencing

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Closes #1806. Part of #1803 (P1a — the engine half of port P1, first and alone).

The port, not a merge: main's #1776 sequencing architecture applied onto this lane's diverged engine. The global bus stamps every frame <epoch>:<seq> (per-process epoch, strictly monotonic, pre-dispatch tap ordering, the sync-copy mirror window); one shared replay buffer per bus (byte+age bounded, 32MB/5min defaults, env-tunable) serves cursor resume; unservable cursors get an explicit reset frame — the lane's state.resync sentinel on the instance route — never a silent gap; an engine restart changes the epoch and the reset holds across it.

What the port composes with rather than replaces: the #1798 bounded fan-out (SSE-DROP on stalled writes), the Phase A SSE-TICK telemetry, the #1264 lastEventID cursor path (the new ids are wire-compatible — the legacy payload-id cursor keeps being served, no client change rides with this port).

Deliberately excluded per the doctrine: main's 06eac85 (patch bodies off the wire = P3) and the frontdoor (P1b — the ring flip follows green on this slice; the frontdoor is untouched here).

Verification (director-run on a fresh materialized tree): scoped port battery 38/0; test/server 717 pass / 2 fail (the pre-existing environmental corpse pair, byte-identical at base); test/session 599/5 (the exact known baseline); typecheck 0 errors; drift gate PASS (980 files). The implementer's EXHAUSTED return was finished by the director: the final sweep (the session/server/typecheck/drift gates) + one test-file typing fix (Stream.runIntoQueue → the sibling-proven runForEach idiom) + this commit.

Per the live-test doctrine: this port rides the deploy ritual (provenance + lockstep + the panel render gate) before it is merge-ready — the lossless-resume E2E (kill mid-turn, reconnect, transcript equals fresh load) is P1b's acceptance against the sharded hub.

…y buffer, and reset contract (#1806, P1a of #1803)

PORTS, NOT REBASES — the first ported commit of the #1803 list, applied onto
this lane's diverged engine (which carries the #1798 bounded fan-out, the
SSE-TICK telemetry, and the #1264 lastEventID lineage — all preserved):

- bus/global.ts: per-process epoch, strictly monotonic seq, pre-dispatch
  taps (nested emits stay strictly ordered), the mirror window for sync
  copies — main's GlobalBus, ported verbatim.
- bus/global-replay.ts: one shared replay buffer per bus, byte+age bounded
  (32MB/5min defaults, env-tunable), cursor resume, explicit reset frames
  (main's #1776 semantics).
- handlers/global.ts + handlers/event.ts: both routes emit stamped frames
  through the shared bounded writer (sse-bounded-writer.ts — the #1798
  phase-C write path extracted, now shared); unservable cursors get the
  reset (the lane's state.resync sentinel on the instance route), and the
  payload-id vocabulary is untouched (no client change rides with the port).
- control-plane/workspace.ts: the sync-copy consumer half (the base's
  workspace sync loop requires sync frames).
- 38 new tests: stamping monotonicity, eviction, cursor resume, reset on
  foreign-epoch/ahead/evicted/ancient cursors, reset-across-restart,
  liveness-through-the-port (SSE-TICK flowing, no SELF-STALL), the header
  carrier on both routes, the legacy payload-id cursor path.

Excluded per the doctrine: main's 06eac85 (patch bodies off the wire —
that is P3) and the frontdoor flip (P1b follows green on this slice).

Verification (director-run, fresh materialized tree): scoped 38/0;
test/server 717 pass / 2 fail (the pre-existing environmental corpse pair,
proven at base); test/session 599/5 (the exact known baseline); typecheck 0
errors; drift gate PASS (980 files).
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9352e771-fd6d-4344-9946-4651dc644179

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant