fix(add): stop interactive auth from hanging behind the spinner#8
Merged
Conversation
`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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes
stack addhanging 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
logcallback that already pauses the spinner:ProviderContext.prompt(optional) +PromptRequest, threaded throughaddServicepromptSecret()helper — usesctx.promptwhen present, falls back to a stdin read for tests / non-CLI hostsspinnerBridge(spinner, label)inui.tsreturns{ log, prompt }that pause and resume the spinner around terminal I/O; replaces the duplicated inline log closures at alladdServicecall sites (add, scan, doctor, swap, templates)promptSecret; GitHub device-code message goes throughctx.logTests
New
packages/core/src/__tests__/interactive-prompt.test.tslocks in the fix end-to-end (prompt routes throughctx.prompt, secret is trimmed + marked secret,addServicethreads the host prompt intoctx→ 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