fix(telemetry): stop reporting user permission rejections as tool errors

Draft
AL
2d ago
+41-0

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 session telemetry loop turned every failed tool call into an error fingerprint, including calls that failed only because the user chose to reject the permission prompt, which is an expected decision rather than a tool failure.

Fix

Tool calls that fail only because the user rejected the permission prompt are no longer recorded as error_fingerprint tool errors, while config denials and other permission failures still are.

Acceptance criteria

  • A tool part whose error is the user-rejected-permission message produces no error_fingerprint record
  • A tool part whose error is the user-rejected-with-feedback message produces no error_fingerprint record
  • Config-rule denials and OS permission-denied errors still produce error_fingerprint records
  • isUserRejection returns true for the real RejectedError and CorrectedError strings and false for DeniedError

Changes

3 files changed, 41 lines added, 0 lines removed.

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

New tests

  • packages/opencode/test/telemetry/user-rejection.test.ts

Independent review: accepted, confidence 0.88

Verification

  • Verify job: passed

Summary by cubic

Fixes the session telemetry loop so user rejections of permission prompts are no longer recorded as error fingerprints.

Tool calls that fail only because the user rejected or corrected the permission prompt are now skipped, while config-rule denials and other permission failures still produce error fingerprints. Adds isUserRejection to distinguish those cases and tests covering the real rejection and denial messages.