Skip to content

Preserve typed conversation fidelity and streaming reader state (CF-4, lands #295) - #333

Merged
BunsDev merged 5 commits into
mainfrom
cf4-completion-land
Oct 20, 2026
Merged

BunsDev merged 5 commits into
mainfrom
cf4-completion-land

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #295 (CF-4 completion), with Val's approval on 2026-10-19. #295 was stacked on #283's pre-squash history and had conflicted with main for a day, and its session was idle. This lands #295's own work on current main and credits it. #295's branch is untouched. Part of #277, tracker #273.

What it carries from #295

Commit ba3dcc7 applies #295's net change, 74833f7..dad15cd (commits cce0a40, 00576be, c974d0f, dad15cd):

  • reasoning summaries keep their label while streaming;
  • failed, denied, stopped and unknown messages and reasoning stay visible, including after a retry;
  • a streaming reply keeps its code controls, focus and selection;
  • returning to a thread restores its expansion and scroll position for the session;
  • Preserve typed conversation fidelity and streaming reader state #295's verification record, in docs/reviews/2026-10-18-cf4-completion/.

Markdown.tsx, conversation-rendering.spec.ts and markdown-render.test.ts were byte-identical between #295's base and main, so its changes there apply as written.

Conflicts resolved:

One change from #295, for Val to confirm

Commit 0532b8b. #295 made a typed turn answer only with an explicit final message.

  • What that fixed: a Codex turn made only of partial answers (codex-cli 0.163.0's partial_answer, stored as unspecified) no longer shows its last partial as the final answer.
  • What it broke: CF-1's documented fallback for a CLI that reports no message phase. Claude Code never would have shown a final answer. CF-8's golden path, already on main, failed for that reason (conversation-fidelity.spec.ts:170, with no data-final element).

finalAnswerIndex now keeps both cases:

  • A turn is typed when any message has final or commentary, or any native phase from the CLI (nativePhase). A typed turn answers only with an explicit final.
  • A turn whose CLI reports no phase at all (Claude, old history) keeps the last reply.

If Val prefers #295's stricter rule for Claude too, the CF-8 golden path's assertion has to change with it.

Tests

  • turn-layout.test.ts:
  • turn-layout and conversation-events pass 39/39, including CF-1's finalAnswerIndex tests.

Checks on 0532b8b

macOS (Apple Silicon), Node 24.18.1, pnpm 10.34.5.

Command Result
pnpm build passed
pnpm typecheck passed
pnpm --filter @modex/desktop test 1,670 passed, 16 skipped of 1,686; second stage 21/21
e2e: conversation-fidelity, typed-turns, conversation-rendering, conversation-continuity 22/22

On ba3dcc7, before the final-answer fix, e2e ran over conversation-continuity, conversation-rendering, typed-turns, app, approvals, layout, routines, conversation-evidence, markdown-narrow and conversation-fidelity: 64 passed, 1 failed. The failure was the golden path, fixed above.

Not run locally: the full pnpm test:e2e. CI runs it.

Remaining gates (from #295): live native Claude and Codex acceptance (see #332) and human keyboard and VoiceOver review.

Update: CI on 0532b8b and the fix (e412c61)

unit + e2e (macOS) failed 9 tests in app.spec.ts, approvals.spec.ts and layout.spec.ts, with 342 passed. For example: .turn-content > [data-final="true"], expected 0, received 1.

#295 had rewritten those specs, and routines.spec.ts, for its explicit-final-only rule. For example: "The scripted adapter reports an unspecified phase. Do not invent a final answer by position."

The offline mock reports no phase, so under the restored CF-1 fallback its last reply is the answer and finished work folds, as on main. Those four specs are main's versions again. Locally, app, approvals, layout, routines, conversation-fidelity and typed-turns pass 50/50. c7b1f5a then merges main (#332).

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

Lands #295, which another session wrote, onto current main. It was
stacked on #283's pre-squash history and had sat for a day with
conflicts. This applies #295's own net change, 74833f7..dad15cd (its
commits cce0a40, 00576be, c974d0f and dad15cd), and resolves the
conflicts against what has landed since.

From #295: typed records take their final answer only from the CLI's
own final phase, never by position; failed, denied, stopped and unknown
messages and reasoning stay visible, including after a retry; reasoning
summaries keep their label while streaming; a streaming reply keeps its
code controls, focus and selection; and returning to a thread restores
its expansion and scroll position for the session. Its verification
record is in docs/reviews/2026-10-18-cf4-completion/.

Resolutions:
- TurnContent keeps main's footer and #295's remembered expansion.
- ThreadView keeps both import additions.
- turn-layout keeps both new tests.
- typed-turns.spec keeps main's version (setTheme, and the
  expanded-turn check from #301). #295's selectTheme duplicated
  setTheme, so conversation-rendering.spec now uses setTheme and the
  duplicate is gone.
- status.md takes #295's corrected streaming sentence and lists the
  change under On main, unreleased, not In flight.

Supersedes #295. Part of #277, tracker #273.

Coven-Harness: Claude Code / claude-opus-5-5
… an explicit final

#295 made every typed turn answer only with an explicit final message.
That fixed a real case: a Codex turn of partial answers
(codex-cli 0.163.0's partial_answer, stored as unspecified) could make
its last partial the final answer by position. It also removed CF-1's
documented fallback for a CLI that reports no message phase at all.
Claude Code then never showed a final answer, and CF-8's golden path
failed waiting for one.

finalAnswerIndex now treats a turn as typed when any message carries a
final or commentary phase, or any native phase the CLI sent. Such a
turn answers only with an explicit final. A turn whose CLI reports no
phase (Claude, old history, older Codex models) keeps the last reply,
and layoutTurn uses this rule again for the latest attempt.

Tests: a Claude turn answers with its last reply (red against #295's
rule: final -1, expected 2), and a Codex partial-answer turn never
invents one. turn-layout and conversation-events pass 39/39. The golden
path, typed-turns, conversation-rendering and conversation-continuity
specs pass 22/22.

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

vercel Bot commented Oct 19, 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 20, 2026 5:33am UTC

Request Review

#295 rewrote app, approvals, layout and routines specs for its
explicit-final-only rule. For example: "The scripted adapter reports an
unspecified phase. Do not invent a final answer by position: its
successful work remains visible." The offline mock reports no message
phase, so with CF-1's fallback restored (0532b8b) its last reply is the
answer again and its finished work folds, as on main. CI failed nine of
these tests on 0532b8b ("Expected: 0, Received: 1" final answers).

These four specs are main's versions again. Locally, app, approvals,
layout, routines, conversation-fidelity and typed-turns pass 50/50.

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

Both entries kept in docs/status.md. The CF-4 entry now says when the
last reply stays the answer.

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 75cb878 cf4-completion-land f3da1ef +/-
63% 64% +1%
View coverage of the 10 most impacted files.
File main 75cb878 cf4-completion-land f3da1ef +/-
apps/desktop/sr...ts/Markdown.tsx 89% 88% -1%
apps/desktop/sr...ngine/runner.ts 98% 98% 0%
apps/desktop/sr...kends/claude.ts 98% 98% 0%
apps/desktop/sr...ne/companion.ts 97% 97% 0%
apps/desktop/sr...ckends/codex.ts 96% 97% +1%
apps/desktop/sr...ackends/mock.ts 95% 96% +1%
apps/desktop/sr...ages/fixture.ts 0% 29% +29%
apps/desktop/sr...TurnContent.tsx 0% 58% +58%
apps/desktop/sr...reader-state.ts 0% 78% +78%
apps/desktop/sr...asoningItem.tsx 0% 94% +94%

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

This branch was successfully deployed

1 active deployment
Preview — f3da1efd Deployed Oct 20, 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