Skip to content

fix(telemetry): attribute version command runs - #2707

Merged
jariy17 merged 1 commit into
refactorfrom
fix/version-command-telemetry-path
Oct 26, 2026
Merged

jariy17 merged 1 commit into
refactorfrom
fix/version-command-telemetry-path

Conversation

@jariy17

@jariy17 jariy17 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • record bare --version and -V invocations as /agentcore/version before the pre-parser exit
  • cover both version flags with telemetry regression tests

Testing

  • bun test src/router/router.test.ts
  • bun run typecheck
  • bun run lint:check
  • bun run format:check
  • git diff --check

@jariy17
jariy17 requested a review from a team October 26, 2026 17:54
@github-actions github-actions Bot added the size/s PR size: S label Oct 26, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-1.0.0.tgz

How to install

gh release download pr-2707-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-1.0.0.tgz

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Oct 26, 2026

@agentcore-devx-automation agentcore-devx-automation Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AgentCore Harness Review

Verdict: Looks good

Reviewed against the PR's base branch (refactor).

The fix is correct and minimal. The pre-parser --version/-V shortcut in Router.route() (src/router/router.tsx:499-507) short-circuits before compile() ever runs, so neither the c.action nor the c.exitOverride call sites of recordCommandPath were reachable — the cli.command_run metric emitted from src/index.ts's finally block had no command_path, which commandPathSchema.catch("unknown") collapsed to "unknown". Recording /${this.cmdName}/version before the CommanderError throw fixes that:

  • /agentcore/version satisfies commandPathSchema's ^\/agentcore(\/[a-z][a-z0-9-]*)*$ regex in src/telemetry/shapes.tsx, so it won't be silently rewritten to "unknown".
  • There is no real root-level version subcommand (only agentcore harness version), so the synthetic path doesn't collide with an existing command path.
  • exit_reason stays "success" because src/index.ts only sets "failure" when error.exitCode !== 0, and the commander.version error maps to exit 0 — consistent with the test's assertion.

The test uses an in-memory MetricSink (a true I/O boundary) with a real DefaultTelemetryClient, TestGlobalConfigAccessor, and real Router/Commander wiring, and it exercises route() rather than reaching into internals — good. It also preserves the original assertions on the CommanderError shape and exit code.

One non-blocking nit: in src/router/router.test.ts:954, test.each(["--version", "-V"])("$flag on a versioned router ...") uses $-interpolation, which only applies to object rows — with primitive rows the title stays literally $flag, so both cases report the same name. The rest of the repo uses printf style for primitive rows (e.g. src/handlers/project/deploy/index.test.ts:237, src/projectSchemas/aws-targets.test.ts:33), so "%s on a versioned router ..." would make failures identifiable.

@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Oct 26, 2026
@jariy17
jariy17 merged commit 4a81377 into refactor Oct 26, 2026
25 of 28 checks passed
@jariy17
jariy17 deleted the fix/version-command-telemetry-path branch October 26, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants