Repository navigation
fix: recovered child sessions fail after their parent finishes - #180728
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. |
✅ Maintainer security changes approvedA maintainer approved this revision with an explicit security approval comment.
A later push requires a fresh approval comment for an external contributor's PR. |
|
Codex review: blocked before merge. What this changesThis PR checks parent authority during admission and lets accepted child execution use its own retained authority. Example: After Gateway restart recovery, a parent uses sessions_send to resume its child and finishes before the child executes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR fixes a remaining child-execution authority defect on current main with a focused patch and adequate Gateway proof; no actionable code findings remain. Priority: P1 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe in-process Gateway adapter turns agent requests into admitted executions, passing caller authorization into admission and Gateway lifetime checks into execution. flowchart TD
A[Recovered parent] --> B[In-process agent adapter]
B --> C[Source authorization at admission]
C --> D[Child retains operator authority]
D --> E[Execution checks Gateway and child authority]
E --> F[Tool effect and terminal result]
Technical reviewBest possible solution: Keep admission bound to its source and accepted execution bound to the existing child authority and Gateway owners. Do we have a high-confidence way to reproduce the issue? Current-main source retains the parent source assertion in child execution, and the supplied base regression fails after parent retirement; this review ran no target code. Is this the best way to solve the issue? The patch fixes the redundant facade check at its owner while preserving admission validation and the child's existing live authority checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e497af9ddb12. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +131. Total +136 across 4 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 HistoryReviewed October 22, 2026, 4:07 PM ET / 20:07 UTC (Revision 3). |
|
@clawsweeper re-review The PR body's Evidence section now contains the requested real-Gateway negative controls and a positive control using the same identified, role-governed synthetic operator:
Each case joins both fixture Gateways and closes clients/provider. Source and compiled pins were independently checked. Production is unchanged at b9bf4f9; the body explicitly qualifies reuse of the working-tree build labelled 271329, scripted inference, earlier failed setup attempts and the two driver revisions. No clean-head rebuild, native Codex proof, live deployment or security-owner approval is claimed. Please reassess the proof and associated merge-risk item. Enforced maintainer security approval remains a separate requirement. |
|
🦞👀 Re-review progress:
|
Drop the mock-enforced revocation case, name the execution-side slot assertGatewayLifetimeCurrent, and reuse the resolved Gateway binding check for continuations.
|
/allow-security-sensitive-change |
…law#180728) * fix: recovered child sessions fail after their parent finishes * refactor(gateway): name execution Gateway lifetime check Drop the mock-enforced revocation case, name the execution-side slot assertGatewayLifetimeCurrent, and reuse the resolved Gateway binding check for continuations. --------- Co-authored-by: jalehman <[email protected]>
What Problem This Solves
Fixes running child sessions failing after their recovered parent finishes when the child was started through an in-process
agentrequest, includingsessions_sendcontinuations.User Impact
A child that has retained its own admitted operator authority can continue after the parent replies. Revoking the operator still blocks child effects, and an expired caller cannot authorize a new execution.
Why This Change Was Made
The child admission already selected the independent policy authority introduced in #176769 and generalized in #178693. However, the in-process agent facade also retained the incoming parent's work assertion as its Gateway-context assertion. Execution checked that redundant assertion before the child's valid authority, so a completed parent could still stop its child.
Separate the existing Gateway-instance assertion from source authorization. Check the incoming source during admission; let accepted execution use the authority retained by its admission owner. Scope intersection, canonical child-lineage selection, revocation, session ownership, and cancellation remain with their existing owners. No new policy, configuration, or stored format is introduced.
This is a narrow follow-up to the merged authority fixes #176769, #178186, and #178693, within the lifecycle ownership consolidated in #177698. Those changes correctly retain child execution authority; this closes the separate in-process facade assertion that still checked parent work after admission.
Related #180704 fixes a different restart symptom: obsolete child-completion reservations parking later input before execution starts. Neither PR depends on the other, and neither replaces the merged consolidation or the outstanding policy proposals. This PR does not change model timeouts, peer-message delivery policy, selected-requester policy, or reply obligations.
Evidence
Real Gateway authority controls
The missing authority controls now pass through the real built Gateway, with an added positive control under the same role-governed synthetic authentication:
sessions_spawn→ fixture restart → recovered-parentsessions_send; parent finishes before child releaseok; one realexecHTTP receiver request after parent done; child final persistedusers.setRolesets the identified operator's role to denied after child admission, before its queued exec response is releasederror/rpc; zero receiver I/Osessions_sendenters a real pending communication approval; canonicalchat.abortends the recovered parent while approval is awaitedEach case used isolated state and a scripted loopback provider on Node 24.22.1, started/joined two owned Gateway processes, and closed both clients and provider. No turn service or authority owner was mocked. No live operator state, external inference or native Codex behavior is claimed.
Existing build metadata identifies
271329fd32df15f9347099872d1c35e756597cad; the working-tree build contains the production patch unchanged at reviewed headb9bf4f98121f226906990933610568c7a69ae403. Captured source hashes match that head, and compiled dispatch retains the source assertion at admission while using the Gateway lifetime assertion during execution. This is source-qualified reuse of that built candidate, not a new clean-head build.The negative captures used driver SHA-256
0cdc9d0dbf7ee8d5685e5d5f9238d007de0cee3366d1d88db23c42fd100f183d. Adding only the allowed case/branch produced driver SHA-256bd4cef65d6cac8dd210c2a88d788e0293dbb9710b99bfe2faf5d1795e5d4efc0; its common authentication, provider, tool preparation and negative paths are unchanged. Both driver revisions, their exact diff, full sanitized terminal captures and source/compiled hashes are retained for inspection. Earlier authentication setup failures remain qualified as setup failures with joined cleanup.Original regression and allowed-path evidence
271329fd32df: 1 failed, 15 passed. The child retains valid independent authority, but the real in-process facade rejects its synthetic effect withRecovery claim retiredafter the parent's work claim closes. The retirement-before-acceptance control passes.--maxWorkers=1, warm cache): 15 tests, about 7.7 seconds of test time; the two new cases take about 2.1 and 0.8 seconds.sessions_spawn; its next parent turn is interrupted by deliberately killing only the isolated fixture Gateway. The same private profile restarts and recovers the parent. Actualsessions_sendadmits the existing child; the child's model response is held until public history contains the parent's final reply and public status is done. Releasing the child then produces exactly one realexeceffect against the synthetic fixture receiver and a persisted child final, with both session incarnations unchanged. Both Gateway processes and the fixture server are joined afterward.Sanitized process-proof sequence and limits
This is the real built Gateway and agent/tool path, using Node 24 and a scripted loopback Chat Completions provider, synthetic inputs, and a fresh private state/config/credential directory. It is not evidence of live-provider transport behavior or native Codex behavior. The build contains the reviewed patch on
271329fd32df; source hashes were recorded and the patch is unchanged in headb9bf4f98121f. Earlier collector attempts failed fixture setup, request classification, or tool-parameter assertions and are not credited as product proof. Raw requests, configuration, and logs remain private; no production conversation data is included here. That original allowed-path process trace did not exercise revocation or pre-admission rejection. The additional real-Gateway controls above now cover both boundaries; the committed regression controls remain supporting evidence.All committed fixtures are synthetic. The live report included both a model-idle timeout and a later recovery-authority failure; the regression proves this reachable authority defect, but does not establish that it caused every observed delay. The later human-started model turn completed, so no transport-timeout change is claimed.
Maintainer follow-up commit
operator role revokedcase. Its mocked turn service enforced revocation itself, so it would still pass if execution stopped checkingprepared.operatorAuthority. The built-Gatewayusers.setRolecontrol above is the real revocation proof.assertContextCurrenttoassertGatewayLifetimeCurrent(createAgentTurnService,StartAgentRunExecutionParams) and documented on the facade option that agent dispatch carries it into accepted execution, so it must not carry caller authority.captureOperatorToolGatewayContinuationContextnow reusesresolved.assertGatewayCurrentinstead of an inlined copy of the Gateway-binding check.Local integration qualification
The patch cherry-picks cleanly onto the existing customized local build. Its continuation suite reports 15 passing cases, including all three new authority cases, and one existing failure in
preserves GitHub identity access after subagent_announce admits a write-only continuation: expected[operator.write], observed[operator.read, operator.write]. A determining-owner rollback of the three changed production files to the incumbent local commit7281cfa5c56breproduces the same assertion failure; the candidate files were restored afterward. The local completion path explicitly retains its source scope ceiling. This local integration difference is not introduced or repaired by this PR; the upstream-based PR candidate still passes all 103 focused tests.The unchanged production patch is now deployed locally as
583f9cf88fb6on the existing customized build. The native service was stopped, the production build passed in 2m 20.2s, and the same Node 24 service started successfully. Authenticated health, core readiness, remote UI access, active plugin registrations, and both affected conversation incarnations were verified. Service definition, configuration, and private environment bytes are unchanged. This verifies activation and preservation, not a claim that every previously observed model delay has been resolved.