Repository navigation
fix: preserve work and queued inputs across gateway updates - #139663
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Live recovery evidence from an isolated real Gateway and Control UI with synthetic data. The recording covers an interrupted main turn, retained FIFO follow-ups, a recovered child and yielded parent, and saturated recovery capacity. Each final appeared once and pending input returned to zero. The screenshots show a document before submission, its answer after restart using the retained attachment, and a captionless image recovered after restart. Actual native-input inspection confirmed the document contents and image bytes reached the model. attachment-2995886852.webm |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 3:05 AM ET / 07:05 UTC. ClawSweeper reviewWhat this changesPreserves interrupted agent work, queued browser messages, and saved attachments across Gateway updates, while improving browser reconnection recovery. Merge readiness⛔ Blocked before merge - 3 items remain This PR remains useful: current main still requires explicit resend of interrupted browser inputs. No actionable introduced defect was found in the inspected recovery paths. The discussion already accepts the documented compatibility contract; the previous review’s downgrade note does not establish a new approval blocker. Priority: P1 Review scores
Verification
How this fits togetherGateway recovery reconnects durable session and input records with newly admitted execution after a restart. The Control UI retains submission bytes until consumption, while agent and child-task owners resume work and deliver replies. flowchart TD
A[Browser outbox] --> B[Durable pending input]
C[Gateway restart] --> D[Recovery reconciliation]
B --> D
D --> E[Fresh admission]
E --> F[Agent and child execution]
G[Saved attachments] --> F
F --> H[Transcript consumption and replies]
H --> A
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep recovery with the existing admission, transcript, and child-completion owners, preserving the accepted downgrade contract and coordinated Gateway/Codex-plugin deployment. Do we have a high-confidence way to reproduce the issue? Yes: current-main source still treats a completed inbound dedupe receipt as final even when its pending input is interrupted; the new regression follows that exact restart sequence. This review inspected the path without executing it. Is this the best way to solve the issue? Yes: the patch repairs existing custody and lifecycle owners, rechecks current authority, and shares attachment preparation instead of introducing parallel persistence or execution paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f2ba79354177. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
The corrected real code-swap and readiness-timeout tests passed with package symlink targets verified before each process starts and no module-resolution or startup-migration warnings. The old Gateway was replaced by the new build; the same browser reloaded automatically, retained the unsent draft and attachment, and completed the original turn, queued attachment, and draft attachment once each. Two genuine consumed receipts from the old collector returned cached success after update, with unchanged transcript contents and no execution. Disconnect to the new Control UI connection measured 43.0 seconds in this cold local run. This is continuity evidence, not a production latency guarantee. The second recording stalls the first real readiness HEAD: it times out at 2,995 ms, the next probe succeeds, exactly one reload occurs, and the retained attachment completes once. All data shown is synthetic. attachment-1340612630.webmattachment-444405080.webm |
|
The compatibility contract is now explicit in the PR body and restart-recovery documentation. This implements the accepted maintainer recovery scope using the existing custody owner: no new configuration keys, tables, columns, indexes, retention policy, or protocol version. A v2026.9.2 downgrade refuses same-ID retries against retained newer request-bound receipts before execution and leaves them intact. Re-upgrade restores matching unconsumed input through fresh admission when the session/input is unchanged; consumed collector receipts remain nonexecuting and excluded from pending counts. Individually consumed inputs already use transcript idempotency. Both retained-receipt cases pass in the 38-test store suite; the stable-tag hash comparison was inspected directly. This is source-contract plus store proof, not a claim that an old binary was run for the downgrade. Matching Gateway/Codex-plugin deployment is documented. A pinned older plugin lacks the repair; a newer plugin on an older host reports unavailable saved-media restoration explicitly. Corrected real old-build/new-process replacement and readiness-timeout proof is complete and attached above. It verified package symlink targets, clean startup, retained drafts/Blob bytes, one final per task, and old consumed receipts returning cached success without new execution. The cold local disconnect-to-UI interval was 43.0 seconds, not a production guarantee. CI findings were repaired and rechecked: import ownership, test routing, native pre-serialization authority, keyless transcript identity, update-owned reload retries, distinct reply grouping, and reconnect copy adoption. Final exact-head CI is running. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Additional browser proof for the reconnect attachment-copy race (real Control UI, mocked Gateway, synthetic data): before the fix, a private Blob copy was allocated but the reconnect state transition prevented adoption, leaving the attachment absent from the message. After the fix, the same attempt adopts its private copy while remaining unconfirmed; one explicit Retry consumes the canonical input and clears the warning. The test gates native FileReader completion until reconnect has parked the row, then verifies exact old/new Blob bytes, independent tab ownership, zero automatic sends, and deletion only after confirmed consumption. The final screenshot shows consumed input, not a completed model response; real-provider completion proof is in the earlier recordings. |
4692354 to
9621e29
Compare
|
Final integration proof used the rebuilt candidate on base The final real Gateway main/child/yielded-parent restart passed: the main used one recovery attempt, the parent used no separate main recovery attempt, the recovered child completed successfully and delivered its result, and the parent wake cleared. Each visible final appeared once and no input remained pending. The attached captures show synthetic work before restart and both completed replies afterward. The final native steering restart also passed on Codex CLI 0.153.4. The canonical steering input existed before native consumption; the old rollout had not received it, while the replacement rollout did. The retained commentary prefix remained before the steering row. Final history contains exactly one canonical steering message, one matching final reply, and zero pending inputs. The final attachment-copy fault test passed through the real Gateway and provider. Exactly one outgoing synthetic The latest ClawSweeper review reports no actionable code or security findings. Its compatibility items retain the documented maintainer contract: upgrade Gateway and Codex plugin together; a downgrade preserves newer receipts but refuses their retries, and unchanged inputs can recover after re-upgrade. No new configuration option, SQLite schema, retention policy, or protocol version was introduced. Stable-source/store proof is not an old-binary downgrade claim. |
9621e29 to
7ef2bae
Compare
|
The final warm-restart proof on This rerun also requires zero chat-error events and zero visible error banners, and both passed. The original interrupted task resumed and reported its outcome before the attachment reply. The earlier run on The repair records the existing typed restart reason on the exact Gateway work lifetime before capability withdrawal. Harness capabilities preserve that captured reason when their existing authority guard rejects. Shared terminal handling recognizes it even before the caller signal aborts, while prior user cancellation and timeouts retain precedence. Authority checks remain intact; there is no UI error suppression. Existing single-flight cleanup wrappers were simplified, leaving a net three-line production increase for this repair. Both defects reproduced in focused regressions before the fix. Validation passed 94 host/terminal/work-scope tests, 74 Gateway connection/close/lifetime cases, affected test-type graphs, typed lint, and independent P0–P2 review. The current-head runtime/UI build passed, with all 146 changed-source hashes and build metadata verified. The attached before/after screenshots were inspected and contain only synthetic test data. Full hosted CI on this final head remains the merge gate. |
|
Merged via squash.
|
…#139663) * fix: preserve work and queued inputs across gateway updates * fix: close recovery ownership and UI reconciliation gaps * test: preserve pre-consumption reconnect fixture ordering * fix: preserve restart recovery with owned dedupe claims * fix: preserve restart cancellation during harness startup
















What Problem This Solves
Gateway updates could strand accepted follow-ups, leave interrupted child tasks without a parent reply, or resume native agents without their saved attachments. Open Control UI tabs could remain disconnected after one failed readiness check. Shutdown during native startup could also turn resumable work into a false failure and leave an error banner after a later reply succeeded.
Why This Change Was Made
Recovery now follows the existing execution, input-custody, and completion owners. Main turns use their admitted execution deadline instead of a separate failed-start watchdog. Recovered children use the current Gateway instance and preserve the parent's completion batch; yielded parents wait for that batch. Retired observers and execution handles cannot act for a replacement.
The browser retains text and attachment bytes until transcript consumption, then reconciles durable receipts on reconnect. Matching interrupted inputs receive fresh admission under the same authenticated sender and physical session. One-shot recovery works with ownership-bound inbound dedupe claims, including in-process restarts that retain the cache; old commit/release handles cannot disturb the replacement receipt.
Native steering and ACP persist canonical input before execution can have effects. Codex restores saved documents and images through an optional host capability that shares ordinary media preparation and enforces aggregate context and transport limits. Gateway shutdown carries its typed restart-cancellation reason before withdrawing capabilities, preserving user-abort and timeout precedence in chat and direct-agent terminal handling.
Automatic and manual browser reload recovery share bounded readiness checks. Private attachment copies survive same-attempt reconnect parking without overwriting edits or newer attempts. Reply grouping requires matching source identities. The refactor removes the recovery abort RPC, duplicate file-extraction policy, caption-based duplicate detection, obsolete helper exports, and unnecessary one-use wrappers.
Production changes are +1,206 net lines; tests/support are +3,980. Growth implements input re-admission, instance-bound recovery, and native media restoration. No configuration option, SQLite schema, retention policy, dependency, or protocol version is added.
CHANGELOG.mdremains release-owned.User Impact
Eligible interrupted work resumes, each browser outbox preserves its input order, attachments remain usable, and parents receive their final follow-up after recovered children settle. Explicit cancellation and genuine execution timeouts remain terminal. Unknown submissions stay visibly unconfirmed until reconciled or explicitly retried; inputs with missing browser bytes or older non-resumable custody still require resend.
This is the maintainer-requested controlled-interruption contract. Update the owning Codex plugin artifact together with the Gateway: an intentionally pinned old plugin does not acquire native attachment recovery from a core-only update, and a newer plugin on an older host explicitly refuses unsupported restoration.
Downgrading to
v2026.9.2preserves newer receipts but rejects their same-ID retries before execution. Re-upgrade restores eligible unchanged-input recovery under fresh admission. Consumed collector receipts remain consumed and excluded from pending counts. Do not delete receipts or change IDs to bypass a downgrade conflict. This contract is documented and accepted in the maintainer discussion; downgrade verification combines stable-source inspection and store tests, not an old-binary execution claim.Evidence
The integrated build passed, including declarations, SDK exports, 90 plugins, Control UI, and metadata. The final runtime/UI build verified all 146 changed-source hashes and its build metadata. Independent reviews found no actionable P0–P2 issues. Full hosted CI on
ed35d985930dpassed, including Windows.Focused validation includes 708 UI owner tests, 209 reload/helper/authentication tests, 103 native steering/client/routing checks, 146 ACP unit/Gateway tests, 38 pending-input store tests, 35 restart integrations, and 193 main-recovery cases. Browser attachment, messaging, and active-turn recovery suites passed 12/12, 19/19, and 7/7. Main integration additionally passed 145 native/transport tests, 120 media tests, 67 dedupe/pending/queue tests, and the affected type/lint gates. The final cancellation repair passed 94 host/terminal/work-scope tests and 74 Gateway connection/close/lifetime cases. Relevant regressions failed before their repairs; final-count, byte-identity, and no-auto-replay assertions were retained.
Inspected evidence: recovery and native media, code replacement and readiness timeout, final main/parent, steering, and copied-tab proof, and startup-cancellation before/after on the final head.
These are isolated real Gateway/provider runs. ACP live evidence proves source-before-effects ordering, not automatic ACP-client resume. Timings are local observations, not a production downtime guarantee. Test Gateways exited cleanly and task credentials were removed. No production Gateway was changed.