Skip to content

fix(cli): Pass trace command names instead of parsing usage hints - #2086

Merged
BYK merged 1 commit into
mainfrom
fix/trace-command-name
Nov 7, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/trace-command-name

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fixes a regression from #2085 that Warden reported. It also removes the last runtime parsing of a leading sentry on this path.

Summary

#2085 made the trace usage hints start with the running program (npx -y sentry …, sentry-mcp …). commandNameFromUsageHint in lib/trace-target.ts still stripped only a leading sentry . Under npx or sentry-mcp, it returned npx -y sentry log list, and the sentry tag then added the program name a second time. Ambiguous-project errors suggested npx -y sentry npx -y sentry log list org-a/frontend/….

What changed

  • resolveTraceOrg, resolveTraceOrgProject and resolveTraceOrgOptionalProject take a commandName argument. Each command passes its own bare name: log list, span list, span view, trace logs or trace view.
  • commandNameFromUsageHint and its two regexes are deleted. Nothing derives a command name from hint text anymore.
  • The usage hint is still used only as the hint that gets displayed.

How it was tested

  • New regression test in test/lib/trace-target.test.ts. Under a sentry-mcp identity, an ambiguous bare project in all three resolvers suggests sentry-mcp <command> org-a/frontend and never sentry-mcp sentry-mcp. I checked that the test fails when the old hint parsing is put back.
  • tsc --noEmit (packages/cli): passes.
  • Root pnpm run lint: 0 warnings, 0 errors.
  • node --test scripts/cli-lint-rules.test.mjs: 116 pass.
  • pnpm --filter sentry run check:doc-examples: 1649 examples match.
  • vitest on test/lib/trace-target.test.ts and test/commands/{log,span,trace}: 374 pass, 2 skipped.

Refs #2085
Refs #2050

via @BYK.

--

View Session [Sentry]

#2085 made trace usage hints start with the running program, but
commandNameFromUsageHint still stripped only a leading `sentry `. Under
npx or sentry-mcp, ambiguous-project suggestions from log list, span
list, span view, trace logs and trace view named the program twice.

The trace resolvers now take the bare command name from each command,
and commandNameFromUsageHint is gone.

Refs #2085
Refs #2050
@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 7, 2026 11:26am UTC

Request Review

@github-actions github-actions Bot added the risk: low PR risk score: low label Nov 7, 2026
@BYK
BYK enabled auto-merge (squash) November 7, 2026 11:30
@BYK
BYK merged commit f2bd12b into main Nov 7, 2026
26 checks passed
@BYK
BYK deleted the fix/trace-command-name branch November 7, 2026 11:36

This branch was previously deployed

1 inactive deployment
Preview — f7ae40b8 Deployed Nov 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant