Skip to content

feat(ai): validate token permissions before running evaluations#244

Open
islameldigwi wants to merge 4 commits into
mainfrom
islam/ai-188-check-config-token-permission-on-sdk-before-running-evals
Open

feat(ai): validate token permissions before running evaluations#244
islameldigwi wants to merge 4 commits into
mainfrom
islam/ai-188-check-config-token-permission-on-sdk-before-running-evals

Conversation

@islameldigwi

@islameldigwi islameldigwi commented Feb 13, 2026

Copy link
Copy Markdown
Collaborator

Overview

Checks that the token has both write (ingest traces) and read (query dataset) permissions before starting evals, preventing wasted time on permission-related failures. Provides clear, actionable error messages with token management links.

Showcase

  • Missing write permissions:
image
  • Missing read permissions:
image

Note

Medium Risk
Adds a new preflight network call that can fail/exit before running evals and changes connection resolution by deriving an edgeRegion from edgeUrl, which could impact eval execution in different environments.

Overview
Preflights axiom eval runs by calling a new /api/v3/evaluations/validate endpoint to ensure the configured token can write (ingest) and read (query) for the target dataset; on failure it prints actionable, formatted guidance (including console links) and exits early (skipped in --debug).

Extends config resolution to accept eval.edgeUrl (example updated) and derives an edgeRegion from the edge hostname (defaulting to us-east-1, with localhost/non-edge fallbacks). Improves eval lifecycle robustness by capturing instrumentation init failures separately for reporting and hardening registration/update error handling, plus adds Vitest coverage for token validation and edge region resolution.

Written by Cursor Bugbot for commit e126238. This will update automatically on new commits. Configure here.

Checks that the token has both write (ingest traces) and read (query dataset) permissions before starting evals, preventing wasted time on permission-related failures. Provides clear, actionable error messages with token management links.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Feb 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/axiom@244

commit: 4870c1d

Comment thread packages/ai/src/config/validate-permissions.ts Outdated
Comment thread packages/ai/src/config/validate-permissions.ts Outdated
Comment thread packages/ai/src/cli/commands/eval.command.ts Outdated

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

? {
status: 'failed',
error: errorToString(instrumentationError),
error: errorToString(registrationError),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instrumentationError overwritten before reporter reads it

High Severity

The instrumentationError property is set on suite.meta.evaluation at line 261, but a few lines later the entire suite.meta.evaluation object is reassigned at line 344 without including instrumentationError. This means the value is always lost, and the reporter (which reads meta.evaluation.instrumentationError to display warnings) will never see it. The new instrumentation error reporting feature in the reporter and console-utils is effectively dead code.

Additional Locations (1)
Fix in Cursor Fix in Web

headers.Authorization = `Bearer ${connection.token}`;
}

console.log({ region: connection.edgeRegion });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Debug console.log statements left in production code

Medium Severity

console.log({ region: connection.edgeRegion }) on line 78 prints a debug object to stdout on every eval run. console.debug('validation response', { data }) on line 91 logs error response payloads. Both appear to be leftover debugging statements that will produce unexpected noisy output for users running evaluations.

Additional Locations (1)
Fix in Cursor Fix in Web

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.

2 participants