Skip to content

chore(agent-core): classify turn_interrupted telemetry cause - #1431

Merged
7Sageer merged 1 commit into
mainfrom
chore/turn-interrupted-reason
Jul 6, 2026
Merged

chore(agent-core): classify turn_interrupted telemetry cause#1431
7Sageer merged 1 commit into
mainfrom
chore/turn-interrupted-reason

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue; this builds on internal telemetry review.

Problem

The turn_interrupted telemetry event only carried mode and at_step, so the data could not tell a deliberate user interrupt apart from a timeout, a programmatic abort, max-step exhaustion, an error, or a hook-filtered turn. Downstream analysis had to lump every interrupted turn into one bucket.

What changed

  • Added an interrupt_reason field to the turn_interrupted event with values user_cancelled | aborted | max_steps | error | filtered.
  • For aborted exits, runTurn reads the existing UserCancellationError carried on the abort signal's reason and reports user_cancelled; any other abort stays as aborted. Loop control and the external turn.step.interrupted semantics are unchanged — LoopInterruptReason still carries only aborted | max_steps | error, and user_cancelled lives only on the telemetry-facing interruptReason field.
  • Covered the user-cancel, programmatic-abort, and error paths with agent-turn telemetry tests.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Add an `interrupt_reason` field to the `turn_interrupted` telemetry event so the data can tell a deliberate user cancel (`user_cancelled`) apart from a programmatic abort (`aborted`), max-steps exhaustion (`max_steps`), an error (`error`), or a hook-filtered turn (`filtered`).

The user-cancel signal comes from the existing UserCancellationError carried as the abort signal's reason, reused here without changing any loop control or external protocol semantics.
@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 01f13c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@01f13c6
npx https://pkg.pr.new/@moonshot-ai/kimi-code@01f13c6

commit: 01f13c6

@7Sageer

7Sageer commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex

@7Sageer
7Sageer merged commit dd90775 into main Jul 6, 2026
11 checks passed
@7Sageer
7Sageer deleted the chore/turn-interrupted-reason branch July 6, 2026 12:52
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