Skip to content

fix(auto-reply): record reply_operation_aborted as skipped, not completed - #244

Closed
jerhinesmith wants to merge 10000 commits into
boonfrom
fix/reply-operation-aborted-status
Closed

jerhinesmith wants to merge 10000 commits into
boonfrom
fix/reply-operation-aborted-status

Conversation

@jerhinesmith

@jerhinesmith jerhinesmith commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

  • finishReplyOperationAbortedDispatch logged outcome:"completed" for a turn that was dropped before any reply was dispatched (or aborted mid-flight), misreporting it as a successful completion in the message.processed diagnostic log/event that Loki, dashboards, and the diagnostics-otel counters read verbatim.
  • Every other call site that records reply_operation_aborted (the chat-send steering path in chat-send-message-injection.ts, and the messageInjectionAborted branch in dispatch-from-config.finalize.ts) already uses "skipped" for this reason, and the audit-terminal projection in dispatch-from-config.audit.ts already reclassifies this reason to outcome:"skipped" regardless of what raw outcome is passed in — so only the raw diagnostic log/event was out of step with the rest of the codebase's own handling of this reason.
  • Root-caused from a live incident on customer tanco (thread-9434): inbound messages arriving while a session was wedged behind a stalled turn were dispatched into this path and logged outcome=completed with zero content ever delivered, hiding a real drop from on-call triage. RCA + timeline: ENG-20495.

Test plan

  • dispatch-from-config.acp-abort.test.ts: 18/18 pass (updated two tests that pinned the old outcome:"completed" behavior)
  • Full targeted sweep — dispatch-from-config.test.ts, .reply-dispatch.test.ts, .final-outcome-counts.test.ts, .stale-recovery.test.ts, .terminal-recovery.test.ts, .turn-ledger.test.ts, chat-send-message-injection.test.ts, src/audit/: 602/602 pass
  • Confirmed the 9 unrelated failures in a broader src/auto-reply/reply/ sweep are pre-existing (reproduced identically against unmodified main via git stash)

Not in scope (flagged for follow-up)

  • Whether to widen the visible "please try again" notice to cover terminal_unreleased/finalization_stalled/generic run_failed (currently silent) — UX tradeoff, product call.
  • Whether a new inbound message should inherit a prior stalled operation's fate at all vs. being independently re-queued — architectural question, tracked in ENG-20495.
  • A near-identical pattern at dispatch-acp.ts:901 (reason:"acp_aborted") is deliberately NOT touched here — an ACP-cancelled turn may have already delivered content before cancellation, so "completed" may sometimes be legitimate there.

🤖 Generated with Claude Code


Summary by cubic

Fixes the message.processed diagnostic logging reply_operation_aborted turns as outcome:"completed", so a turn dropped before any reply was dispatched now reads as skipped in Loki, dashboards, and diagnostics-otel instead of a successful completion.

Root-caused from the tanco incident, where inbound messages arriving during a stalled session were logged as completed with zero content ever delivered, hiding the drop from on-call triage. This aligns finishReplyOperationAbortedDispatch with every other call site recording this reason and the audit-terminal projection, both of which already classify it as skipped. Updated the two tests that pinned the old completed behavior.

Written for commit 2471fed. Summary will update on new commits.

Review in cubic

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.