Skip to content

fix(init): handle setup service auth failures#1076

Merged
betegon merged 1 commit into
mainfrom
fix/init-service-auth-ux
Jun 5, 2026
Merged

fix(init): handle setup service auth failures#1076
betegon merged 1 commit into
mainfrom
fix/init-service-auth-ux

Conversation

@betegon

@betegon betegon commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Treat hosted init setup-service 401 responses as expected auth/API state instead of generic wizard failures. The Mastra SDK wrapper is adapted into the same ApiError(401) path other commands use, so users get existing OAuth/env-token guidance and telemetry silencing stays consistent.

The hosted init path also refuses self-hosted credentials before constructing the Mastra client, avoiding forwarding tokens the hosted service cannot validate. The same auth classification now covers create, start, and resume workflow calls.

Related: CLI-17A

Test Plan

  • pnpm exec biome check src/lib/api/infrastructure.ts src/lib/init/constants.ts src/lib/init/init-service-auth.ts src/lib/init/wizard-runner.ts test/lib/init/wizard-runner.test.ts
  • pnpm exec vitest run test/lib/init/wizard-runner.test.ts test/lib/error-reporting.test.ts — 128 passed
  • pnpm exec tsc --noEmit --pretty false

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1076/

Built to branch gh-pages at 2026-06-05 13:40 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 4843 uncovered lines.
✅ Project coverage is 81.44%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.41%    81.44%    +0.03%
==========================================
  Files          372       373        +1
  Lines        26052     26090       +38
  Branches     16994     17015       +21
==========================================
+ Hits         21207     21247       +40
- Misses        4845      4843        -2
- Partials      1774      1770        -4

Generated by Codecov Action

Comment thread src/lib/init/wizard-runner.ts Outdated
@betegon betegon force-pushed the fix/init-service-auth-ux branch 4 times, most recently from ca9ab91 to 7c6cfd2 Compare June 5, 2026 13:29
Comment thread src/lib/init/wizard-runner.ts
Classify hosted init-service 401s as ApiError(401) so they reuse the CLI's existing token guidance and 4xx telemetry silencing instead of surfacing as generic wizard failures.

Block self-hosted credentials before they are sent to the hosted setup service, and cover createRun, startAsync, resumeAsync, env-token, OAuth, and self-hosted-token paths in wizard-runner tests.
@betegon betegon force-pushed the fix/init-service-auth-ux branch from 7c6cfd2 to 3b35312 Compare June 5, 2026 13:39
@betegon betegon marked this pull request as ready for review June 5, 2026 13:46
Comment thread src/lib/init/wizard-runner.ts
@betegon betegon merged commit a3ddaed into main Jun 5, 2026
29 checks passed
@betegon betegon deleted the fix/init-service-auth-ux branch June 5, 2026 14:51
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.

1 participant