Skip to content

fix: Code Mode leaves cancelled tools marked active - #176658

Merged
steipete merged 1 commit into
mainfrom
fix8/code-mode-cancel-settlement
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
fix8/code-mode-cancel-settlement

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes cancelled or expired Code Mode calls leaving a settled nested tool marked active.

User Impact

Code Mode completion and recovery see settled work accurately after cancellation, supersession, or a rejected activity write. Terminal events still wait for accepted history, and rejected or stale presentation remains suppressed. No configuration or migration is required.

Why This Change Was Made

#176403 correctly deferred terminal presentation until nested activity was accepted, but also deferred the lifecycle counters into that conditional publication. Move those existing counter updates to the completion owner alongside the captured terminal outcome, and remove their old branch from the event emitter. The existing append-boundary fixture now checks exactly-once settlement as well as event ordering and retained effect evidence.

Evidence

  • Reproduced both hourly 39172446197 failures on fetched main under Node and the repository-pinned Bun runtime. Reversing only fix: prevent premature nested tool completion #176403's three production-file changes made both original cases pass while retaining fix: preserve Code Mode recovery after wrapped tool output #176407 and the remaining main changes.
  • The added lifecycle assertion failed on the unfixed owner for rejected and superseded appends; accepted appends passed.
  • Complete focused files passed on the first fixed-candidate runs: 42/42 on Node and 42/42 on pinned Bun, each with --maxWorkers=1. The changed append-boundary file took 185.99 s (Node) and 171.58 s (Bun), dominated by existing imports/worker preparation; its three cases took 241 ms and 88 ms respectively. No cases or setup were added.
  • Targeted typecheck, typed core lint, boundary guards, formatting, whitespace checks, and independent P2 autoreview passed. Typecheck used the declared proc-safe 0.4.1 declarations in isolation because the prepared shared install still has 0.3.0.
  • The initial Node baseline also had two pre-bridge budget timeouts and one zero-call hook assertion; none recurred on the first fixed-candidate run. No assertions were weakened, and no retries or longer timeouts were added.

PR CI supplies the broad hosted proof.

Record terminal lifecycle accounting before nested activity acceptance can
reject or suppress presentation. Keep terminal event publication after
accepted history and preserve captured effect evidence.

Fixes the accounting regression introduced by 440c86f (#176403).
Both reported cases failed on main under Node and Bun; reversing only that
commit's production delta made both pass. The append-boundary regression
also failed for rejected and superseded writes before this fix.

Full focused proof: Node 42/42, pinned Bun 42/42, maxWorkers=1.
Targeted types, typed core/boundary lint, format and P2 review passed.
Changed fixture full-file wall time: Node 185.99s, Bun 171.58s; imports
and worker preparation dominate, with no additional cases or setup.
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Oct 19, 2026
@steipete
steipete marked this pull request as ready for review October 19, 2026 00:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T00:17:25.312774Z 66641f5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit c5c558d into main Oct 19, 2026
191 of 192 checks passed
@steipete
steipete deleted the fix8/code-mode-cancel-settlement branch October 19, 2026 00:25
steipete added a commit that referenced this pull request Oct 19, 2026
Drop the overlapping local accounting repair after main c5c558d (#176658) landed. All three files now match the fetched main owner exactly; its accepted-history publication gates and exactly-once completion regression remain intact.
steipete added a commit that referenced this pull request Oct 19, 2026
Close the retained rehearsal worker before deleting its socket directory. Observe native-child cleanup receipts on Windows while retaining open-handle refusal and source-preservation assertions. These are fixture lifecycle and worker ownership repairs, not restored wave-28 checks.

Exact-head CI: 39185480559 passed; 39185547813 passed all 17 native Windows state-isolation cases and all 41 targeted Bun config cases (full config-state shard: 258 passed). Code Mode repair already landed in #176658.
steipete added a commit that referenced this pull request Oct 19, 2026
* refactor: bind private core seams to serving owners

Use canonical message boundaries, the singleton auth-row cache, direct exec resolution and concrete sandbox pin owner. Preserve effect authority, delivery receipts and settlement. Current focused types, ordinary lint, suppression suite and independent review pass. Preserve this reviewed checkpoint before the coordinator-required tooling rebase; runtime and cycle proof remain incomplete.

* fix(agents): settle discarded nested tool items

* refactor(agents): use main nested lifecycle settlement owner

Drop the overlapping local accounting repair after main c5c558d (#176658) landed. All three files now match the fetched main owner exactly; its accepted-history publication gates and exactly-once completion regression remain intact.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…6658)

Record terminal lifecycle accounting before nested activity acceptance can
reject or suppress presentation. Keep terminal event publication after
accepted history and preserve captured effect evidence.

Fixes the accounting regression introduced by 716bf79 (openclaw#176403).
Both reported cases failed on main under Node and Bun; reversing only that
commit's production delta made both pass. The append-boundary regression
also failed for rejected and superseded writes before this fix.

Full focused proof: Node 42/42, pinned Bun 42/42, maxWorkers=1.
Targeted types, typed core/boundary lint, format and P2 review passed.
Changed fixture full-file wall time: Node 185.99s, Bun 171.58s; imports
and worker preparation dominate, with no additional cases or setup.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
Close the retained rehearsal worker before deleting its socket directory. Observe native-child cleanup receipts on Windows while retaining open-handle refusal and source-preservation assertions. These are fixture lifecycle and worker ownership repairs, not restored wave-28 checks.

Exact-head CI: 39185480559 passed; 39185547813 passed all 17 native Windows state-isolation cases and all 41 targeted Bun config cases (full config-state shard: 258 passed). Code Mode repair already landed in openclaw#176658.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
* refactor: bind private core seams to serving owners

Use canonical message boundaries, the singleton auth-row cache, direct exec resolution and concrete sandbox pin owner. Preserve effect authority, delivery receipts and settlement. Current focused types, ordinary lint, suppression suite and independent review pass. Preserve this reviewed checkpoint before the coordinator-required tooling rebase; runtime and cycle proof remain incomplete.

* fix(agents): settle discarded nested tool items

* refactor(agents): use main nested lifecycle settlement owner

Drop the overlapping local accounting repair after main 46dea10 (openclaw#176658) landed. All three files now match the fetched main owner exactly; its accepted-history publication gates and exactly-once completion regression remain intact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant