Repository navigation
fix: prevent premature nested tool completion - #176403
Conversation
Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 13745fba-dab1-4608-b059-34c6940d2716
|
🦞👀 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 changesThis PR delays nested-tool terminal presentation until activity persistence is accepted while retaining execution and replay-safety evidence immediately. Example: A nested write creates synthetic.txt while its activity append is delayed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This maintainer-authored PR addresses a completion-ordering defect still present on main. The previous hook-integration blocker is resolved, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded runtime receives nested tool results, records execution evidence, appends display activity through SessionManager, and publishes terminal events to connected clients. flowchart TD
A[Nested tool result] --> B[Capture outcome and effects]
B --> C[Existing activity append owner]
C --> D[Current attempt acceptance]
D --> E[Publish terminal events]
C --> F[Reconnectable history]
Technical reviewBest possible solution: Keep semantic outcome recording in the existing completion owner and publish nested terminal presentation only after current-attempt activity acceptance. Do we have a high-confidence way to reproduce the issue? Main's lifecycle establishes the failing order, and the added composed regression supplies a deterministic held-append scenario; no target code was executed during this review. Is this the best way to solve the issue? The patch repairs the ordering at existing completion and persistence owners, preserves effect evidence before fallible persistence, and retains ordinary provider-tool presentation without unnecessary machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d7359a71255c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +23, Tests +121, Docs +3. Total +147 across 5 files. Added test files: 1. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 18, 2026, 5:48 PM ET / 21:48 UTC (Revision 2). |
Co-authored-by: steipete <[email protected]>
Preserve the upstream package-script invocation and combined hook regressions while retaining deferred nested terminal presentation. Co-authored-by: steipete <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
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.
* fix: prevent premature nested tool completion Co-authored-by: steipete <[email protected]> * fix: prevent premature nested tool completion Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 13745fba-dab1-4608-b059-34c6940d2716 * fix: retain upstream package-script invocation Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
…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.
What Problem This Solves
Fixes: nested Code Mode tools can appear completed before their activity is saved, leaving completion events ahead of recoverable history.
User Impact
User impact: completed nested tools agree with saved history after reconnect. If activity persistence fails, known effects remain recorded for replay-safety decisions instead of making a completed operation safe to repeat. No configuration changes or migrations are required.
Why This Change Was Made
The existing completion owner captures semantic outcome and effect evidence first, prepares terminal presentation, and publishes it only after the current attempt accepts the existing nested-activity append. Ordinary provider-tool completions retain their immediate presentation path. Stale attempts suppress presentation without erasing captured effects.
The conflict refresh preserves upstream’s working
pnpm runinvocation and both hook regressions. Those hook changes are now on main and are no longer part of this PR’s net diff.Evidence
Worked on by
Work sessions