fix(macos): unbreak Re-pair recovery from revoked refresh token#30182
Merged
Conversation
Three bugs combine to make the Re-pair menu action unable to recover a server-side-revoked refresh token, leaving the user stuck in "Authentication failed" until they manually inject credentials: 1. forceReBootstrap deleted only the active env's guardian-token.json on remote hatches and preserved the file on local hatches. The CLI's seedGuardianTokenFromSiblingEnv (cli/src/lib/guardian-token.ts) then restored a stale token from a sibling env on the next vellum wake — refresh-window expiry is a clock check, not a server-validity check, so revoked-but-not-expired tokens silently re-armed. 2. performInitialBootstrap's HTTP retry loop awaited connectionManager.isConnected before calling /v1/guardian/init. isConnected only flips true after a 200 health-check response, which requires the credential the loop is trying to mint. No auth → no isConnected → no bootstrap → no auth. 3. forceReBootstrap passed skipFileImport=false on local hatches with the comment "preserving guardian token file as the only recovery artifact" — combined with #1, this re-imported the just-restored stale token. Fixes: - forceReBootstrap now sweeps guardian-token.json across every VellumEnvironment config dir via the new GuardianTokenFileReader.deleteTokenFileAcrossAllEnvs helper, and always passes skipFileImport=true. - HTTP retry loop drops the isConnected gate; bootstrapActorToken surfaces gateway-down errors via its own return value. - Adds VellumPaths.allEnvs(...) factory and CaseIterable conformance on VellumEnvironment so the sweep can iterate all env config dirs. Tests cover the new helper across sibling-env layouts and ensure unrelated assistants are untouched.
siddseethepalli
added a commit
that referenced
this pull request
May 10, 2026
guardianTokenPath now requires a paths: VellumPaths argument (added in #30182), but importIfAvailable was missed during that refactor and still calls it with the old single-argument signature, breaking the macOS build. Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Contributor
Author
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.
Summary
forceReBootstrapnow sweepsguardian-token.jsonacross everyVellumEnvironmentconfig dir (not just the active one) and always passesskipFileImport=true, so a server-revoked-but-not-expired token in a sibling env can no longer silently re-arm itself viaseedGuardianTokenFromSiblingEnvon the nextvellum wake./v1/guardian/initretry loop inperformInitialBootstrapno longer waits forconnectionManager.isConnected— that flag requires a 200 health-check, which requires the credential we're trying to mint, deadlocking every recovery from a wiped keychain.VellumPaths.allEnvs(...)factory +VellumEnvironment: CaseIterableenable the multi-env sweep;GuardianTokenFileReader.deleteTokenFileAcrossAllEnvsdoes the work and is covered by three unit tests.Original prompt
While debugging an "Authentication failed — use Re-pair" loop on the macOS app, we traced it to a server-side-revoked refresh token that the bundled gateway no longer accepts. Re-pair didn't recover because (1) the CLI's sibling-env token seeder kept restoring the stale token after each cleanup, (2) the HTTP
/v1/guardian/initfallback awaited a connection state that itself requires auth, and (3)forceReBootstrapexplicitly preserved the stale local token "as the only recovery artifact." Recovery required manuallyPOSTing to/v1/guardian/initand writing the response intoUserDefaults. This change makes Re-pair self-sufficient again.🤖 Generated with Claude Code