fix(agents): suppress raw subagent tool output#80110
Conversation
Based on #80049. Co-authored-by: Blasius Patrick <[email protected]>
|
Codex review: found issues before merge. Reviewed July 4, 2026, 12:02 AM ET / 04:02 UTC. Summary PR surface: Source +5, Tests +36, Docs +1. Total +42 across 6 files. Reproducibility: yes. The old failure is source-reproducible with an empty assistant turn followed by tool/toolResult-only history; current main now has focused tests asserting raw tool text is not selected or announced. Review metrics: 1 noteworthy metric.
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
Security Review findings
Review detailsBest possible solution: Keep the shipped current-main implementation; maintainers should manually close this branch as superseded or refresh it only if preserving the PR lineage, resolving conflicts and dropping the changelog edit first. Do we have a high-confidence way to reproduce the issue? Yes. The old failure is source-reproducible with an empty assistant turn followed by tool/toolResult-only history; current main now has focused tests asserting raw tool text is not selected or announced. Is this the best way to solve the issue? Yes for the core behavior: refusing to promote raw tool output is the right owner-boundary fix. The submitted branch is no longer the best landing vehicle because current main already ships the behavior and the live PR is conflicting with a release-owned changelog edit. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +36, Docs +1. Total +42 across 6 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
|
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs showing tool-only subagent completion no longer surfaces raw tool output.
Motion-trimmed clips: |
|
Closing as superseded by current |




Summary
This keeps the correct core fix from #80049:
selectSubagentOutputText()must not fall through tosnapshot.latestRawTextwhen a child subagent produced only tool/toolResult output. Tool output is not user-facing completion text, so the requester session should receive(no output)or a post-compaction assistant reply instead of raw command/search output.The replacement also fixes the gaps in #80049:
readSubagentOutput()Verification
pnpm test src/agents/subagent-announce-output.test.ts src/agents/subagent-announce.format.e2e.test.ts src/agents/subagent-announce-delivery.test.ts src/gateway/server-methods/agent.test.tspnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/automation/tasks.md docs/tools/subagents.md src/agents/subagent-announce-output.ts src/agents/subagent-announce-output.test.ts src/agents/subagent-announce.format.e2e.test.tstbx_01kr83we61rvr3xjxxbtdme3x2, workflow run https://github.com/openclaw/openclaw/actions/runs/25620248580Real behavior proof (required for external PRs)
tool/toolResultcontent as completion text when no assistant-produced text existed. In Telegram this can surface code/search/exec dumps from the child transcript. This PR makes tool-only histories produce no selected completion output, so the existing announce fallback reports(no output)instead of leaking raw tool text.maint/subagent-no-raw-outputsynced from this PR checkout./Users/steipete/Projects/crabbox/bin/crabbox run --provider blacksmith-testbox --blacksmith-org openclaw --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --idle-timeout 90m --ttl 240m --timing-json --shell -- '<probe tool-only child history>; oxfmt --check; targeted pnpm test ...'. The probe importssrc/agents/subagent-announce-output.ts, stubs Gatewaychat.historywith assistant-empty +toolResult: raw grep output, callsreadSubagentOutput("agent:main:subagent:child"), and fails if the result contains raw tool output or returns any non-undefined text.tbx_01kr83we61rvr3xjxxbtdme3x2, workflow run https://github.com/openclaw/openclaw/actions/runs/25620248580:Pre-fix comparison from Crabbox/Testbox
tbx_01kr83fbqn923dkp3zja0stp6d:readSubagentOutput(). The Crabbox probe result isnull/undefined withleaked:false, and the announce-format tests verify requester completion handoff contains(no output)and does not contain the raw tool text.leaked:true, shown above.Root Cause
readSubagentOutput()rejects tool-only histories or that post-compaction assistant text still wins over raw tool text.Regression Test Plan
src/agents/subagent-announce-output.test.tsandsrc/agents/subagent-announce.format.e2e.test.ts.User-visible / Behavior Changes
Subagent completion announces no longer surface raw tool output when the child produced no assistant text. They now use the existing
(no output)fallback for that case.Diagram
N/A