fix(telemetry): stop reporting declined permission prompts as tool errors

Draft
AL
2d ago
+50-6

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

The telemetry loop in prompt.ts treated every errored tool part as a tool failure, including tool calls the user declined at the permission prompt, so a normal user decision was reported as a recurring permission tool error.

The reported message template matches the RejectedError text stored on the tool part by processor.ts, and prompt.ts turned every errored tool part into an error_fingerprint event without checking for a user rejection.

Fix

Tool calls the user declines at the permission prompt are no longer sent as error_fingerprint tool errors, while rule denials and all other permission failures are still reported.

Acceptance criteria

  • A tool part whose error is the user rejecting the permission prompt, with or without feedback, produces no error_fingerprint record
  • A tool part failing with a rule-based DeniedError or an OS permission error such as EACCES is still fingerprinted with error_class permission
  • An error that only mentions the rejection text in the middle is still fingerprinted

Changes

3 files changed, 50 lines added, 6 lines removed.

  • packages/opencode/src/altimate/telemetry/error-detail.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/telemetry/permission-rejection-fingerprint.test.ts

New tests

  • packages/opencode/test/telemetry/permission-rejection-fingerprint.test.ts

Independent review: accepted, confidence 0.88

Verification

  • Verify job: passed

Summary by cubic

Stops telemetry from reporting user-declined permission prompts as tool errors.

The telemetry loop in prompt.ts previously fingerprinted every errored tool part, so declining a permission prompt was recorded as a recurring permission tool error. Rule-based denials and other permission failures are still reported.

  • Adds isUserPermissionRejection to detect the exact rejection text stored on the tool part.
  • Keeps fingerprints for EACCES and other OS permission errors.
  • Adds tests covering rejections, denials, and EACCES.