Repository navigation
fix(agents): keep tool-authored replies from hiding unfinished work - #165291
Conversation
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 37ed7a7b-e914-41f4-9fff-0e3bf1e5f546
|
🦞👀 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 changesThe PR admits tool-authored replies only after finalized batch settlement and associates them with their originating assistant input. Example: One model response calls order_confirm and stock_check; order_confirm returns “Order SO1 created,” while stock_check fails.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: current main still permits a tool-authored reply to conceal unfinished sibling work, and the patch coherently repairs that behavior without a concrete introduced correctness defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherEmbedded agents and the Codex plugin convert tool results into completion decisions and source-conversation reply payloads, which existing delivery owners send and mirror into transcripts. flowchart TD
A[Model tool calls] --> B[Tool execution and result middleware]
B --> C[Finalized batch admission]
C --> D[Model continuation]
C --> E[Committed source replies]
E --> F[Conversation delivery]
F --> G[Transcript mirror]
Technical reviewBest possible solution: Retain whole-batch admission and per-input identity within the existing source-reply delivery path. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the failure path: one eligible authored reply can complete the batch despite an ordinary or failed sibling; no target code was executed during this read-only review. Is this the best way to solve the issue? The repair fixes completion at its existing owners, captures finalized results, preserves explicit terminal siblings, and prevents one input’s reply from suppressing another input’s answer or failure. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c44c2e51ad3f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +221, Tests +967, Docs +14. Total +1202 across 34 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 9, 2026, 11:47 PM ET / October 10, 2026, 03:47 UTC (Revision 4). |
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 97079130-b77a-4758-880a-d87dd43c3b94
Refresh the reply-boundary repair against current main, retaining canonical assistant identity and explicit terminal sibling dispositions. Co-authored-by: steipete <[email protected]>
Move the existing error factories without behavioral changes to keep the agent loop within its inherited line-count budget. Co-authored-by: steipete <[email protected]>
Co-authored-by: steipete <[email protected]>
Reflect live native proof: catalog identity alone does not authorize automatic delivery; raw model-call ownership is required. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 1714e232-1a9e-4158-a507-68b5bff9c58f
|
Maintainer disposition for
The current-head durable review reports no findings and no before-merge items, and both required CI gate entries are successful. Proceeding through the repository’s guarded landing workflow. |
|
Merged via squash.
|
…penclaw#165291) * fix(agents): finalize tool-authored replies at batch boundaries Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 37ed7a7b-e914-41f4-9fff-0e3bf1e5f546 * fix(agents): finalize tool-authored replies at batch boundaries Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 97079130-b77a-4758-880a-d87dd43c3b94 * refactor(agents): colocate error factories with tool outcomes Move the existing error factories without behavioral changes to keep the agent loop within its inherited line-count budget. Co-authored-by: steipete <[email protected]> * test(agents): include terminal inventory in stream consumer fixture Co-authored-by: steipete <[email protected]> * docs(plugins): clarify native reply admission for nested calls Reflect live native proof: catalog identity alone does not authorize automatic delivery; raw model-call ownership is required. Co-authored-by: steipete <[email protected]> * fix(agents): keep tool-authored replies from hiding unfinished work Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 1714e232-1a9e-4158-a507-68b5bff9c58f --------- Co-authored-by: steipete <[email protected]>
Related: #164558
What Problem This Solves
Fixes finished tool-authored replies hiding sibling failures, disappearing beside terminal tools, repeating pre-tool narration, or delivering content that result middleware withdrew.
User Impact
Plugin tools can return a finished answer without a model restatement while unfinished or failed sibling work still receives a continuation. Only the originating input's preamble is replaced; earlier and later answers and errors remain visible. No configuration migration or automatic tool opt-in is introduced.
Why This Change Was Made
Capture and completion now share the finalized batch after result rewriting. Codex keeps candidates private until the upstream response closes and every model-emitted call has an eligible result; raw receipts cover late request registration and native siblings. Explicit terminal siblings retain their completion contract without dropping a finished reply. Canonical assistant identity keeps reused call IDs distinct and recovery idempotent.
Reply content comes only from
details.sourceReply. Calls nested inside Code Mode return data to that program, never an implicit send. Codex's direct-reply fast path requires the model-onlydirect-onlycatalog. Existing message-tool delivery remains separate.Evidence
3ace76ecaf4f082c7b00cba861513046b6ff65b6. The final head adds only a documentation clarification learned from that live run; production and test source are unchanged. Documentation formatting and link audit pass (14,947 links, zero broken).check:changedon all 34 changed paths passed, including 27 core-test type shards, extension types, lint, and remaining guards. Full normalpnpm buildpassed in 5m26s. Its nonfatal UI-budget notice was 365.2 KiB startup JS versus 364.7 KiB; no UI source was changed.message_endrewriting, reused call IDs, response-only identity, terminal siblings, delayed native registration, and failure visibility. The refreshed 14-file selection passed in 216.56s. The final five-file selection passed 119 tests in 52.27s (pnpm test <files> --maxWorkers=1); a mechanical owner extraction passed 48 related tests in 6.29s, and the corrected consumer fixture passed 13 in 44.44s. These selections overlap; per-test CI seconds are not measured.Worked on by
Work sessions
View the OpenClaw team session