Repository navigation
fix: avoid duplicate CLI replies after a final message send - #194154
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 maintainer review before merge. What this changesSuppress automatic CLI replies after confirmed final source delivery unless other tool work or a required private result still needs an answer. Example: A CLI agent sends “Report complete” to source-chat with final omitted, then returns “The report is ready.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses duplicate rewritten replies that current main still permits, and no actionable correctness or security defect was found in the reviewed head. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCLI execution collects tool starts, results, and confirmed delivery receipts; terminal settlement converts those facts and model output into reply payloads for the existing delivery pipeline. flowchart LR
A[CLI model output] --> B[Tool event tracking]
C[Loopback delivery receipts] --> B
B --> D[Terminal reply preparation]
D --> E[CLI run settlement]
E --> F[Reply payload filtering]
F --> G[Source conversation]
Technical reviewBest possible solution: Keep completion tracking in the existing CLI tool owner and suppress only redundant automatic output while preserving later work, failures, and private results. Do we have a high-confidence way to reproduce the issue? Current-main settlement and downstream text deduplication expose the rewritten-final path; the PR reports a regression failing on its base, but this read-only review ran no target code. Is this the best way to solve the issue? The change uses existing tracking and settlement owners, reuses the canonical finality resolver, and adds focused ordering coverage without a competing delivery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2808e34b4ad3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +67, Tests +41, Other +5. Total +113 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label 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 November 6, 2026, 10:24 AM ET / 15:24 UTC (Revision 3). |
Only let the latest started tool commit terminal source-reply delivery. Preserve the fresh automatic result when another tool starts while a final message send is still settling. Cover overlapping explicit and default final sends in the existing executor matrix. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the existing length guard and use optional access for TypeScript noUncheckedIndexedAccess. The runtime decision is unchanged; the focused agents-root typecheck passes. Co-authored-by: VACInc <[email protected]>
Invalidate completed-source suppression when distinct tool results arrive, including results from tools started before the final send. Keep mirrored CLI results from invalidating later work. Cover both result orderings with failed-tool regression cases. Co-authored-by: VACInc <[email protected]>
Account for the 41 net lines added to the existing executor matrix and its small overlap hook. The cases reproduce both start/result orderings; no global baseline or assertion is relaxed. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…#194154) * fix: suppress duplicate CLI finals after completed source replies * fix(agents): preserve tool ordering after final CLI sends Only let the latest started tool commit terminal source-reply delivery. Preserve the fresh automatic result when another tool starts while a final message send is still settling. Cover overlapping explicit and default final sends in the existing executor matrix. Co-authored-by: VACInc <[email protected]> * fix(agents): narrow the latest loopback candidate safely Keep the existing length guard and use optional access for TypeScript noUncheckedIndexedAccess. The runtime decision is unchanged; the focused agents-root typecheck passes. Co-authored-by: VACInc <[email protected]> * fix(agents): retain replies after earlier parallel tool results Invalidate completed-source suppression when distinct tool results arrive, including results from tools started before the final send. Keep mirrored CLI results from invalidating later work. Cover both result orderings with failed-tool regression cases. Co-authored-by: VACInc <[email protected]> * test(agents): allocate parallel final-send regression coverage Account for the 41 net lines added to the existing executor matrix and its small overlap hook. The cases reproduce both start/result orderings; no global baseline or assertion is relaxed. Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: roboclaw-bot <[email protected]>
Summary
High Level TLDR
Deliver a completed CLI answer once, even when the model rewrites it afterward. Keep automatic replies when other tool work still produces a result.
What Problem This Solves
A successful current-source
message(action=send)can be followed by a differently worded automatic final. Text comparison misses the duplicate, including whenfinalis omitted and defaults to true.User Impact
A confirmed final source send supplies the answer once. Progress sends, other destinations, unsuccessful or unconfirmed sends, result-required internal turns, and subsequent tool work keep their existing reply paths. This includes a previously started parallel tool finishing before or after the final send completes.
Why This Change Was Made
Root Cause
Read-only inspection of the reported Claude CLI turn showed a successful source send followed seven seconds later by a rewritten final with the same report. Private transcript contents and identifiers are excluded.
The shared finality resolver defaults omitted
finalto true, but automatic CLI settlement previously depended on matching text. The deployed base27ea834825c92c2f4a1de833bceb1a3b21a8de23(2026.11.1), overlays #193550/#193775/#193899, and PR based4ae77eae296fd8eb1f90f7a4ebb5d77fa2e6ad9retain the affected behavior.Track confirmed terminal source delivery explicitly. Only the current logical tool call can commit it; distinct tool starts or results invalidate it. A delayed CLI mirror of an already observed loopback result is not new work. Settlement still preserves raw/model text, delivery receipts, failures, interruptions, and private result obligations.
The unchanged internal-source classification helper moves to
execute-messaging.ts; the settlement predicate lives interminal-reply.ts. No runtime configuration, schema, provider, or transport changes. The existing executor matrix gains four overlap cases and a small callback hook, with a justified allocation for its exact 41 net test lines; no global baseline or assertion is relaxed.Verification
Real behavior proof
The isolated proof exercises production CLI execution, loopback tracking, settlement, and reply-payload filtering with synthetic process/channel I/O:
c51720e409e9ce91530cf9fb6c13d8fcbdb86b44. Final heade2c5479eb872a563b04c44de21778077b451f4dbchanges only the allocation file; runtime and test code are identical.c51720eis scoped-clean with no actionable findings, including five complete owner modules. The allocation-only follow-up was separately inspected. Static review is not runtime proof.git diff --checkpass; correction commits have verified signatures and the contributor co-author trailer.What was not tested
No live Telegram/model replay, deployment, or before/after performance measurement was performed. Local runtime evidence uses the production executor with synthetic I/O; it is not deployed-channel proof. Broader validation belongs to the exact-head GitHub checks, not an unstarted testing handoff.