Repository navigation
fix(agents): keep a native CLI binding cleared by another writer - #186624
yy19971996 wants to merge 3 commits into
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 real behavior proof before merge. What this changesPrevent CLI settlement from restoring a resumed native session binding that another writer cleared or replaced. Example: A turn resumes native-resumed, and another writer replaces its binding with native-other-writer.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain This PR addresses a current CLI continuity bug with a focused store guard, but its added tests cause a failing CI gate. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCommand and channel turns share CLI candidate admission; native execution returns binding metadata that the session-store owner commits before releasing the turn. flowchart TD
A[Command or channel turn] --> B[CLI candidate admission]
B --> C[Native CLI execution]
C --> D[Binding settlement]
E[Other writer clears or replaces binding] --> F[SQLite session store]
D --> F
F --> G[Next turn continuity]
Technical reviewBest possible solution: Keep the existing store guard and consolidate its regressions without duplicating clear/replacement coverage or weakening fresh-ID publication. Do we have a high-confidence way to reproduce the issue? Current-main source exposes unconditional republication after a binding-only clear or replacement, supported by the reporter's observations and contributor's red/green store results; this read-only review executed no target code. Is this the best way to solve the issue? Checking binding identity at the existing settlement owner is the smallest production fix and preserves fresh recovery, explicit invalidation, preserved completions, and owned fork successors. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bec3ad81da55. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +12, Tests +18. Total +30 across 2 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 Reviewed October 28, 2026, 4:16 AM ET / 08:16 UTC. |
|
Closing: the shipped-CLI evidence this report needs cannot be produced in the environment available to me. The CLI-harness turn never reaches settlement here. OpenClaw's runner spawns its backend with kernel-level process-tree ownership, and this host cannot become a child subreaper: so every backend child aborts at ~1.6s with What I could verify, for the record:
The production change on Thanks for the review — the test-line consolidation finding was addressed at |
Closes #186613
What Problem This Solves
A CLI turn that resumed native session
XrepublishesXwhen it settles, even if another writer cleared or replaced that binding while the turn ran. The cleared binding comes back and the next turn resumes a native process the other writer retired.Why This Change Was Made
persistCliSessionBindingResultstored a resumed result binding unconditionally in the non-preserveBindingpath. The store guard only compared localsessionId/lifecycleRevision/activeWriterRunId, so a binding-only clear or replacement never fenced the write. Settlement now republishes the admitted native id only while the stored binding still names it; a newly minted native id and explicit clear results keep their current behavior, which is the contract the issue asked for.User Impact
Clearing a CLI session binding (plugin
agent_end, operator clear, or another writer replacing it) now sticks instead of being silently undone by the turn that was already running. No change for brand-new native ids, forclearCliSessionBindingresults, or forpreserveBindingcompletions.Evidence
Runtime proof through the production store boundary (
node --import ./scripts/tsx.mjs, real SQLite session store, no mocks), red onorigin/mainand green on this head80b89b963:before (
origin/mainc7db2804):after (
80b89b963):Regression rows in the store owner's stale-publication table (real temp session store), red on base and green here:
native-resumedresurrectednative-resumedclearCliSessionBindingresultTest-line ratchet: the new rows are folded into the existing stale-publication table,
+6/-6lines, socheck:test-lines-ratchetreportsnet delta: 0. On this headchecks-fast-baseline-ratchetspasses (12m28s) andPR context and evidencepasses (25s); the earlier review's test-line finding described commit38a03e58, before the rows were folded.Evidence gap: this environment cannot run the CLI-harness turn that this report needs end to end. OpenClaw's CLI runner spawns its backend with kernel-level process-tree ownership; here every spawned child aborts at ~1.8s with
stdio startup cleanup did not confirm closure | native owner closed without kernel descendant extinction, reproduced with a three-line stub command as well, so it is not specific to any backend binary. Both the direct store boundary above and the red/green table rows therefore stop one layer below a shipped CLI turn. A realclaudeCLI turn against a live model was verified standalone outside the runner, but not through the product path.AI Assistance
This PR is AI-assisted. Used source reading, the repo's vitest store harness, and a throwaway
node --import tsxscript against a real SQLite session store to reproduce the resurrection on base and confirm the guard. The implementer understands the code: settlement may publish only the native id it resumed while that binding is still present, so a concurrent clear or replacement wins. All evidence above is from local runtime execution.