fix: prevent hidden pre-tool text from confusing channel users#102173
fix: prevent hidden pre-tool text from confusing channel users#102173849261680 wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 9:16 AM ET / 13:16 UTC. Summary PR surface: Source +69, Tests +83. Total +152 across 2 files. Reproducibility: yes. at source level: current Anthropic transport tags text-plus-tool turns as commentary, and the subscriber suppresses commentary-phase output from visible channel replies. I did not run a live Signal replay in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the replay-marker approach after maintainer acceptance and exact-head validation, while keeping broader explicit-send and commentary-leak policy work with #25592. Do we have a high-confidence way to reproduce the issue? Yes at source level: current Anthropic transport tags text-plus-tool turns as commentary, and the subscriber suppresses commentary-phase output from visible channel replies. I did not run a live Signal replay in this read-only review. Is this the best way to solve the issue? Yes, if maintainers accept the replay-marker policy. The latest predicate mirrors the tool-call-containing invariant and avoids the broader, leak-prone alternative of delivering all pre-tool text. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e25fa79c5d19. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +69, Tests +83. Total +152 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles)
|
|
@clawsweeper re-review Updated after the review:
Latest local evidence:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This pull request has been automatically marked as stale due to inactivity. |
Closes #101793
What Problem This Solves
Fixes an issue where users on message channels could miss assistant text that was emitted before a tool call, while the next model turn still replayed that text as if it had been shown to the user.
Why This Change Was Made
The change keeps commentary-phase pre-tool text private from channel delivery, but marks that text as undelivered in provider replay so the next model turn does not assume the user saw or answered it. The replay marker preserves the original Responses replay id when present, drops the commentary phase metadata, escapes internal context delimiters, and leaves the tool call/tool result sequence intact.
Non-goal: this does not change Signal/Telegram/Desktop delivery policy or mutate stored transcript history.
User Impact
Agents no longer continue from suppressed pre-tool narration as though it was visible to the user. If the suppressed text matters after the tool result, the agent is prompted to ask again or send it in a user-visible final reply.
Evidence
stop+toolCall+ commentary text passed with current source:{ "probe": "provider-replay-stop-plus-toolcall-commentary", "inputStopReason": "stop", "inputTextPhase": "commentary", "outputTextIncludesUndeliveredMarker": true, "outputTextInstructsNotSeen": true, "originalCommentaryRetainedForModel": true, "outputTextSignature": "{\"v\":1,\"id\":\"msg_live_probe\"}", "outputToolCallPreserved": true, "outputToolResultPreserved": true, "persistedInputUnchanged": true }OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/replay-history.test.tspassed: 1 file, 31 tests.pnpm exec oxfmt --check src/agents/embedded-agent-runner/replay-history.ts src/agents/embedded-agent-runner/replay-history.test.tspassed.pnpm exec oxlint --type-aware src/agents/embedded-agent-runner/replay-history.ts src/agents/embedded-agent-runner/replay-history.test.tspassed.git diff --checkpassed..agents/skills/autoreview/scripts/autoreview --mode localpassed with no accepted/actionable findings.Agent transcript note: a local candidate session was found, but no redacted transcript section is included because explicit approval is required before adding local session logs to a public PR body.