A run cancelled by the startup/shutdown reconcile was indistinguishable
from a user cancel: the user's message simply never got an answer and no
explanation appeared anywhere (audit plan #5, threads 721fc23c and
48663fb7 — cursor crash and server restart both ate the turn silently).
The reconcile now appends a "Run interrupted" error item per terminalized
run carrying the reason ("Cancelled because the server restarted/shut
down before the provider work completed."), ordinal-appended after all
projected items to respect the thread-wide position uniqueness.
App-verified: killed the backend mid-turn; after restart the thread
shows "Run interrupted — Cancelled because the server restarted before
the provider work completed."
Co-Authored-By: Claude Fable 5 <[email protected]>
Locks in per-uuid assistant text segmentation (audit plan #11): the
6d618dc4 MCP session on build fc23be8184 merged 5 interleaved assistant
text segments into one separator-less end-of-turn item ordered after all
tool calls. The current emitAssistantTextArtifacts path already projects
one item per SDK message uuid; this fixture asserts text → command → text
ordering survives replay.
Co-Authored-By: Claude Fable 5 <[email protected]>
Failed read/grep/glob tools projected only {status: failed, pattern} —
the provider's error message was unrecoverable from projections, and
successful outputs were dropped too (audit plan #12, thread 3029dc85
item prt_f15692f3). The file_search contract gains optional output and
error fields; the OpenCode adapter maps part.state.output/error by
terminal status.
App-verified with a real OpenCode agent: a successful package.json read
projects the content in output, and a read of a nonexistent file
projects status failed with error "File not found: ...".
Co-Authored-By: Claude Fable 5 <[email protected]>
A failed cursor turn projected only the generic "Provider turn failed."
because the adapter read a nonexistent `error` field off RunResult
(@cursor/sdk 1.0.22 carries no error text on results; errorCode lives
only in the SDK's internal run store). Persist what the result does
carry — run id, requestId, and duration — so failures can be matched to
Cursor-side logs (audit plan #3, thread c9e72a05 run 2 lost requestId
beca30c7 + 440s duration). The speculative `error` read stays as a
makeProviderFailure cause for future SDK versions.
Co-Authored-By: Claude Fable 5 <[email protected]>
Adapter errors are tagged wrappers whose message getter is a fixed string
("Claude Agent SDK query failed.", "Failed to start run ...") while the
real defect lives in .cause — makeProviderFailure only read the wrapper,
so every failed run persisted a generic message with the root cause
recorded nowhere (audit plan #2: 8 undebuggable failures across 5
threads). makeProviderFailure now walks the cause chain (bounded depth,
deduped) and joins the messages, and picks up the deepest error code.
The run-execution failure log also prints the Cause pretty-formatted
instead of a depth-elided object.
App-verified: breaking the Claude binary path now projects
"Claude Agent SDK query failed. ← Claude Code native binary not found at
/tmp/nonexistent-claude-binary. ..." as the user-visible error item.
Co-Authored-By: Claude Fable 5 <[email protected]>
Introduce a provider-agnostic continuation request queue, worker, and optional
hasPendingBackgroundWork idle pin so adapters can surface post-settle native
wake traffic as first-class runs. No adapter offers continuations here; the
per-provider specialty commits wire attach mode.
Also fix shared run event ingestion dropping late background item
completions. The per-run provider event fiber stopped as soon as the root
turn terminalized and no child provider turns or subagent rows remained
active. Background-capable turn items (background commands, monitors,
subagent rows) that complete after root settlement then lost their trailing
turn_item.updated: the projection kept the item running forever even when
the underlying work (and any wake) succeeded.
Track non-terminal command_execution, dynamic_tool, and subagent turn items
owned by the run or an owned child thread, and keep ingesting until they
terminalize, gated on the root terminal status being completed so
interrupted and failed runs do not pin the stream open.
Repro evidence: Codex emits subagent.updated(completed) before the trailing
turn_item.updated(completed), so post-settle subagent items stuck at running
in the UI; background command items never completed in the
codex-background-exec-wake projection even though the wake run fired. The
same stuck-running signature appears on the Claude background Bash wake and
Grok monitor paths, which reuse this shared ingestion loop.
Ports main's features onto the V2 orchestrator and wire protocol:
- HTTP snapshot loading (#3719): new OrchestrationV2ThreadDetailSnapshot
contract, /api/orchestration/{shell,threads/:threadId} endpoints served
from the V2 engine (orchestration-v2/http.ts), afterSequence resume on
the V2 subscribeShell/subscribeThread WS methods, and V2-typed client
snapshot loaders wired into shell/thread sync with warm-cache resume.
- Thread cache now persists the snapshot sequence (cache schema v3) so
warm caches resume via afterSequence instead of refetching.
- Mobile: main's react-navigation architecture retained; branch's V2
surfaces (relationships banner, queue control, activity inspector,
work-log thread links, fork-from-run) ported off expo-router; thread
status presentation and awareness diagnostics mapped to V2 runtime
fields; pending-task start-turn helper gains creationSource "mobile".
- Retired v1-only additions from main (v1 RPC schemas, session/latestTurn
awareness heuristics, v1 engine test updates) where the branch already
replaced those systems with V2 equivalents.
Co-Authored-By: Claude Fable 5 <[email protected]>
- Let started threads switch providers when handoff is supported
- Keep model picker and block reasons aligned with thread capabilities
- Update logic tests for the new provider-switching rule
- remove ACP model discovery and mismatch probe code
- update provider, orchestration, and tests for SDK-based flows
- refresh marketing copy to match the SDK runtime