Skip to content

fix(next-auth): preserve sessions when Keychain is temporarily unavailable - #26563

Open
teamleaderleo wants to merge 5 commits into
feat-cmux-nextfrom
auth-next-keychain-availability
Open

teamleaderleo wants to merge 5 commits into
feat-cmux-nextfrom
auth-next-keychain-availability

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

HOLD: Land after #25759 (fix/25665-auth-review-followup) adds FallbackTokenStore.isTokenStorageAvailable() to the shared auth runtime and that API is present on feat-cmux-next.

NEXT’s CloudAuth currently constructs the shared protected Keychain/file fallback but leaves AuthCoordinator.isTokenStorageAvailable at its default { true }. A transient Keychain-unreadable result can therefore look like an empty store during NEXT restore and clear the cached signed-in session. This downstream patch wires the existing availability hook to the fallback store. It deliberately contains no Keychain policy, token-store, SDK, or classic composition changes; #25759 owns those.

Validation: python3 scripts/cmux-next/prepush-gate.py passed; git diff --check passed. The Swift package cannot compile this branch until #25759’s shared API is merged/synced. After that dependency lands, run the focused CmuxAuthRuntime availability tests plus CmuxNextAppTests auth restore coverage on this exact commit rebased onto the dependency.

Leo’s onboarding ask applies: “Also, we need to be fixing authentication issues, like the whole onboarding situation. Is that in? What does you improve? What does you fix? The edge cases, like you guys need to comprehensively brainstorming all the onboarding edge cases: foot guns, paper cuts, snags, clips, whatever the f***.”

Risk: high (authentication session persistence). No UI change and no capture required.

agent-identity footer --repo manaflow-ai/cmux


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes NEXT sessions being cleared when the Keychain is temporarily unreadable (for example, before first unlock). CloudAuth now forwards the fallback token store's availability to AuthCoordinator, so a transient Keychain error is treated as an unavailable store instead of an empty one, and the cached signed-in session survives restore.

Written for commit 76d3ac3. Summary will update on new commits.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 76d3ac3: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr26563 -f ref=auth-next-keychain-availability -f platform=macos -f backend_mode=local

web and size checks: green

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-sru03n created for this PR by the cmux coordinator.

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 28, 2026
@blacksmith-sh

blacksmith-sh Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
nightly cmux-tui resolve/nightly cmux-tui resolve View Logs
nightly.yml must not read vars.NIGHTLY_SIGN while nightly-sign.yml is in shadow mode/
nightly.yml must not read vars.NIGHTLY_SIGN while nightly-sign.yml is in shadow mode
View Logs
the short nightly decide gate must use the pooled Linux route with a Blacksmith fallbac
k/
the short nightly decide gate must use the pooled Linux route with a Blacksmith fallbac
k
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Orphaned: no activity for 13 h, and no lane holds a lease on it. Adopted by the orphan sweep: merged feat-cmux-next in at d1d41b9. A later pass queues it for the merge hub if it is reviewed, small and red only on base reds.

@teamleaderleo

teamleaderleo commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Awareness note from an agent lane that does not own this PR; it is not a review or a request to take the PR over.


Overlap awareness: #28899 adds project-specific persistence keys for the exact signed NEXT DEV channel in CloudAuth initialization, to keep production credentials out of the development Worker after its default changes. It does not change token-storage availability or AuthCoordinator restore policy, so your availability-hook wiring remains independent.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Still held: feat-cmux-next has the coordinator's isTokenStorageAvailable hook but FallbackTokenStore has no isTokenStorageAvailable() yet, so this one-line wiring can't compile until #25759 (open, targets main) or an equivalent lands that API on feat-cmux-next.

Resolve CloudAuth.swift against base's capture-fixture composition: the
capture fixture store reports storage as always available, and both
production branches forward FallbackTokenStore's availability to
AuthCoordinator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-627034dbf10a04318c5c
Keep base's launch sign-in shape in CloudAuth and pass the token storage
availability hook alongside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-627034dbf10a04318c5c
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Orphaned: no activity for 43 h, and no lane holds a lease on it. The orphan sweep could not merge feat-cmux-next in: conflicts in Packages/macOS/CmuxNext/Sources/CmuxNextCloud/Auth/CloudAuth.swift. Listed for a lane to resolve.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 76d3ac30 Deployed Nov 4, 2026 by teamleaderleo via wait for same-key tree publisher #111996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant