Keychain-unavailable environments fail with a raw error and never surface the FJ_TOKEN fallback #93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observation
When
FJ_TOKENis unset and the OS keychain is unreachable (locked Login keychain over SSH, a headless Linux container with no Secret Service / D-Bus, a copiedhosts.tomlon a machine that never ranfj auth login), every authenticated command fails with a raw keychain error and no mention of theFJ_TOKENfallback.Token resolution tries the env var first, then the keychain (
src/client/resolve.rs:27-36):The helpful
ok_or_elsemessage only fires whenload_tokenreturnsOk(None). Butload_tokenreturnsOk(None)only forkeyring::Error::NoEntry(src/auth/mod.rs:38-45):Any other keychain failure: service unavailable, no Secret Service, locked keychain, access denied, propagates through
?at path (a) or (b). The user seesopening keychain entry for rasterhub.com: <platform error>orreading token for rasterhub.com from keychain: <platform error>and theFJ_TOKENhint atresolve.rs:32-36is never reached.The
FJ_TOKENdoc comment (src/auth/mod.rs:47-49) even states its purpose is to "avoid touching keychain services in headless containers", but nothing tells a stuck user that the lever exists.Why it matters
CI/CD and remote dev are exactly where paying teams put a forge CLI, and exactly where the keychain is absent. The current failure looks like "fj is broken in containers" rather than "set one env var". A new team evaluating
fjin their pipeline hits a dead end whose fix (FJ_TOKEN) is documented inCLAUDE.mdand used by this repo's own CI, but is invisible at the point of failure. That is a silent adoption cliff for the headless use case.Possible directions (sketches)
NoEntryinsideload_token, returningOk(None)so the existing actionableresolve.rsmessage ("...or set FJ_TOKEN for this process.") is what the user sees. Keep the raw error available under--debug.resolve.rsand append the same "set FJ_TOKEN" guidance to it, preserving the underlying cause for diagnosis.FJ_TOKEN") cross-linked from the keychain error text.Confidence
High that the code path drops the
FJ_TOKENhint on non-NoEntrykeychain errors (verified inresolve.rs+auth/mod.rs). Medium on real-world frequency per environment; a quick repro in a container with no Secret Service (orFJ_TOKENunset + login keychain locked) would confirm the exact surfaced string and raise this to high.fj issue create#97Converted (label
converted). This opportunity became one backlog item:backlog,p1): Surface theFJ_TOKENfallback when the OS keychain is unavailable.Kept open per the product-agent triage convention. Rationale: a silent dead-end in CI/headless containers (exactly where teams evaluate a forge CLI, and where the keychain is absent) is a real blocker-to-adoption, and the verified code path drops the actionable
FJ_TOKENhint on any non-NoEntrykeychain error. Sized S; the fix maps keychain-unavailable errors toOk(None)so the existingresolve.rsguidance fires, preserving the raw cause under--debug.All derived backlog items are merged: rasterstate/fj#96 closed by PR #102. Closing this opportunity per the issue state machine (operator-approved).