fix(telemetry): stop reporting user-stopped tools as tool errors

Draft
AL
9d ago
+43-1

Summary

Automated fix proposed by the Altimate software factory; a maintainer reviews every change.

The problem, fix and criteria below are the agent's own account; check them against the diff.

Problem

When the user stops a session while a tool is pending or running, the processor closes the tool part with 'Tool execution aborted' and the prompt loop counted that requested cancellation as a tool failure, sending an error_fingerprint event.

Fix

Tools closed with 'Tool execution aborted' after the session's own abort signal fired are no longer sent as error_fingerprint tool errors, while unrequested aborts and other tool errors are still reported.

Acceptance criteria

  • isRequestedToolAbort returns true only when the session abort signal fired and the error is exactly 'Tool execution aborted'
  • An aborted tool part without a session abort is still recorded as a tool error fingerprint
  • Other tool errors after a session abort are still recorded

Changes

4 files changed, 43 lines added, 1 lines removed.

  • packages/opencode/src/altimate/telemetry/error-detail.ts
  • packages/opencode/src/session/processor.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/telemetry/requested-tool-abort.test.ts

New tests

  • packages/opencode/test/telemetry/requested-tool-abort.test.ts

Independent review: accepted, confidence 0.86

Verification

  • Verify job: passed

Summary by cubic

Stops the prompt loop from reporting tools interrupted by the user's own stop action as tool error fingerprints. When the session's abort signal fired and the tool's error is exactly 'Tool execution aborted', the tool part is now skipped; unrequested aborts and other tool errors are still reported as before.

Bug Fixes

  • Extracts the abort message into a shared TOOL_ABORTED_ERROR constant used by the processor and the new isRequestedToolAbort helper.
  • Adds tests for the requested-abort exclusion and for the cases that must still be reported.