Repository navigation
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: blocked before merge. What this changesThis PR retires an unrestorable delegated input without blocking its conversation when no execution, completion, or delivery custody remains. Example: A delegated turn in agent:main:main is interrupted by a Gateway restart and its sender authority cannot be restored.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a current session lockout and resolves both prior findings, but its change to the intentional recovery policy still needs owner approval. Priority: P1 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherGateway restart recovery reads persisted session claims, transcript provenance, and delivery ownership, then settles interrupted work or dispatches an authorized continuation. flowchart TD
A[Gateway restart] --> B[Persisted session claims]
B --> C[Recovery coordinator]
C --> D[Source and custody checks]
D --> E[Atomic interruption settlement]
D --> F[Existing custody owner]
E --> G[Fresh authenticated turn]
Technical reviewBest possible solution: Reuse the existing atomic interruption settlement for inputs without remaining custody, preserving the conversation and requiring current Gateway authorization for subsequent work. Do we have a high-confidence way to reproduce the issue? Current-main source and registered recovery controls establish the tombstone path, corroborated by official-release field and lab reports; this read-only review did not execute a reproduction. Is this the best way to solve the issue? The implementation reuses the existing settlement owner, preserves distinct custody, and fixes startup rediscovery without new storage machinery; its deliberate policy change requires owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 173962bdc5bc. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +65, Tests +89, Docs +11. Total +165 across 8 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel 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 18, 2026, 2:33 AM ET / 06:33 UTC (Revision 2). |
|
@clawsweeper re-review Published The body now embeds captured results from official latest-stable CLI state → stopped-state shutdown marker → candidate Doctor/startup → fresh authenticated Gateway/SDK/read-tool final. It also includes actual FORBIDDEN/token-mismatch errors and the stale prepared-input rejection after canonical reset, with no extra provider/tool I/O. Provider wire responses are scripted; the offline legacy-claim setup and source pin are explicit. All state is synthetic; no operator Gateway was changed. @steipete — please review the narrow per-input settlement policy and final-effect evidence. Pending delivery/completion/independent execution custody still retains its existing blocking owner; old delegated authority is never restored. Maintainer security/policy approval remains required. |
|
🦞👀 Re-review progress:
|
|
Response to the behavior decision in the current review. The body now answers the delegated-recovery question against #150702 and #174177. The recommendation retires only the unauthorized old input, without replay or replacement authority, and retains blocking while other execution/delivery custody remains. Fresh work still requires independent authentication; the policy extension is explicit. |
|
Thank you @enki — this landed as #176682 (squash d6ec4c7), a maintainer rewrite of your change onto current main after the session-controller cutover, with you as co-author on the commit. It keeps your design: an interrupted input whose delegated sender can't be restored is retired with one local notice only when no other delivery, harness completion, or run is still owed. The rewrite also clears stale |
|
@clawsweeper re-review Conflicts are resolved at |
|
ClawSweeper could not start a re-review for this item. |
What Problem This Solves
Fixes a Gateway restart permanently blocking a conversation when its interrupted turn came from another session and the sender's authority cannot be restored.
User Impact
When no reply, harness completion, or independent run remains owed, recovery ends only the old input. The session keeps its identity, transcript and working context and accepts a fresh authenticated message. Recovery never replays the delegated request or claims that its result was delivered. There is no schema or configuration change.
Why This Change Was Made
Reuse the guarded, atomic interruption settlement introduced for unrestorable requester inputs in #174177. Record one local notice and terminal source/run identities, including a source-only claim whose operational delivery ID has already been cleared. Later startup must not turn that settled interruption back into recoverable work.
Pending final delivery, owed harness completion and independent unretired run fences retain their existing owners and blocking behavior. Exhausted attempts and message-tool-only authority failures retain their explicit recovery path. Existing tombstones are not automatically cleared. This deliberately narrows whole-session tombstoning only for an interrupted input without remaining custody; maintainer security review is requested for that policy change.
Related: #161719. Builds on merged #173579's explicit in-place Resume; it does not duplicate that API or restore old sender authority. #173747 explicitly leaves this delegated-authority gap unresolved. The separate archived-Main reset remedy is #176086.
The unchanged pending-final action classifier moves to its existing delivery module so the coordinator stays within its strict file limit; no lint rule is suppressed.
Behavior decision
The review asks whether an unrestorable delegated input may retire without disabling its conversation. I recommend conditional retirement once no other work or delivery obligation remains. Losing authority for the interrupted request should keep that request inert; it need not prevent an independently authenticated future request.
#150702 deliberately prohibits delegated dispatch after sender authority is lost. This patch preserves that prohibition: no replay, synthesized sender authority, or System-authorized followup. #174177 supplies the precedent for retiring an unrestorable input while preserving its conversation.
The custody checks keep existing blocking when a final, harness completion, or independent unretired execution remains. Otherwise the existing guarded transaction records one local interruption and terminal identities. New work still requires fresh authentication. The remaining owner choice is requiring manual session recovery even after conclusive non-executing settlement. Earlier settlement precedent supports this extension; it does not already approve the delegated-input case.
Current upstream conflict repair
Refreshed head
cabf35a82b6be78d46adcb442629a206dfa5b029merges the prior PR head with pinned upstream00575becc9fce53efc73b319a16fa71e6f4123b9, preserving both parent histories. Conflict resolution uses upstream's extracted completion-checkpoint owner and the PR's shared pending-delivery classifier. It removes duplicate retired helpers and migrates fresh authenticated follow-up coverage to current controller admission. A small test-target helper extraction keeps the merged shutdown suite within its existing line limit, preserving store incarnation and configured agent identity.Fresh checks pass: all four selected startup/delivery/native/shutdown suites (222 tests across three canonical shards; 222.92 seconds), production core types, owner Gateway-server and agents-sessions test types, scoped typed lint, formatting, and whitespace. After the fixture extraction, the complete shutdown suite passed again (27 tests; 11.20 seconds wrapper wall), with owner test types and scoped lint. Independent P0–P2 review found no actionable issue in the full PR diff, including the helper extraction; a subsequent local expression hoist is behavior-preserving. Unprovided unchanged upstream dependencies and actual runtime execution were outside independent review coverage.
New-head CI passed on this refreshed head. Prior Gateway/native recovery captures retain their original source qualifications and are not new runtime captures on this merged head. Pending final delivery, harness completion, and independent recovery obligations remain guards against early settlement. No delegated authority is recreated; the behavior decision above remains for maintainer review.
Evidence
Synthetic production-owner regression: actual shutdown marking → recovery's SQLite notice/settlement → next startup → visible-turn admission in the same canonical Main session. Before the fix, the delegated case produces a session-wide tombstone. Afterward, no delegated dispatch occurs, one notice remains, source/run IDs are terminal without delivery evidence, the next startup does not replay it, and a fresh visible turn is admitted without reset or identity rotation. A source-only variant separately reproduced next-startup resurrection before its terminal identity was preserved.
Current revision and regression checks
Current head
b66816d9c9199c8f12cd73949a36e8f7c6642740records a cycle-derived terminal bookkeeping identity when neither saved run ID exists. Second-startup marking no longer rediscovers that settled input. Existing source/operational IDs retain their semantics; the fallback receipt grants no execution authority and requires no schema change.The two failing native controls now assert interrupted settlement and terminal receipts while retaining no-
startTurnand zero-automation-effect checks. 191 recovery/native cases pass (179 recovery-owner and 12 native controls). The no-ID second-startup regression failed before this repair. Core production types, focused changed-test types, scoped typed lint, formatting, diff checks, and fresh complete-candidate independent P0–P2 review pass. The canonical runtime build passes on this exact commit. Current-head broad CI remains separate.Captured real Gateway and latest-stable upgrade evidence
Runtime proof on candidate
b66816d9: official latest-stable2026.10.4CLI wrote synthetic history, followed by the unchanged stable shutdown marker on an offline delegated claim lacking surviving authority and saved run IDs. Candidate Doctor/startup preserved the exact history and physical session, settled it as interrupted without a tombstone, and did not replay the old input. A fresh authenticated turn then traversed the real Gateway, OpenAI SDK loopback transport, and actual filesystem read tool to a correlated final reply (two HTTP requests).Captured real
agent.waitafter an authenticated reset at the prepared-effect boundary returnedstatus: error,Error: Chat admission ended or was cancelled; submit a new turn.No additional provider/tool I/O occurred. The test-only pause retained the unchanged production guard. Actual Gateway logs capture the read-only rejection (FORBIDDEN,missing scope: operator.write) and invalid-token handshake rejection (failurePhase: auth,failureCause: unauthorized,reason: token_mismatch) before I/O. Provider responses were scripted; this is not an external-provider or live-outage claim. Gateway/provider cleanup completed.The captured terminal result and selected saved RPC/log observations are below. Identifiers/messages belong only to disposable synthetic fixtures; no operator Gateway, private conversations, credentials, or external model provider were used. Comparison booleans are harness assertions against the full saved objects; error strings are copied from the actual Gateway/agent responses. The latest-stable fixture qualification is explicit rather than claiming an actual provider turn was killed in the first process.
{ "schema": 1, "candidate": "b66816d9c9199c8f12cd73949a36e8f7c6642740", "capturedTerminalOutput": { "syntheticOnly": true, "head": "b66816d9c9199c8f12cd73949a36e8f7c6642740", "stableVersion": "2026.10.4", "transport": "Real Gateway + authenticated WebSocket RPC + loopback HTTP/OpenAI SDK; provider wire responses scripted; real read-tool filesystem I/O", "externalProviderContacted": false, "stableGatewayReady": true, "stableOfficialCliWroteHistory": true, "stableGatewayStopped": true, "stableShutdownMarkerApplied": true, "candidateDoctorSucceeded": true, "candidateGatewayReady": true, "authenticatedOwner": true, "stableIdentityAndExactHistoryRetained": true, "oldUnownedDelegatedInputNotReplayed": true, "recoverySettledWithoutSessionTombstone": true, "readonlyCallerRejectedBeforeIo": true, "unauthenticatedCallerRejectedBeforeIo": true, "actualProviderReadToolOffered": true, "actualReadReceiptReachedNextProviderRequest": true, "freshAuthenticatedTurnProviderFinal": true, "actualPreparedOwnerReassigned": true, "stalePreparedInputRejectedBeforeProviderOrToolIo": true, "passed": true, "gatewayStopped": true, "providerStopped": true, "fixtureRemoved": true, "providerRequests": 2 }, "actualRpcReadbacks": { "sessions.describe": { "archived": false, "status": "interrupted", "activeRunIds": [] }, "chat.history": { "samePhysicalSessionId": true, "retainedOriginalMessagesExactly": true, "recoveryNotice": [ { "type": "text", "text": "This interrupted turn could not resume after the Gateway restarted: delegated recovery sender authority is unavailable. Your session and transcript are preserved. Send a new authenticated message to continue." } ], "providerFinal": { "role": "assistant", "stopReason": "stop", "content": [ { "type": "text", "text": "SYNTHETIC_MAIN_RESET_USABLE_8429" } ] } }, "agent.waitAfterActualReset": { "status": "error", "error": "Error: Chat admission ended or was cancelled; submit a new turn." } }, "observer": { "ownerLoaded": true, "guardAnchorCount": 1 }, "qualifications": [ "Official latest stable 2026.10.4 CLI created synthetic history. Its unchanged canonical shutdown marker then marked an offline synthetic delegated claim with no surviving source authority and no saved run IDs; this was not an actual provider turn interrupted in the first process. Candidate Doctor/startup loaded and settled that persisted state.", "Actual SDK HTTP transport and filesystem read tool were exercised. Provider wire responses were scripted on loopback; no external provider was contacted.", "A test-only loader paused the prepared synthetic request immediately before the unchanged production admission-currentness assertion. Actual authenticated sessions.reset aborted that admission; the original assertion rejected before provider/tool I/O.", "Client exception objects were not serialized; actual Gateway log records capture the read-only chat.send FORBIDDEN/missing operator.write error and unauthorized/token_mismatch handshake rejection. Only those error fields are reproduced." ], "capturedGatewayNegativeErrors": { "chat.send": { "errorCode": "FORBIDDEN", "errorMessage": "missing scope: operator.write" }, "connect": { "failurePhase": "auth", "failureCause": "unauthorized", "reason": "token_mismatch" } } }The recovery admission policy and final-effect evidence still require maintainer security review; no owner approval is claimed.