Fjord Account hosts: fj-driven git fails fast with an explanation instead of prompting (#222) #327

Merged
stephen merged 3 commits from fj-222-fjord-git-refuse into main 2026-11-12 12:11:11 +00:00
Owner

Interim step for #222 (not a fix: the gateway git route is platform work, tracked on the platform side).

On a Fjord Account host fj hands git the forge's own clone URL and no credential, so a clone, fetch or push could sit on a username prompt. Now:

  • Any command that connects a Fjord Account host marks the process (git::note_fjord_host, set where the client is built). Every git fj spawns after that runs with GIT_TERMINAL_PROMPT=0, GIT_ASKPASS empty (git then skips GIT_ASKPASS, core.askPass and SSH_ASKPASS for its HTTP prompts) and GCM_INTERACTIVE=never. Credential helpers still run, so a credential the user configured for the instance keeps working.
  • A failed clone, fetch or push on such a host appends one explanation: fj has no git credential for it yet (fj#222), and to use an SSH remote or give git its own credential. For commands where fj captures git's stderr, the hint is added only when git said a credential was needed, so a rejected push or a dead network is not blamed on it.
  • Other hosts are unchanged.

Deliberately not refused outright: someone with an SSH remote or their own credential helper on a Fjord host works today, and a blanket refusal would break them. The instruction was "refuse with a clear message and never hang"; this keeps the second part absolute and gives the message where git actually fails. SSH remotes keep ssh's own passphrase prompt (the user authenticating; forcing BatchMode would break passphrase-protected keys), noted in the code and changelog.

Tests: unit tests for the prompt policy and the hint conditions; tests/fjord_host_git.rs runs the real command against a mock gateway and a forge that demands credentials, with askpass wired through GIT_ASKPASS, SSH_ASKPASS and core.askPass to a program that hangs, under an enforced 30 second timeout. The Fjord case fails fast, starts no askpass, shows git's "terminal prompts disabled" and the hint, and never echoes the bearer; the old policy fails that test by hanging. A PAT host keeps git's own prompting and gets no hint.

Self-review: round 1 askpass (fixed), round 2 SSH passphrase prompts (answered above), round 3 BLOCKING 0.

Interim step for #222 (not a fix: the gateway git route is platform work, tracked on the platform side). On a Fjord Account host fj hands git the forge's own clone URL and no credential, so a clone, fetch or push could sit on a username prompt. Now: - Any command that connects a Fjord Account host marks the process (`git::note_fjord_host`, set where the client is built). Every `git` fj spawns after that runs with `GIT_TERMINAL_PROMPT=0`, `GIT_ASKPASS` empty (git then skips `GIT_ASKPASS`, `core.askPass` and `SSH_ASKPASS` for its HTTP prompts) and `GCM_INTERACTIVE=never`. Credential helpers still run, so a credential the user configured for the instance keeps working. - A failed clone, fetch or push on such a host appends one explanation: fj has no git credential for it yet (fj#222), and to use an SSH remote or give git its own credential. For commands where fj captures git's stderr, the hint is added only when git said a credential was needed, so a rejected push or a dead network is not blamed on it. - Other hosts are unchanged. Deliberately not refused outright: someone with an SSH remote or their own credential helper on a Fjord host works today, and a blanket refusal would break them. The instruction was "refuse with a clear message and never hang"; this keeps the second part absolute and gives the message where git actually fails. SSH remotes keep ssh's own passphrase prompt (the user authenticating; forcing BatchMode would break passphrase-protected keys), noted in the code and changelog. Tests: unit tests for the prompt policy and the hint conditions; `tests/fjord_host_git.rs` runs the real command against a mock gateway and a forge that demands credentials, with askpass wired through `GIT_ASKPASS`, `SSH_ASKPASS` and `core.askPass` to a program that hangs, under an enforced 30 second timeout. The Fjord case fails fast, starts no askpass, shows git's "terminal prompts disabled" and the hint, and never echoes the bearer; the old policy fails that test by hanging. A PAT host keeps git's own prompting and gets no hint. Self-review: round 1 askpass (fixed), round 2 SSH passphrase prompts (answered above), round 3 BLOCKING 0.
gerri approved these changes 2026-11-12 11:53:50 +00:00
gerri left a comment

Automated Codex review (read-only) of head aaf46cd848.

No actionable findings against the diff and fleet standards. Formatting checks pass. Build and integration tests were not run.

BLOCKING: 0

Reviewed head aaf46cd848 at 2026-11-12T11:53:49Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head aaf46cd8480701489e2e5143593c343de7d52043. No actionable findings against the diff and fleet standards. Formatting checks pass. Build and integration tests were not run. BLOCKING: 0 --- Reviewed head aaf46cd8480701489e2e5143593c343de7d52043 at 2026-11-12T11:53:49Z by codex exec (read-only sandbox).
Sign in to join this conversation.
No description provided.