Skip to content

Carry typed conversation state through the journal, snapshots and the phone (CF-6, first half) - #285

Merged
BunsDev merged 4 commits into
mainfrom
cf6-typed-replay
Oct 18, 2026
Merged

BunsDev merged 4 commits into
mainfrom
cf6-typed-replay

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Part of #279 (CF-6): the half that rests only on CF-1's contract (#282, merged as 7780093). Request withdrawal and resolution, dead-card revival, a second native decision, and structured-question negotiation wait for CF-3 (#276), so #279 stays open.

What changes

Typed transcript items (origin, phase, reasoning, outcome) now agree everywhere a turn is seen again: the turn as it ran, its saved snapshot, journal replay, a paired desktop catching up, and the phone.

  • Replay is an upsert. replayItems appended an item event even when that item was already there, so a frame delivered twice doubled the item and left a stale copy. It now upserts by id, as the renderer and phone apply events.
  • The phone gets typed fields. mobileItem adds phase, outcome and reasoning. Today's phone build shows every finished tool with a checkmark whatever ok says, so a finished tool that did not succeed also says how it ended in its title ("· Failed", "· Denied", "· Stopped", "· Status unavailable"). The Swift client decodes with Decodable, which ignores the new keys; no Swift change.
  • Work left running at a restart is settled everywhere. The runner already read an item that an earlier process saw start but never end as unknown, and a running sub-agent as status unavailable, but only in memory. The saved transcript kept running, and a paired desktop or phone resuming from the journal kept a spinner forever. Loading the thread now saves the settled items once and emits them as item_update events. Nothing is run again.
  • Test helpers: the captured-stream helpers moved to test/conversation-fixtures.ts, so the journal tests can replay the same Codex capture.
  • Docs: docs/event-journal.md gains a "Typed conversation state" section, and conversation-events.md and status are updated.

Evidence

Base 7780093, head 01a395b (five signed commits).

  • Red before green.
    • Duplicate frames: replaying a journal twice gave 4 items instead of 2.
    • Convergence: the phone projection lacked phase, outcome and readable titles.
    • Restart: the saved snapshot still said running after a restart.
    • The retry-attempt and legacy-history tests passed before the change; they are regression guards.
  • test/event-journal.test.ts (3 new tests).
    • Duplicate frames.
    • A captured Codex 0.163.0 turn through the real adapter, runner and journal. The runner, saved snapshot, journal replay, duplicated replay, live event stream, and the phone's full and mid-turn delta snapshots agree on identity, text, phase and outcome.
    • A retry reusing a native id stays separate through the journal.
  • test/conversation-migration.test.ts (new, 3 tests).
    • A transcript and journal written before the contract load, replay and project unchanged, with no invented provenance.
    • A typed turn appended to old history leaves the old items untouched.
    • Work a dead process left running becomes unknown in this window, the saved snapshot, journal replay and the open window, and the test backend's run counter stays at 0.
  • pnpm test at 01a395b: the first stage ran 1,520 tests, with 1,504 passed, 0 failed and 16 skipped (skips that already exist). The second stage passed 21 of 21.
  • Focused e2e at 01a395b, after pnpm build and the Store client build: 34 of 34 passed, covering event-journal, companion, store-desktop, store-demo, desktop-host-launch, app, sources and agents. The full e2e suite runs in the required CI job.
  • Load average during the runs was about 190–250, from other sessions' builds.

Conflicts

#284 (CF-4) also adds a docs/status.md entry above the same line. Whichever lands second keeps both entries.

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 18, 2026 8:48am UTC

Request Review

The fixture loader and the Codex and Claude stream players move from
conversation-events.test.ts to test/conversation-fixtures.ts, so the
journal tests can replay the same captures without re-running those
tests. No behaviour changes.

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5
replayItems appended an item event even when that item was already
there, so a frame delivered twice doubled the item and left a stale
copy; it now upserts by id as the renderer and phone do. A typed Codex
capture converges across the runner, the saved snapshot, journal
replay, a duplicated replay and the phone's full and delta snapshots.
The phone gets phase, outcome and reasoning; a phone that reads only
title and status sees how a finished tool that did not succeed ended in
its title ("· Denied", "· Failed", "· Stopped", "· Status unavailable").

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5
The runner already read a running item from an earlier process as
unknown (and a running agent as status unavailable), but only in
memory: the saved transcript kept "running", and a paired desktop or
phone resuming from the journal kept a spinner forever. Loading a
thread now saves the settled items once and sends them as item updates,
so the journal and every client agree. Nothing is run again. Old
transcripts and journals load, replay and project unchanged.

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5
event-journal.md gains how typed items travel, merge and replay, how
work left running at a restart is settled for every client, and what the
phone receives; conversation-events.md records the CF-6 half that rests
on #274. Status moves the merged CF-1 (#282) and CF-4 (#284) entries and
this change into one "On main, unreleased" entry.

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 8e26534 cf6-typed-replay 13a8b33 +/-
62% 62% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@BunsDev
BunsDev merged commit fb76aac into main Oct 18, 2026
13 checks passed
@BunsDev
BunsDev deleted the cf6-typed-replay branch October 18, 2026 09:30
BunsDev added a commit that referenced this pull request Oct 18, 2026
Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 18, 2026
)

The only conflict was docs/status.md. main had moved CF-1 and CF-4 from
In flight to On main, unreleased, so the slot keeps just CF-2's entry.
CF-6's runner change, which settles items on load and emits the change,
merges beside CF-2's stop and withdrawal code.

Refs #275

Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 18, 2026
…ange

Since CF-6's first half (#285), the first load of every thread compared its settled items
against a second parse of the same file. Objects from two parses are never identical, so every
item looked changed: main rewrote the thread file and sent one item_update per item to the
window, the journal and paired clients. On a 1,400-item transcript that made the first open
about 55 ms slower and wrote 1,400 journal rows when the journal was on.

Compare against the parse the items came from. Only items that a previous process left running
are saved and sent, with only the fields that changed.

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5
BunsDev added a commit that referenced this pull request Oct 18, 2026
…d fix what they found (CF-8) (#301)

* Settle a thread on first load without resending items that did not change

Since CF-6's first half (#285), the first load of every thread compared its settled items
against a second parse of the same file. Objects from two parses are never identical, so every
item looked changed: main rewrote the thread file and sent one item_update per item to the
window, the journal and paired clients. On a 1,400-item transcript that made the first open
about 55 ms slower and wrote 1,400 journal rows when the journal was on.

Compare against the parse the items came from. Only items that a previous process left running
are saved and sent, with only the fields that changed.

Refs #279

Coven-Harness: Claude Code / claude-opus-5-5

* Switch themes in e2e the way Settings does, so every theme is really checked

The typed-turns theme test set each theme with settings:update over IPC. That saves the theme
but the window applies it only when its state refreshes, so the test checked Graphite three
times. Asserting that the theme applied failed on Jev ("graphite" received).

setTheme picks the theme in Settings → General, saves, and waits for the window to show it.
The three captures now differ, and they are taken at 1× CSS scale with animations stopped.

Refs #277

Coven-Harness: Claude Code / claude-opus-5-5

* Capture each fidelity state in every theme at two sizes, and wrap a narrow approval card

The fidelity spec now captures the waiting, completed, restored, failed and live states in
Graphite, Jev and OpenCoven, at the 900×600 minimum and at 1440×900, and checks that none
scrolls sideways. MODEX_SCREENSHOTS=<dir> keeps the images.

The check failed at 900×600 with the Review pane open: the transcript column is 319 px, and the
approval card's long path and action row pushed Deny 160 px off to the side. The card's question
now wraps anywhere and its actions wrap to a second line.

The fixture CLI also answers the thread-naming turn with a title, instead of taking the deny path
and naming the thread "Left the file as it was".

Refs #281

Coven-Harness: Claude Code / claude-opus-5-5

* Measure a long transcript and a 3 MiB log stream through the app

e2e/transcript-measure.spec.ts opens a saved 200-turn, 1,400-item transcript and times its first
(cold) and repeated opens in the renderer, and streams a 3 MiB command log from a fixture Codex
app-server through the real backend, runner and IPC. It counts the bytes main sends the window,
main's CPU time, and the renderer's long tasks. MODEX_MEASURE=<file> writes the numbers with the
machine's description.

It asserts only bounds that hold on any machine: no streamed event carries more than the 256 KB
preview, and opening a saved thread resends none of its items.

Refs #281

Coven-Harness: Claude Code / claude-opus-5-5

* Commit the fidelity reference captures and record the long-transcript measurement

docs/screenshots/conversation-fidelity/ holds 33 captures from the two specs, with a manifest
that records each one's state, theme, viewport, scale, source commit and hash. They are fixture
references, not provider screenshots or pixel baselines.

The acceptance review records the measurement on a named Mac (M3 Max, macOS 26.7.1), before
the tracker (89c98f2) and after, and the three defects the new checks found. The two matrix rows
for themes and for long transcripts move from open to verified on this machine. The stray shell
lines at the end of the review are gone.

Refs #281

Coven-Harness: Claude Code / claude-opus-5-5

This branch was successfully deployed

1 active deployment
Preview — 13a8b33b Deployed Oct 18, 2026 by vercel[bot]
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