Skip to content

fix(add): stop interactive auth from hanging behind the spinner#8

Merged
MasonStation merged 4 commits into
mainfrom
fix/auth-spinner-hang
Jun 20, 2026
Merged

fix(add): stop interactive auth from hanging behind the spinner#8
MasonStation merged 4 commits into
mainfrom
fix/auth-spinner-hang

Conversation

@MasonStation

Copy link
Copy Markdown
Contributor

What

Fixes stack add hanging forever during interactive credential entry.

The CLI started a @Clack spinner, then a provider's PAT/key-paste fallback wrote its prompt to stderr and blocked on stdin while the spinner kept repainting over the (now invisible) prompt. With no cached credential — e.g. a fresh repo — the process appeared to hang with no way forward.

Fix

Give the host ownership of credential prompting, mirroring the existing log callback that already pauses the spinner:

  • ProviderContext.prompt (optional) + PromptRequest, threaded through addService
  • promptSecret() helper — uses ctx.prompt when present, falls back to a stdin read for tests / non-CLI hosts
  • spinnerBridge(spinner, label) in ui.ts returns { log, prompt } that pause and resume the spinner around terminal I/O; replaces the duplicated inline log closures at all addService call sites (add, scan, doctor, swap, templates)
  • All 9 interactive providers route PAT/key entry through promptSecret; GitHub device-code message goes through ctx.log

Tests

New packages/core/src/__tests__/interactive-prompt.test.ts locks in the fix end-to-end (prompt routes through ctx.prompt, secret is trimmed + marked secret, addService threads the host prompt into ctx → login). Platform-independent — stays off the Phantom vault.

Scope

Split out of the bundled branch fix/interactive-auth-spinner-hang (old PR #7). This PR is only the interactive-auth fix. The kebab-case flag fix landed separately in #6; the release-pipeline / OIDC work is held back pending npm trusted-publisher setup.

🤖 Generated with Claude Code

MasonStation and others added 3 commits June 20, 2026 00:30
`stack add` started a clack spinner and then ran provider.login(). When a
provider fell back to PAT/key paste, it wrote the prompt to stderr and blocked
on stdin while the spinner kept repainting over it — the prompt was invisible
and the process appeared to hang forever (only reproduced when no PAT was
cached, e.g. a fresh repo).

Give the host ownership of credential prompting, mirroring the existing `log`
callback that already pauses the spinner:

- ProviderContext.prompt (optional) + PromptRequest, threaded through addService
- promptSecret() helper: uses ctx.prompt when present, falls back to stdin read
  for tests / non-CLI hosts
- spinnerBridge(spinner, label) in ui.ts returns { log, prompt } that pause and
  resume the spinner around terminal I/O (clack password/text for prompts);
  replaces the duplicated inline log closures at all addService call sites
  (add, scan, doctor, swap, templates)
- all 9 interactive providers route PAT/key entry through promptSecret; github
  device-code message goes through ctx.log; drop duplicate local readLine in
  cloudflare and turso

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test(core): regression coverage for interactive credential prompting

Locks in the interactive-auth fix so the spinner-masking hang cannot silently
return:
- promptSecret routes through ctx.prompt, trims the result, marks it secret
- addService threads the host prompt into ctx → login end to end

Both are platform-independent (the addService case uses an empty-secret stub
so it stays off the Phantom vault, unlike the fake-phantom harness tests that
only run green in CI).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ashlr-stack Ready Ready Preview, Comment Jun 20, 2026 4:33am

Request Review

CI Lint flagged unsorted imports in the two files touched by the
interactive-auth fix. Apply biome's organizeImports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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