#20235: fix(reply): prevent duplicate final payloads in block pipeline
agents
size: S
Cluster:
Tool Result Handling Improvements
## Summary
This PR now includes two focused fixes:
1. Prevent duplicate final reply emission in block reply pipeline abort/dedup paths.
2. Suppress misleading user-facing tool warning bubbles when errors are recoverable and a normal assistant reply already exists.
## Problem
- In certain abort-edge timing paths, final payloads can be emitted more than once, causing duplicate user-visible final replies.
- Tool retries that recover can still leave a visible `⚠️ ... failed` warning, which can mislead users into thinking the task failed.
## Changes
### Reply pipeline dedupe
- Suppress duplicate final payload emission during block pipeline abort handling.
- Tighten block-streaming dedup path checks.
- Add regression coverage for has-enqueued/final-payload behavior.
### Tool warning policy
- Update embedded run payload warning policy in `src/agents/pi-embedded-runner/run/payloads.ts`.
- `messages.suppressToolErrors=true` now suppresses all tool warning bubbles (including mutating tools).
- Default behavior now suppresses mutating warnings only when:
- the error is recoverable (`required`/`missing`/`invalid`-style), and
- a user-facing assistant reply was already produced.
- Preserve existing `exec`/`bash` verbose-level gating.
- Align config wording in:
- `src/config/types.messages.ts`
- `src/config/schema.help.ts`
## Validation
- `pnpm -s vitest run src/agents/pi-embedded-runner/run/payloads.errors.test.ts src/agents/pi-embedded-runner/run/payloads.test.ts src/auto-reply/reply/block-reply-pipeline.has-enqueued-payload.test.ts`
## Risk
Low to medium.
- Dedupe changes are scoped to reply finalization paths.
- Tool warning changes affect user-visible warning policy, but are covered by targeted tests.
Most Similar PRs
#14216: fix(messaging): check both pipeline and direct keys for reply deduping
by F1xTrack · 2026-02-11
75.7%
#5080: fix(reply): fix duplicate block replies by unblocking coalesced pay...
by yassine20011 · 2026-01-31
72.7%
#18908: fix(payloads): place tool warnings before assistant reply
by BinHPdev · 2026-02-17
71.8%
#16275: fix(agents): prevent rapid-fire duplicate messages during tool exec...
by heyhudson · 2026-02-14
70.0%
#19339: fix(heartbeat): skip isError payloads when resolving heartbeat reply
by aldoeliacim · 2026-02-17
67.6%
#19406: fix(heartbeat): filter error payloads from heartbeat reply selection
by namabile · 2026-02-17
67.4%
#18077: fix: deduplicate TTS audio delivered via tool results
by stakeswky · 2026-02-16
67.2%
#18466: fix: suppress recoverable mutating tool errors when agent already r...
by stijnhoste · 2026-02-16
67.0%
#19235: fix(telegram): tool error warnings no longer overwrite streamed rep...
by gatewaybuddy · 2026-02-17
66.9%
#8205: fix: flush followup messages incrementally
by hanxiao · 2026-02-03
66.8%