Repository navigation
fix: resume queued user work after Gateway restart - #175845
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. |
|
Codex review: needs maintainer review before merge. What this changesChoose a fresh restart-continuation ID when the claimed ID belongs to the original queued user input. Example: Input queued-human-input executes as queued-followup-execution before a Gateway restart.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current recovery identity collision with a focused change; no actionable patch defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway startup recovery reads durable session claims, selects a continuation identity, and dispatches accepted work through the existing agent runtime. flowchart TD
A[Accepted queued input] --> B[Transcript and recovery claim]
B --> C[Gateway restart]
C --> D[Recovery identity selection]
D --> E[Agent runtime dispatch]
E --> F[Assistant final and settlement]
Technical reviewBest possible solution: Retain this focused identity-selection repair within the existing recovery owner. Do we have a high-confidence way to reproduce the issue? The admission producer, canonical :user key builder, and current-main selection condition establish the failing path; the contributor reports the focused regression failing before the fix and passing afterward, without reviewer execution. Is this the best way to solve the issue? This is the smallest complete fix: recognize the existing source-key representation at identity selection while retaining strict transcript admission and established retry behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bcd6ab322aeb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +104. Total +109 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 17, 2026, 5:59 PM ET / 21:59 UTC (Revision 2). |
|
@steipete: current head Added an inspectable synthetic shipped-Gateway/native-provider restart capture. Real owner input enters explicit followup with distinct admission and queued-execution IDs; canonical preserve/zero-custody/exact-task handoff and process restart produce an actual provider final under a third recovery ID, with exactly one unchanged original user row. The body records combined-backport scope, identity-block byte equality/full-owner nonidentity, polling timeout and independent canonical readback qualification, and source-capture limits. No RPC execution was mocked in this capture and no operator Gateway or real user data was used. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
What Problem This Solves
Fixes: queued user work can fail to resume after a Gateway restart with a transcript idempotency conflict.
User Impact
Accepted user input remains intact, and its restart continuation starts without conflicting with the original transcript row. No configuration, schema, or permission changes.
Why This Change Was Made
Queued work keeps its original user transcript key as the recovery source while execution can have a different run ID. Recovery mistook the original admission ID for an already reserved continuation ID and tried to append different content under the original input key.
Recognize the existing canonical user-key form when choosing a fresh continuation ID. Keep the original source correlation and the strict transcript guard. Actual continuation IDs remain stable across uncertain transport failures; prior-lifecycle admissions still rotate.
Evidence
TranscriptTurnAdmissionConflictErrorfor the original synthetic input key.2e3a493d828185504fcf240dbaec31452da5b755, including production types, test types, lint, and the CI gate (run 39070159117). The earlier bounded local compiler checks were stopped under host memory pressure without diagnostics; no local typecheck pass is claimed.Local activation: the equivalent recovery fix is built and deployed in the operator’s existing beta runtime. All six recovery cases pass against that local backport. The managed Node 24 Gateway passes deep status and health checks; the web UI and assets respond, and the final restart window contains no ERROR/FATAL entries. Existing voice and plugin changes were preserved. This is a combined local backport, not a claim that the exact public PR binary or an external-provider recovery turn was exercised.
The focused regression uses synthetic data and simulated Gateway RPC execution with real persistence/recovery/transcript owners. The separate shipped-runtime proof below uses a real isolated Gateway and native provider. No production Gateway or private user transcript is used.
Actual Gateway/native recovery proof
A fresh isolated shipped-runtime proof exercised explicit owner
chat.sendfollowup behind an active native turn. Its original user admission ID differed from the queued turn’s actual execution ID. After a canonical preserve suspension, zero-write-custody check, exact-task process handoff and helper stop/start, an actual native assistant finalQUEUED_RECOVERY_DONEwas recorded under a third, fresh recovery run ID. The canonical transcript retained exactly one original user row with unchanged content; recovery was internal-system work and added no new user row. This uses the built v18 combined backport: the recovery identity-selection block is byte-identical to this PR, while other owner context includes additional repairs. The fixture’s old-client history polling timed out; independent read-only task transcript/session readbacks qualify the final and identity assertions. No fresh active source-claim snapshot was captured, so source continuity is limited to the original claim/key and unchanged canonical row plus reviewed propagation code. Both attempts were cleaned up; no production Gateway or user session was used.Synthetic queued-input restart readbacks
{ "syntheticOnly": true, "publicPr": 175845, "publicSourceHead": "2e3a493d828185504fcf240dbaec31452da5b755", "runtimeContext": "Built v18 combined backport; not an exact public-PR runtime build.", "recoveryIdentitySelectionByteIdenticalToPublic": true, "recoveryIdentitySelectionSha256": "683d2a32f620000ae2ebc9f4a6988458d3de58cb9842eb39306ede59893c8c53", "fullOwnerByteIdenticalToPublic": false, "explicitFollowupOwnerInput": true, "originalAdmissionDiffersFromQueuedExecution": true, "canonicalHandoffCommitted": true, "writeCustodyCountsZeroBeforeCommit": true, "recoveryRunDiffersFromAdmissionAndQueuedExecution": true, "actualNativeAssistantFinal": "QUEUED_RECOVERY_DONE", "actualFinalRunMatchesFreshRecoveryRun": true, "originalCanonicalUserRowCount": 1, "originalUserContentUnchanged": true, "sourceClaimBeforeRestartMatchesOriginalUserKey": true, "freshRecoveryUserRowCount": 0, "limits": [ "First plain scheduled restart produced no qualifying continuation before its bounded timeout; it was cleaned up. Corrected attempt uses canonical preserve/custody/exact-target handoff.", "The fixture post-restart chat.history polling timed out; independent read-only task SQLite transcript and session metadata qualify the actual final.", "The fresh active recovery source claim was not captured. Source preservation is proven before restart and by the unchanged original canonical user row; propagation additionally follows the reviewed owner code.", "Recovery is an internal-system continuation and added no fresh user row. No persisted fresh recovery user-key claim is made." ], "fixturePollingReportedFailure": true, "independentCanonicalReadbackQualified": true, "gatewayStopped": true, "copiedAuthAndTaskStateRemoved": true }