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
- Move desktop and server state paths to `userdata-v2`
- Handle Codex subagent activity events in orchestration v2
- Update related path and lifecycle tests
- Detect xAI Task tool calls as native subagents
- Project child session IDs and buffered chunks into the orchestration tree
- Add replay fixture coverage for Grok subagent lineage
Carry forward the reusable ACP replay, drain, and xAI extension work from #3156 while retaining V2-owned adapters, presentation, and provider-acknowledged cancellation semantics.
Co-authored-by: codex <[email protected]>