Skip to content

fix(desktop): settle live turns after sidecar crashes - #2574

Merged
vastsa merged 6 commits into
vastsa:mainfrom
Linuxdazhao:codex/fix-sidecar-crash-2570
Nov 28, 2026
Merged

vastsa merged 6 commits into
vastsa:mainfrom
Linuxdazhao:codex/fix-sidecar-crash-2570

Conversation

@Linuxdazhao

Copy link
Copy Markdown
Contributor

Summary

Restore the partial reply before sending a classified sidecar-crash error to the affected session. The foreground and background transcripts settle their running tool rows and keep the localized error after reload. Agent Host records an interrupted turn and releases the queue, while stale crash cleanup leaves a successor turn alone.

The protocol smoke suite initially failed on both the candidate and the base with revision not found. The separate test commit seeds the first revision through the same host RPC the fixture expects, so the existing round-trip assertions run against valid state.

Validation

  • macOS arm64, candidate 6b492f2ba on 649c3456a
  • 56 targeted desktop tests, desktop typecheck, and desktop build passed
  • pnpm test:e2e passed 23 checks with two optional live-provider checks skipped
  • pnpm test:e2e:supervision and pnpm test:e2e:transcript passed
  • Real host-core and a synthetic sidecar process passed two forced exits and two OOM-banner exits. The renderer stopped running, recovered the partial reply, and displayed one persisted error in all four runs.
  • Windows installer and full-heap OOM validation remain open.

Closes #2570

The durable abort can recover a partial reply while the renderer still
believes the session is running. Publish the classified failure after
recovery and before releasing the turn, so the transcript and queue
observe a single outcome.

Fixes vastsa#2570
The host skips active-branch saves until a revision exists. Seed the
first revision through the normal RPC so the smoke case can verify
growing live references and restoring both branches.
Linuxdazhao and others added 3 commits November 25, 2026 11:08
A queued prompt writes to Host directly and can pass a crash card
that is still in the outbox. Wait for the Host append, spool failures
under the original turn, and recheck live ownership before publishing.
When the user pressed Stop and the sidecar then died before agent_end,
finishTurn still attached the classified crash error: the transcript got
an AGENT_SIDECAR_* card, the turn result looked failed, and Agent Host
recorded the crash code on what was a deliberate stop. The abort lock
taken before the cancel request already records that intent, so a
locked turn now settles as a plain abort.

The crash card also carries its turnId in the live projection, matching
the persisted row, so transcript grouping is the same before and after
reload.

Refs vastsa#2570
@vastsa

vastsa commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Landing fixes pushed on top of your branch (no force-push):

  • Merged latest main. The scripts/e2e-smoke.mjs conflict was resolved to main's version; main already fixed that revision fixture with truncateFrom + activateRevision, so this PR no longer touches it.
  • 67e83f308: when the user pressed Stop and the sidecar died before agent_end, finishTurn still attached the crash error (crash card, failed turn result, crash code on the Agent Host turn). The abort lock now wins and the turn settles as a plain abort. Regression test in queued-turn-finalization.test.mjs; without the fix it never settles.
  • The live crash-card row now carries turnId, matching the persisted row.

Verified on 67e83f308 (base 6214e5583): 65/65 across queued-turn-finalization, session-runtime-updates, rpc-lifecycle-contract, main-wiring-contract, session-turn-ended, chat-error-message; desktop typecheck, biome lint, architecture check (index.ts +2 warning), check:pr-base.

@vastsa
vastsa merged commit 1e63a4f into vastsa:main Nov 28, 2026
6 checks passed
zergfff added a commit to zergfff/PI-Desktop-fork that referenced this pull request Nov 30, 2026
Ported from vastsa/PI-Desktop v0.24.0-beta.7 (bug fixes only; the release's
features were left for a later rebase):

vastsa#2625 quarantine rejected outbox appends instead of retrying them forever
vastsa#2574 settle live turns and tool rows when the sidecar dies mid-stream
vastsa#2578 native Pi turns stay stoppable after a reload
vastsa#2634 the task badge mirrors work that is still running
vastsa#2639 let Arabic and Hebrew paragraphs choose their own side
vastsa#2640 stop a renderer crash loop with one GPU-less relaunch, then a dialog
vastsa#2642 reject differing spellings of one tool argument
vastsa#2655 compaction summaries open on demand in the transcript
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.

[Bug] Session UI stays running after mid-turn agent-sidecar crash / 会话执行中 agent-sidecar 异常退出重启后前端仍停留在运行中

2 participants