Repository navigation
feat(signin): short-poll for license in expansion hook (v0.12.3) - #63
Conversation
When `! bin/signin` runs inside Claude Code's non-TTY runner, the foreground exits immediately after detaching the background poll, so the welcome banner couldn't be surfaced when GitHub approval landed. Fix: spawnBackgroundPoll now writes a `~/.skillbench/poll-state.json` sentinel; runBackgroundPoll deletes it on exit. The /skillmeter:signin UserPromptExpansion hook checks the sentinel and, if a poll is in flight, short-polls the credstore for up to 10s (under the hook's 12s timeout). The banner now renders the moment the license lands — user flow is: paste code → approve on GitHub → /skillmeter:signin → banner. Also: getLicenseToken now bypasses the in-process cache so a license written by a sibling process is visible to a short-polling caller. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
Disabled knowledge base sources:
WalkthroughThis PR introduces a background polling mechanism to coordinate license approval across separate CLI processes. A new ChangesBackground Polling and License Coordination
Release Version Bump
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.20.0)OpenGrep fatal error (exit code 2): �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m Comment |
Summary
Closes the UX gap reported after #62: when
! bin/signinruns inside Claude Code, stdout is piped so the foreground exits immediately after detaching the background poll. The user approves on GitHub after the parent process is gone, so there's nowhere for the banner to render — they had to manually re-invoke/skillmeter:signinand hope they caught the credstore after the background child finished its token exchange.This PR makes the banner appear automatically on the next
/skillmeter:signin:lib/poll-state.js— new helper.markPollStarted()writes~/.skillbench/poll-state.jsonwhenspawnBackgroundPollfires;markPollEnded()deletes it from a try/finally inrunBackgroundPoll.isPollActive()treats files older than 16 min (GitHub device-code lifetime + 1) as stale and self-cleans.waitForLicense(credstore, timeoutMs)short-polls the credstore until a non-expired license appears, the sentinel disappears, or the timeout fires.isPollActive(), the hook waits up to 10s (under the 12s hook timeout) for the license to land. On success → banner. On timeout → "Still waiting for GitHub approval. Approve at https://github.com/login/device, then run /skillmeter:signin again."credstore.getLicenseToken— bypasses the in-process cache so a license written by the sibling background process is visible to the short-polling caller in the same hook invocation. Same convention I used earlier forgetSignedOut/getTelemetryDisabled.Test plan
markPollStarted→ file exists →isPollActivereturns true →waitForLicenseresolvestruewhen another process callscommitSigninmid-wait, and resolvesfalsewhen the poll ends without a license. Verified locally.! bin/signin→ approve on GitHub →/skillmeter:signin→ banner renders within a few seconds./skillmeter:signinbefore approving → "Still waiting…" message after 10s./skillmeter:signinwhen no poll has ever started → falls through to the existing silent gh / interactive flow.isPollActive()is called.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements
Chores