Repository navigation
Description
Summary
On a server with no local host daemon (bb-server in Kubernetes, all work on enrolled machines), the server's gh login is never forwarded to any machine. Every turn, clone and terminal on the machine has no GH_TOKEN, credential helper or SSH rewrites, while Settings → Environment variables reports the built-in row as "logged in".
Versions and environment
- bb 0.45.0 built from source at
desktop-v0.45.0(129f621), Debian container, Node 22. Server runsbb-serveralone; no host daemon in the pod, so nohost-idin the data dir. - One manually enrolled Linux machine (
host_hv48sk75e6).machineGitCredentialsEnabledistrue.gh auth statuson the server: logged in. - claude-code provider, but the bug is provider-independent (environment setup fetches fail the same way).
Steps to reproduce
- Run
bb-server --data-dir /dataon a host with no host daemon;gh auth loginon that host (we setGH_CONFIG_DIR). - Enroll a machine with the manual enrollment command.
bb machine env list --json→builtInGit.statusislogged in.- Start a thread on the machine in a project with no
GH_TOKENoverride and rungh auth status.
Did not reproduce with: a project that has a GH_TOKEN override (then the helper and rewrites arrive too); a server that has a local host daemon.
Expected vs actual
Actual, in the thread on the machine:
$ gh auth status
You are not logged into any GitHub hosts. To log in, run: gh auth login
Environment setup on the same machine:
Could not fetch https://github.com/bitcomplete/tsjwt-deploy: fatal: could not read Username for 'https://github.com': terminal prompts disabled
Expected: GH_TOKEN, the credential helper and SSH→HTTPS rewrites present, as on any
non-primary machine of a server that has a primary host.
Evidence
Observed: thread thr_3xzhxgqpvu (env setup fetch failures above), thread thr_j22n2dh4u6 (gh auth status above). A thread in a project with a GH_TOKEN override on the same machine one minute later had the full bundle.
Cause (read, not guessed): resolveHostEnvironment forwards only when primaryHostId !== null && primaryHostId !== context.hostId. With no host-id file the first clause is false for every machine, so builtIn is []. The override path works because githubGitConfiguration() is added whenever a user GH_TOKEN row exists.
bb/apps/server/src/services/hosts/host-environment.ts
Lines 19 to 27 in 129f621
| const primaryHostId = readPrimaryHostIdFromDataDir({ | |
| dataDir: deps.config.dataDir, | |
| }); | |
| const builtIn = | |
| primaryHostId !== null && | |
| primaryHostId !== context.hostId && | |
| getAppSettings(deps.db).machineGitCredentialsEnabled | |
| ? await resolveGitCredentials() | |
| : []; |
The status row does not apply that check, so it says "logged in" while nothing is forwarded:
bb/apps/server/src/services/machines/environment-settings.ts
Lines 53 to 64 in 129f621
| builtInGit: { | |
| status: overridden | |
| ? ("overridden" as const) | |
| : !enabled | |
| ? ("disabled" as const) | |
| : health.status === "ready" | |
| ? ("logged in" as const) | |
| : ("not logged in" as const), | |
| statusMessage: | |
| !enabled && !overridden | |
| ? "Automatic GitHub credentials are disabled." | |
| : health.statusMessage, |
Both files are identical on main at 861742e.
What you ruled out
- Not Plugin SDK: per-machine environment control for machine providers (sandbox credential isolation) #4405: that asks to opt machines out of forwarding and assumes it works.
- Not Docs opener resolves
hostsources against the primary host, not the thread's machine: 502 on server-only deployments, wrong-machine reads and writes elsewhere #4480 / Tasks: project-default preset always dispatches to the primary host, fails for projects on other machines #4446: same "a primary host always exists" assumption, different code paths and symptoms. - Not the sign-in:
gh auth tokensucceeds on the server and the status row reads it. - Not timing or a cached runtime: a brand-new thread and environment reproduce it.
- Workaround confirmed: writing any non-empty placeholder to
<dataDir>/host-idthat matches no host record makes forwarding work and changes nothing else we could find.
Suggested priority and effort
Medium — affects every server-only deployment; workaround is a global GH_TOKEN override or the host-id placeholder. Effort low: treat "no primary host" as "forward to every machine" and make the status row honest.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
Investigation: bitcomplete bb thread thr_umpmbmwzqj (private); fix for our deployment in bitcomplete/bb-gate@0115e7a.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 7, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilothost.confirmed-repro.ghfails the missing-GH_TOKENregression in two clean trusted checkouts at0146d81; all four controls pass in both runs, and 10 relevant existing tests pass. The report includes the complete test; no live Kubernetes/private-clone claim is made.Forward server gh credentials when the server has no local host daemon (