Skip to content

fix(init): classify expected workflow bails - #1406

Closed
betegon wants to merge 1 commit into
mainfrom
fix/init-expected-bail-telemetry
Closed

betegon wants to merge 1 commit into
mainfrom
fix/init-expected-bail-telemetry

Conversation

@betegon

@betegon betegon commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Use explicit workflow bail metadata to distinguish deliberate, expected exits from command failures in CLI telemetry.

A result with bailCategory expected now records wizard.outcome as bailed and adds category, reason, step, and workflow exit-code tags. Unexpected and unclassified exits remain errored, so older init servers and ordinary workflow failures keep their existing behavior.

The command still returns the same semantic non-zero exit code and renders the same user-facing explanation. This only corrects observability classification.

Depends on getsentry/cli-init-api#210 for the server-provided metadata; the change is backward compatible while that PR rolls out.

Test plan

  • 66 wizard-runner tests passed
  • pnpm typecheck
  • Biome check on the three touched files
  • git diff --check

Notes

Biome emits the existing internal type-analysis warning for src/lib/formatters/output.ts but completes the touched-file check successfully.

@vercel

vercel Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 11, 2026 7:43am

Request Review

betegon added a commit that referenced this pull request Aug 21, 2026
## Summary

Make `sentry init` accept a terminal workflow result as successful only
when it explicitly reports `status: "success"` and `result.exitCode: 0`.

Previously, a successful response with no `result` or no `exitCode`
passed the truthiness check and could print the success handoff with
process exit 0. The CLI now treats that as malformed, surfaces a
specific `WizardError`, and exits nonzero. Existing nonzero
workflow-to-CLI exit mappings are unchanged.

This makes the process exit status a reliable black-box signal for the
init smoke harness.

## Compatibility

This intentionally stops accepting terminal success payloads that omit
`exitCode`. The current wizard success output already returns `exitCode:
0`.

The draft [#1406](#1406) also
touches `handleFinalResult`; merge order will require rebasing whichever
PR lands second.

## Test plan

- focused wizard runner tests: 74 passed
- CLI typecheck
- Biome on the three changed files
- `git diff --check`
- native `darwin-arm64` binary build
- real Express init against the local candidate API: exit 0
- invalid OpenRouter credential: CLI exit 61 and smoke harness exit 1

## Rollout

The paired API-owned smoke is
[getsentry/cli-init-api#249](getsentry/cli-init-api#249).
Once this lands, bump its pinned CLI SHA so malformed successful
workflow responses cannot produce a false-green smoke result.
@github-actions github-actions Bot added the risk: low PR risk score: low label Sep 21, 2026
@betegon betegon closed this Sep 22, 2026
BYK pushed a commit to getsentry/sentry-mcp that referenced this pull request Sep 23, 2026
## Summary

Make `sentry init` accept a terminal workflow result as successful only
when it explicitly reports `status: "success"` and `result.exitCode: 0`.

Previously, a successful response with no `result` or no `exitCode`
passed the truthiness check and could print the success handoff with
process exit 0. The CLI now treats that as malformed, surfaces a
specific `WizardError`, and exits nonzero. Existing nonzero
workflow-to-CLI exit mappings are unchanged.

This makes the process exit status a reliable black-box signal for the
init smoke harness.

## Compatibility

This intentionally stops accepting terminal success payloads that omit
`exitCode`. The current wizard success output already returns `exitCode:
0`.

The draft [#1406](getsentry/cli#1406) also
touches `handleFinalResult`; merge order will require rebasing whichever
PR lands second.

## Test plan

- focused wizard runner tests: 74 passed
- CLI typecheck
- Biome on the three changed files
- `git diff --check`
- native `darwin-arm64` binary build
- real Express init against the local candidate API: exit 0
- invalid OpenRouter credential: CLI exit 61 and smoke harness exit 1

## Rollout

The paired API-owned smoke is
[getsentry/cli-init-api#249](getsentry/cli-init-api#249).
Once this lands, bump its pinned CLI SHA so malformed successful
workflow responses cannot produce a false-green smoke result.

This branch was successfully deployed

1 active deployment
Preview — 51437340 Deployed Aug 11, 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