Skip to content

Server gh login is never forwarded to machines when the server has no primary host #5133

Closed

Description

@trotterdylan

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 runs bb-server alone; no host daemon in the pod, so no host-id in the data dir.
  • One manually enrolled Linux machine (host_hv48sk75e6). machineGitCredentialsEnabled is true. gh auth status on the server: logged in.
  • claude-code provider, but the bug is provider-independent (environment setup fetches fail the same way).

Steps to reproduce

  1. Run bb-server --data-dir /data on a host with no host daemon; gh auth login on that host (we set GH_CONFIG_DIR).
  2. Enroll a machine with the manual enrollment command.
  3. bb machine env list --json → builtInGit.status is logged in.
  4. Start a thread on the machine in a project with no GH_TOKEN override and run gh 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.

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:

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

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 GENERATED and links the thread or report.

Investigation: bitcomplete bb thread thr_umpmbmwzqj (private); fix for our deployment in bitcomplete/bb-gate@0115e7a.

AGENT GENERATED

Activity

  1. added theissue type on Oct 7, 2026
  2. added
    host
    confirmed-repro
    on Oct 7, 2026
  3. bb-slop-cop commented on Oct 7, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority Medium · Effort Low · Area host.
    • Report: Reproduction and root-cause report — REPRODUCED, confidence high; reproduction label confirmed-repro.
    • Root cause: automatic GitHub credential forwarding requires a non-null primary-host ID. Without a local daemon, enrolled machines receive no built-in credential bundle even though server credential health reports “logged in.”
    • Evidence: the real resolver with a migrated database and synthetic gh fails the missing-GH_TOKEN regression in two clean trusted checkouts at 0146d81; 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.
    • No PR: expanding which machines receive server authentication credentials falls outside this rule’s simple-fix authentication/security boundary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reprohost

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions