Repository navigation
fix(cli): do not re-publish a binding cleared mid-turn - #192050
moonbow0407 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 turn settlement from restoring a resumed or fork-successor session binding another writer cleared or replaced. Example: A Claude CLI turn resumes native session X, then an agent_end handler clears X before settlement.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: current main still has the reported stale-binding overwrite, and this is a focused repair with no actionable code findings. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared CLI candidate owner admits command and reply turns, runs the native backend, and settles returned continuity through the existing guarded session-store writer. flowchart TD
A[Command or reply turn] --> B[Admitted CLI candidate]
B --> C[Native CLI execution]
C --> D[Agent end hook]
D --> E[Binding settlement]
E --> F[Guarded session store]
F --> B
Technical reviewBest possible solution: Retain the focused comparison at the existing guarded store update so intervening invalidation wins while fresh native IDs and explicit clears continue to settle. Do we have a high-confidence way to reproduce the issue? Current main permits a binding-only clear to preserve all lifecycle guard fields before ordinary settlement restores the returned native ID; the hook ordering and both candidate callers establish the path, but no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair using existing owners: capture the admitted ID and reject stale republication inside the authoritative update, including successors already published by the turn. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e44b3d65e509. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +24, Tests +79. Total +103 across 3 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 (2 earlier review cycles)
Reviewed November 3, 2026, 9:11 PM ET / November 4, 2026, 02:11 UTC (Revision 3). |
persistCliSessionBindingResult unconditionally rewrote the native CLI session binding on settle. When another writer cleared (or replaced) that binding between agent_end and settle, the retired id came back and the next turn resumed a process the clear had retired. Capture the resumed id in withAdmittedCliCandidate and skip re-publishing when settle would only resurrect that same id after it left the store. Newly minted ids and explicit clears still publish. Closes openclaw#186613
Settlement already skipped re-publishing the admitted resume id after another writer cleared it. Forks publish a successor into expectedSession first; if that successor is cleared or replaced before settle, protect it the same way so the retired id is not restored.
|
Pushed a follow-up for the ClawSweeper fork-successor finding: Settlement now treats the native id already published into this turn's working New coverage: cleared fork successor and replaced fork successor. @clawsweeper please re-review. |
6d63678 to
f765dc3
Compare
CI format-changed-files rejected the prior head for oxfmt/Bun parity on embedded-agent-runner/run-entry-cli.ts.
|
Fixed CI `format changed files`: ran oxfmt on `src/agents/embedded-agent-runner/run-entry-cli.ts` for Bun parity. PR context section also updated to What Problem This Solves. |
|
Fork-successor protection is on the current head ( Live Gateway/CLI multi-turn settlement traces still need a configured native CLI provider session. Offline proof is the production settle owner with clear/replacement + fork-successor regressions. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Working the ClawSweeper proof gate from this Linux contributor box. Offline/unit boundary coverage is already on the branch. The remaining Before merge ask still needs a live environment this box cannot supply: Need: CLI turn that resumes a native session, then an agent_end clear mid-turn, showing settlement does not restore the cleared binding on the next turn. Once that transcript is available, paste it into Evidence and comment |
Evidence (Gateway live + shipped CLI settlement path, synthetic)Native Gateway on Linux Node v24.22.1 ( Cases (all ok:true)
Key parameter: Local artifact: Blocked for a full Claude CLI subprocess spawn on this box (no @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Blocked (one-liner): No in-repo stub/fake native Claude CLI adapter can drive admission→clear→settle→next-turn end-to-end; real |
What Problem This Solves
persistCliSessionBindingResultrewrote the native CLI session binding on every non-preserveBindingsettle.agent_end(and other writers) can clear that binding before settle. The settle path then resurrected the retired id, so the next turn resumed a process the clear had already retired (useResume=true resumeSession=<old>).Fix
withAdmittedCliCandidatecaptures the in-lane resumed native session id.persistCliSessionBindingResultskips applying a settle result that would only re-publish that same resumed id when the store no longer names it.Evidence
New coverage:
does not re-publish a resumed binding another writer cleared mid-turnstill publishes a newly minted native id after a mid-turn clearCloses #186613