← Back to PRs

#10605: fix(auto-reply): drain followup queue on error paths + prevent announce bypass

by 1kuna open 2026-02-06 18:31 View on GitHub →
agents stale
## Summary Fixes #5951, Fixes #9278. Two changes to prevent user messages from getting stuck in the followup queue: ### Fix 1: Drain followup queue on error paths (agent-runner.ts) Added `scheduleFollowupDrain(queueKey, runFollowupTurn)` to the `finally` block of `runReplyAgent`. This ensures queued messages drain even when the run throws before reaching `finalizeWithFollowup`. Safe as a no-op when the queue is empty or already draining. ### Fix 2: Announce respects pending user messages (subagent-announce.ts) Before the direct `callGateway("agent")` fallback, check `getFollowupQueueDepth(canonicalKey) > 0`. If pending user messages exist, enqueue the announce instead of sending directly -- closing the timing gap between `clearActiveEmbeddedRun` and `scheduleFollowupDrain`. ## Verification - `pnpm tsgo` passes clean - Both guards are no-ops on the happy path

Most Similar PRs