Skip to content

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

Closed
jerhinesmith wants to merge 1 commit into
boonfrom
fix/reply-operation-aborted-status-boon
Closed

jerhinesmith wants to merge 1 commit into
boonfrom
fix/reply-operation-aborted-status-boon

Conversation

@jerhinesmith

@jerhinesmith jerhinesmith commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

  • finishReplyOperationAbortedDispatch (src/auto-reply/reply/dispatch-from-config.ts:2075) logged outcome:"completed" for a turn that never produced a delivered reply — dropped before dispatch, or aborted mid-flight because the reply operation it was piggybacking on was force-resolved as aborted. This misreports a dropped/aborted turn as a successful one in the message.processed diagnostic log/event that Loki, dashboards, and the diagnostics-otel counters read verbatim. Nothing downstream corrects it on this branch.
  • finishReplyOperationBusyDispatch, the sibling function right above this one, already uses "skipped" for the analogous non-delivery case ("reply-operation-active") — this brings the aborted-dispatch path in line with that existing pattern.
  • 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. Full RCA + timeline: ENG-20495.

(Supersedes #244, which was built off a stale pre-fork main instead of boon and showed a bogus ~35k-file diff as a result — same fix, correct base this time.)

Test plan

  • dispatch-from-config.acp-abort.test.ts (the two tests pinning the old outcome:"completed" behavior, updated to "skipped"): 16/16 pass
  • Broader targeted sweep — dispatch-from-config.test.ts, dispatch-from-config.acp-abort.test.ts, src/gateway/server-methods/: 115 files / 2525 tests, all pass

Not in scope (flagged for follow-up in ENG-20495)

  • Whether to add a user-visible "please try again" notice for abort reasons that currently deliver total silence to the channel — UX/product call.
  • Whether a new inbound message should inherit a prior stalled operation's fate at all vs. being independently re-queued once the session frees up — architectural question.

🤖 Generated with Claude Code


Summary by cubic

Fixes the auto-reply message.processed diagnostic log so turns that never produced a delivered reply are recorded as skipped instead of completed. Turns dropped before dispatch, or aborted mid-flight because the reply operation they piggybacked on was force-resolved as aborted, were previously logged as successful — hiding real message drops from Loki, dashboards, and on-call triage (root-caused from incident ENG-20495 on customer tanco).

Brings finishReplyOperationAbortedDispatch in line with finishReplyOperationBusyDispatch, which already records skipped for the analogous non-delivery path (reply-operation-active).

Written for commit b2668fb. Summary will update on new commits.

Review in cubic

…eted

finishReplyOperationAbortedDispatch logged outcome:"completed" for a
turn that never produced a delivered reply - dropped before dispatch,
or aborted mid-flight because the reply operation it was piggybacking
on was force-resolved as aborted. This misreports a dropped/aborted
turn as a successful one in the message.processed diagnostic log/event
that Loki, dashboards, and the diagnostics-otel counters read verbatim.
Nothing downstream corrects it.

finishReplyOperationBusyDispatch, right above this function, already
uses "skipped" for the analogous non-delivery case ("reply-operation-
active") - this brings the aborted-dispatch sibling in line with that
existing pattern.

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.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jerhinesmith
jerhinesmith requested a review from a team September 23, 2026 20:32

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/auto-reply/reply/dispatch-from-config.ts">

<violation number="1" location="src/auto-reply/reply/dispatch-from-config.ts:2079">
P3: This eight-line comment repeats telemetry and PR context instead of documenting the invariant. Condense it to 1–3 lines explaining that aborted turns must not be counted as successful.

(Based on your team's feedback about concise source comments and removing PR-specific narrative.)</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

}): DispatchFromConfigResult => {
commitInboundDedupeIfClaimed();
recordProcessed("completed", { reason: "reply_operation_aborted" });
// This turn never produced a delivered reply - it was dropped before dispatch

@cubic-dev-ai cubic-dev-ai Bot Sep 23, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This eight-line comment repeats telemetry and PR context instead of documenting the invariant. Condense it to 1–3 lines explaining that aborted turns must not be counted as successful.

(Based on your team's feedback about concise source comments and removing PR-specific narrative.)

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/auto-reply/reply/dispatch-from-config.ts, line 2079:

<comment>This eight-line comment repeats telemetry and PR context instead of documenting the invariant. Condense it to 1–3 lines explaining that aborted turns must not be counted as successful.

(Based on your team's feedback about concise source comments and removing PR-specific narrative.) </comment>

<file context>
@@ -2076,7 +2076,15 @@ export async function dispatchReplyFromConfig(
   }): DispatchFromConfigResult => {
     commitInboundDedupeIfClaimed();
-    recordProcessed("completed", { reason: "reply_operation_aborted" });
+    // This turn never produced a delivered reply - it was dropped before dispatch
+    // or aborted mid-flight (the underlying reply operation it was piggybacking on
+    // was force-resolved as aborted). "completed" here misreports a dropped/aborted
</file context>
Fix with cubic

@jerhinesmith

Copy link
Copy Markdown
Author

Closing — too stale (8 weeks unmerged). If the reply_operation_aborted mislabeling were still causing customer-visible impact, it would have been re-reported by now. ENG-20495 is already marked Done.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant