Repository navigation
fix(runtime): preserve execution ownership across stream loss - #1301
Conversation
|
This pull request is merged. |
|
Request changes on head 03f0a65. The ownership direction is reasonable, but two existing fallback paths still violate the behavior this PR changes.
The CI repair is pushed as 03f0a6588: remove synthetic cancellation text when the actual callback cause replaces it, and align SSE/owner/cursor fixtures with the producer contract. No workflow, MOI gate, SQL or prompt-cache changes. Validation on machine 57: all eight original CI failures now pass; runtime complete CI inventory 6058 passed (204 skipped); CLI inventory 5493 passed, with two inherited NO_COLOR=1 banner failures separately passing under a controlled color environment (23 originally skipped). CLI/runtime all-target Clippy with -D warnings and formatting pass. The new hosted CI run is not awaited. The review-only counterexamples were kept out of the repair commit. GitHub rejected the formal review because the authenticated account is this PR author. This comment records the request-changes recommendation; it does not set the formal GitHub REQUEST_CHANGES review state. |
|
Follow-up fixes are pushed in 904c597.
These address both findings in the earlier review and the subsequently reproduced recovery counterexamples without adding SQL, storage, polling, a lifecycle state machine or a retry controller. Prompt-cache behavior, permissions and the MOI gate are unchanged. Current local validation: CLI 5,496 passed / 23 configured skips; SDK 573 passed / 13 opt-in live cases unrun; Web 1,032 passed. Rust all-target check/Clippy/format, SDK typecheck/build, Web typecheck/affected ESLint/production build and PR metadata validation passed. Actual HTTP and controlled async tests cover cancellation, replacement, same-ID recovery and stale publication; no sanitizer pass is claimed. gpt-6.1-terra / max design and final overall review approved the exact content, with no unresolved material blocker. Complete reviewed diff SHA-256: 803089d5e125b5932f450cc6b75933df9ed974274685a037d8fb10a6ac3ac67e. Final review thread: 01a1dd2c-7670-7d43-94da-b21c5a2e9a9d. The PR description retains the original macOS, cross-instance MCP and comparable historical performance validation gaps. This does not claim blanket closure of the seven referenced issues. Hosted CI is not awaited. |
|
Request changes on commit 904c597. [P2] Scope admission knowledge to the new pending turn, not an old interaction run. The first-rejection checks still require !rootRunId.current, but interaction refresh retains the previous run ID when the interaction list becomes empty. Submitting new guidance creates a fresh PendingTurn without retiring that old binding. The real parent keys the composer by Work/branch, so its interaction refresh does not remount it. Reachable sequence: open a Work with an approval/question from old run A; another surface answers it and a refresh supplies an empty interaction list; send a new instruction B; B's very first HTTP response is a definite pre-admission rejection. With 403, pending is never cleared, guidance remains disabled and Reconnect is incorrectly offered for a request known to be rejected. With 409 writer_conflict, mayHaveRun is not reset, so Keep viewing enters the uncertain-request branch instead of restoring the draft and releasing the rejected turn. Executed on machine 57 using the real SDK SSEClient, React component and controlled HTTP responses: both old-interaction cases fail; the otherwise identical no-old-interaction 403/409 controls pass. Replacing only the composer with its merge-base version makes all four probes pass; the candidate component was restored afterward. This is a component regression control using the same current SDK, not a full-base benchmark. Retire the old request-scoped root binding when creating a genuinely new pending turn, or otherwise derive first-admission knowledge only from this pending request. Preserve that binding across actual same-request recovery. Reuse the existing owners; no new state machine, query or compatibility layer is needed. Cover refreshed old-interaction -> fresh 403 and -> fresh writer_conflict/Keep viewing alongside the existing uncertain-recovery controls. The two substantive findings in the earlier discussion are addressed: post-turn artifact failure now uses the warning channel without replacing confirmed completed/paused outcomes, and CLI 408/inconclusive HTTP retains request custody and bounded original diagnostics. There are no formal reviews or inline threads at the reviewed snapshot; the merge-queue bot comment requires no code change. I checked the complete 49-file delta by owner: execution/receipt ownership in runtime and turn-core; Rust thin-client/CLI consumers; SDK transport/projection and hooks; Web projection lease and Work interaction lifecycle. Removing synthetic terminals, duplicate error/root tracking and the SDK event allowlist is coherent. The remaining blocker is the stale old/new identity assumption above, not a need for another recovery path. Implementation, tests and documentation were considered separately. Existing exact-source CLI 5,496 / SDK 573 / Web 1,032 passing evidence is reused rather than represented as fresh review executions. The new four-case QA probe has 2 failures and 2 controls passing; all four component baseline controls pass. Existing tests start the first-rejection cases with no prior interaction, which is why they miss this regression. Documentation accurately limits execution settlement to its owner and does not promise blanket closure of the seven issues. Cost: no new schema, query, persistence writer or polling loop in this delta; the recorded nine real Router/MatrixOne scenarios retain 17 cold / 19 existing-context / 18 held-control SQL statements. This is unchanged SQL cost, not a measured storage reduction or latency improvement. Original macOS, cross-instance MCP and historical comparable performance limits remain unverified. No subagents, implementation changes, commits or pushes were made for this review. The main PR checkout stayed clean and its 49 source hashes match the reviewed full-diff SHA-256 803089d5e125b5932f450cc6b75933df9ed974274685a037d8fb10a6ac3ac67e. Only an isolated review worktree carried the saved test probes. Final diff check passed; hosted CI was not waited on. GitHub rejected the formal REQUEST_CHANGES review because the authenticated account is the PR author. This comment records the recommendation; it does not set the formal GitHub review state. |
|
The stale prior-interaction identity finding is fixed in 5962e31. Fresh guidance now retires the earlier interaction's root immediately before creating its pending request. Same-request reconnect and takeover preserve their existing identity, uncertainty and receipt. This uses the existing owner: no new field, state machine, SQL, storage or retry path. Two older first-rejection tests were consolidated into one real-SDK/React six-case table: first403 and writer-conflict409, each with no prior interaction, an earlier interaction removed by refresh, or an interaction answered locally before updated props arrive. Before the production fix, all four old-interaction cases failed and both no-history controls passed. After the fix, all six pass; the full Web suite passes 1,036 tests, including 40 composer cases and the existing genuine-uncertainty/reconnect/takeover controls. First403 releases input without Reconnect; first409/Keep viewing restores the draft and removes optimistic messages without taking control. Production delta is one synchronous assignment and its comment. The test file is net+8lines after consolidation. Web typecheck, affected ESLint, production build, diff and PR metadata checks passed. The 47 unchanged files retain their prior Rust/SDK/runtime/native/MOI/SQL evidence; no storage reduction or measured latency improvement is claimed. gpt-6.1-terra / max approved the design before implementation (thread 01a1dd56-1693-7ff1-b0a3-26e70e79b151) and the final overall review with no remaining material blocker (thread 01a1dd5d-a419-72f3-973c-3ed38e3a88c9). Exact complete candidate diff SHA-256: e0c1674037053d2b5b2a2b92cd404b92385bdf220289fda5ec5996e9a91960d2. This is model review, not a formal GitHub self-approval. The original macOS, cross-instance and historical performance validation limits remain. New hosted CI is not awaited. No merge or deployment was performed. |
Capability assessment: Unchanged: Runtime, Work, CLI, Web and MCP retain their existing support status and runtime profiles. This repairs stream observation, diagnostics and result reporting; permissions, the MOI gate and prompt-cache behavior are unchanged.
Summary
A lost stream could invent a failed run, replace its actionable cause, cancel an already-started tool, or discard an uncertain Work request. Keep execution settlement with its owner and make observation failure recoverable.
cache.hitas null when coverage is unknown.Related issue
Refs #1016, #1249, #1261, #1100, #1119, #1290, #1291. Existing fixes and controlled baselines are reused where applicable; this PR does not claim complete closure of all seven reports.
Change type
User and compatibility impact
An unconfirmed stream emits the existing stream_observation_interrupted error instead of a fabricated failed run_finished. Only producer-owned receipts settle execution. Live completed/paused receipts require their response projection; indexed durable replay uses its journaled answer.
Finite replay/error and live responses use the existing SSE DONE marker. Web delivers supplemental artifacts or an auxiliary warning before its one downstream marker. The selected result and paused resume identity survive that optional read failing; cancelled or superseded readers cannot publish late data.
Work runtime observations pass the canonical server projection without a second SDK event allowlist. Identity and control-envelope validation remain strict. SDK Work callbacks have an open event union; unguarded event.type switches may require migration to isWorkTurnEventType. CLI JSON
cache.hitis nullable for unknown coverage; observed hits and supported complete zero reads retain their meaning.Architecture and complexity delta
Verification
Current correction on machine 57:
Reused evidence for unchanged boundaries:
Remaining limits: the original deployed macOS/browser incident, cross-instance MCP cancellation/reaping and historical comparable 3× latency target remain unverified. The existing SDK artifact read exposes no abort signal; submitted reads follow existing fetch behavior and late results are fenced. No new timeout or retry is introduced, and no finite SDK timeout is claimed. The new hosted CI run is not awaited.
Final checklist