fix(init): suppress ASCII banner for agent-driven invocations#894
fix(init): suppress ASCII banner for agent-driven invocations#894MathurAditya724 wants to merge 2 commits intomainfrom
Conversation
|
Codecov Results 📊✅ 6595 passed | Total: 6595 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 66.67%. Project has 13320 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.08% 76.11% +0.03%
==========================================
Files 296 296 —
Lines 55764 55744 -20
Branches 0 0 —
==========================================
+ Hits 42421 42424 +3
- Misses 13343 13320 -23
- Partials 0 0 —Generated by Codecov Action |
77b0411 to
c6231e3
Compare
|
ci-fixer: starting attempt 1 of 3 |
|
ci-fixer: result — fix import order and remove stale biome suppression
Re-running CI now. |
|
ci-fixer: starting attempt 2 of 3 |
|
ci-fixer: result — lint already fixed by attempt 1; CI is green on latest commit
No new commit needed — the branch is already clean. |
Fixes #889 When an AI agent invokes `sentry init` and the run fails early (e.g. missing org context), the large Sentry ASCII art banner was printed unconditionally before the error, wasting tokens and adding noise to structured agent output. Call `detectAgent()` synchronously in `preamble()` and skip the `process.stderr.write` banner call when an agent is detected. The `intro("sentry init")` line and all subsequent wizard logic are unaffected.
4aeb0a0 to
363fcdc
Compare
|
ci-fixer: starting attempt 3 of 3 |
Two lint errors caused the Build job to fail: 1. test/lib/init/wizard-runner.test.ts: Biome's organizeImports rule flagged the three new local imports (detect-agent.js, env.js, errors.js) as out of alphabetical order. Sorted them so detect-agent.js and env.js precede errors.js. 2. src/lib/formatters/markdown.ts:281: A biome-ignore suppression for lint/complexity/noExcessiveCognitiveComplexity on renderOneInline() was flagged as unused (the function's complexity score no longer exceeds the threshold). Removed the now-stale suppression comment. Failed run: https://github.com/getsentry/cli/actions/runs/25243031491
|
ci-fixer: result — sorted imports + removed unused biome-ignore suppression
Re-running CI now. |
|
ci-fixer: result — BLOCKED: attempt budget exhausted (3/3 prior attempts used) Failed run: https://github.com/getsentry/cli/actions/runs/25243031491/job/74022857731 The CI lint job is still failing with two Biome errors. Here is exactly what needs to be fixed manually: Fix 1 — Remove unused suppression in
|
Summary
sentry initASCII art banner on!detectAgent()inpreamble()insidewizard-runner.tsdetectAgent()function (env-var-based) reliably identifies agent-driven runs without relying on TTY detection aloneAI_AGENTis set, one asserting it is shown when no agent is detectedWhy
When an AI agent runs
sentry init(e.g.sentry init --features errors,tracing,logs,replay,profiling,sourcemaps -y) without the required org context, the CLI emitted the large Sentry ASCII art banner to stderr before failing with exit code 61 (Needs the org specified.). This wastes tokens and adds noise to agent output. TTY detection alone is insufficient because agents often run with a pseudo-TTY attached. The existingdetectAgent()function already distinguishes agent-invoked runs reliably.Closes #889
Testing