← Back to PRs

#20235: fix(reply): prevent duplicate final payloads in block pipeline

by PeterShanxin open 2026-02-18 17:50 View on GitHub →
agents size: S
## 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