Skip to content

fix(clients): a server restart after a finished reply no longer hides that reply - #877

Merged
incognitojam merged 2 commits into
mainfrom
styal/restart-note-settled-response
Oct 17, 2026
Merged

incognitojam merged 2 commits into
mainfrom
styal/restart-note-settled-response

Conversation

@incognitojam

@incognitojam incognitojam commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

When a server restart cancels background work that outlived a finished turn (for example a dev server the agent started), upstream's restart recovery prompts the agent with a note in a new run linked to the finished one through restartContinuationOfRunId. The fork's restart-continuation folding merged every linked run into one response. The note's reply became the response's final answer, and the real answer was hidden in the "Worked for" fold.

Only a continuation of a run the restart cut short now joins that run's response. A continuation of a completed or waiting run starts its own response under the "Server restarted" note, the same way a background wake starts one under its notification. The earlier answer stays visible as its own response's final message, and the note reply gets its own fold. This matches upstream, which already shows these continuations as a separate notice and response (pingdotgg#17723).

  • restartContinuationResumesResponse in client-runtime decides from the source run's status. Recovery only continues a completed or waiting source when its turn had settled, so these statuses identify that case.
  • Web (MessagesTimeline.logic.ts) and mobile (threadActivity.ts) stop following a link to a settled source when grouping responses, and treat that note as a response boundary.
  • Updated the server-restart-continuation-note ledger invariant.

Not changed: recovery still marks some settled waiting runs it cannot checkpoint as cancelled. The client cannot tell those from a run cut mid-turn, so they still merge as before. The working timer also still carries the earlier run's work into the note's run, as upstream does for background wakes.

Validation

  • In the web dev client, seeded with real threads where a restart cancelled a dev server after the agent had finished, I checked "Show deployments in PR panel" (one finished response followed by two restart notes).
    • Before: one "Worked for 15m 37s" fold whose visible answer is the note reply, "The cancelled task was only the dev preview server…". The real answer is hidden in the fold.
    • After: "Worked for 14m 45s", then the original answer and its changed-files card. Below that, "Server restarted" opens a new response, "Worked for 39s", with the note reply under it. The second note and its reply follow as another response. No page errors.
  • New web and mobile tests: a finished response followed by a restart note keeps its answer and fold, and the note starts a second response with its own fold. A chain through a settled run stops at that run. The existing tests for a restart that cut a response short still pass.
  • Not verified: the mobile change in a native client. The mobile feed logic is covered by the new threadActivity test. I also didn't verify a live restart that cuts a response short; that path is unchanged, and its existing tests pass.
Before After
Before: the note reply is the only visible answer After: the original answer stays visible and the restart note starts a new response

Written by an agent (Claude Code, claude-opus-5-5).

… that reply

When a server restart cancels background work that outlived a finished turn,
recovery prompts the agent with a note in a new run linked to the finished one.
Web and mobile merged every linked run into one response, so the note's reply
became the response's final answer and the real answer folded away.

Only a continuation of a run the restart cut short now joins that run's
response. A continuation of a completed or waiting run starts its own
response under the Server restarted note, the way a background wake does.

Fork-Feature: server-restart-continuation-note

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Upstream divergence

Both sides are compared with upstream at the in-order tip 54b6b667f3. Excludes .repos/ and pnpm-lock.yaml.

Measure Base This PR Change
Upstream files the fork changes 1,412 1,412 0
Lines changed in them 67,777 68,018 +241
Upstream files the fork removes 41 41 0
Fork-only files 473 473 0
Fork-only lines 83,034 83,034 0
Upstream files whose difference changes (7)
File Change Now differs by
apps/web/src/components/chat/MessagesTimeline.logic.test.ts +92 724 lines
apps/mobile/src/lib/threadActivity.test.ts +72 366 lines
apps/web/src/components/chat/MessagesTimeline.logic.ts +28 443 lines
apps/mobile/src/lib/threadActivity.ts +15 268 lines
apps/mobile/src/features/threads/ThreadFeed.tsx +12 291 lines
packages/client-runtime/src/work-log/presentation.ts +12 256 lines
apps/web/src/components/chat/MessagesTimeline.tsx +10 813 lines

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 4.9 KiB 5.0 KiB +23 B (+0.5%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB +23 B (+1.9%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.8 KiB 20.9 KiB +41 B (+0.2%) 29.3 KiB ✅
Codex Live turn messages 1 2 +1 (+100.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +24 B (+0.5%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +24 B (+2.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB +41 B (+0.2%) 29.3 KiB ✅
Claude Live turn messages 1 2 +1 (+100.0%) 8 ✅

Baseline: 0b80358 · PR result: d0dfa1e · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@incognitojam
incognitojam marked this pull request as ready for review October 17, 2026 15:02
@incognitojam
incognitojam merged commit d90287a into main Oct 17, 2026
58 of 60 checks passed
@incognitojam
incognitojam deleted the styal/restart-note-settled-response branch October 17, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant