Repository navigation
fix: remove provisional children after startup settlement fails - #184420
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 changesRetain a committed child's cleanup receipt before source settlement and remove that child if startup fails before launch. Example: A hidden sessions_spawn call with worktree: true commits its child session, then source settlement rejects.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current provisional-session cleanup gap through the existing lifecycle owner; no actionable introduced defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherNative subagent startup creates session state, prepares context, and hands ownership to the launch pipeline; failed provisional startup uses guarded Gateway session deletion. flowchart TD
A[Native sessions_spawn] --> B[Commit child session]
B --> C[Capture cleanup receipt]
C --> D[Settle source]
D --> E[Launch pipeline]
D --> F[Startup failure]
F --> G[Guarded session deletion]
Technical reviewBest possible solution: Retain committed child identity before settlement and settle failed startup through the existing guarded cleanup owner. Do we have a high-confidence way to reproduce the issue? The corrected real-persistence regression supplies a precise failing boundary, and current-main source confirms the lost-receipt path; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs receipt custody at creation and consolidates early exits under the existing cleanup owner while preserving pipeline and exact-incarnation protections. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 92415c1e5fe7. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +13, Tests +86. Total +99 across 4 files. Added test files: 0. View PR surface stats
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 26, 2026, 6:29 AM ET / 10:29 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
5ab8011 to
75dc3d1
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: provisional child sessions are removed when source settlement rejects after creation. |
…claw#184420) Remove the exact provisional child when source settlement fails after creation. Fixes openclaw#184380.
Fixes #184380
What Problem This Solves
If source settlement rejects after a hidden native child's initial session row commits, startup loses the committed receipt and returns before it binds provisional cleanup. That leaves a durable child session for a startup that was never accepted.
The corrected reproduction is narrower than ordinary cancellation: it keeps the real child write and Gateway deletion path, then deliberately fails source settlement after the commit callback. Ordinary cancellation is a passing control on the base. The issue correction explains the earlier fixture limitation.
User Impact
Failed startup settles the exact provisional child it created. Reset or replacement sessions retain their existing identity protections, and accepted children keep their existing execution and Stop ownership. This requires no configuration or data migration and does not sweep unrelated sessions or worktrees.
Why This Change Was Made
The creation owner now transfers its committed receipt before awaiting source settlement. The existing spawn cleanup owner captures that receipt and remains responsible until the launch pipeline takes over. One finalizer handles the earlier exits, replacing redundant cleanup branches. The cleanup module keeps the session ID and lifecycle revision paired when creation or a committed fork updates ownership.
Evidence
The regression uses the real native spawn tool, session upsert, storage, source commit callback, and Gateway lifecycle deletion. With a deliberately injected settlement rejection, the original production files at 0eb245a leave an extra child row; this patch removes it while preserving the original session inventory and leaving child-run and worktree registries empty. The ordinary cancellation control passes on both revisions.
Changed-file formatting/lint, the line-cap check, and selected production and test type checks pass. Affected cleanup, fork, replacement, authority, attachment, thread-binding, incognito, production-boundary, and direct-caller tests pass. The focused two-case Gateway run took 29.52 seconds including transformation and setup.
Current CI passes on
75dc3d19a0a768f3e26f9229251bc740a7c610d7: all 46 selected jobs succeeded, with 28 unselected jobs skipped. An earlier, unrelated deferred-worktree assertion was reproduced on the unmodified base under Node and pinned Bun, then resolved upstream by #184372. The original case passes on fetched target54408a978fc91fd20130b6f904534b47c8dfe25aand prospective combined treefcfff2453de56c224dcf93a9ef22e9c535c953f2; the source-settlement regression still fails on that target and passes with this repair.A real Gateway/model run passed on the original validated revision
5ab801109acc27449dc8abd86fbd2a940e319531, whose repair is identical to the current revision. The parent requested the hidden child, its real session write committed, and authenticatedchat.abortstopped the parent while the fixture held the write return. The source-settlement wrapper then received an explicitly injected failure. The runtime receipt confirms one committed write, removal of that exact child, preservation of another parent's accepted child, no admitted child run, and zero worktree/setup creation. The test took 25.459 seconds, or 55.23 seconds including setup and transformation. This controlled failure is not an ordinary-frequency or natural-failure claim.The native runner verified source head
5ab801109acc27449dc8abd86fbd2a940e319531and tree021f62632b76dc597e697afccd053e4ca0316183. The following captured receipt was emitted after the runtime assertions; the native command then completed with exit 0. Session and run IDs are synthetic fixture identities.Captured Gateway/model Stop and cleanup receipt
{ "parent": "agent:main:dashboard:8862a60f-9a7f-48a4-8c26-ebc788e1799b", "parentRunId": "0a52486b-1ff6-42bb-a04b-863b5417d501", "child": "agent:main:subagent:c6c2dd8d-5f12-4ac8-91d5-d81b1f4b1e4d", "sessionId": "676b9fe8-0479-463c-a8bf-02b7a4365eaa", "lifecycleRevision": "a7bc9b86-c759-4ab0-b695-4aea9a57cdfb", "committedWrites": 1, "commitCallbackReturned": true, "settlementFailure": "injected", "stoppedParent": true, "childRemoved": true, "acceptedControlPreserved": true, "childRegistered": false, "childRunAdmitted": false, "worktreeCreations": 0, "registryAndGitWorktreesUnchanged": true, "setupMarkerAbsent": true }Current revision
75dc3d19a0a768f3e26f9229251bc740a7c610d7includes the upstream repair from #184372. The commit-range comparison confirms that this PR's four-file repair is unchanged. The runtime receipt above retains its original tested identity; the combined-result test and inspection of subsequent changes establish that the relevant cleanup behavior is unchanged. Independent engineering review remains clean for this patch. CI is green on the new revision. Its completed exact-head automated review rates readiness, proof confidence, and patch quality Diamond, with no actionable findings.