Skip to content

fix: never prompt for git credentials and keep e2e env hermetic - #1381

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1378-hermetic-e2e
Sep 28, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1378-hermetic-e2e

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Resolves #1378

Summary

Both e2e failures come from the runner's environment, not from the gateway binary download (mock mode forces Gateway.Run off, so the supervisor never downloads anything).

  • Headless Write not blocked. The tokenless Orchestrator runs the binary under test with os.Environ() plus a temp HOME. infer-action exports INFER_TOOLS_WRITE_REQUIRE_APPROVAL=false for the agent, so the binary under test inherited it and Write ran without an approver.
  • TUI never sees the mock reply. The org workflow sets memory-repo: https://github.com/inference-gateway/.memory (private), which enables the git memory backend. Its session-start git ls-remote runs with the swapped HOME, so the runner's credential helper is gone and git prompts Username for 'https://github.com': on the pane's TTY, blocking the session for up to the 60s git timeout. The same hang hits any user whose memory-repo credentials are missing, so this half is a product bug.

Changes

  • utils.RunGit runs git with GIT_TERMINAL_PROMPT=0. None of its callers is interactive, so a missing credential now fails fast (the memory sync logs and continues) instead of writing a prompt into the TUI. Credential helpers, GIT_ASKPASS and ssh-agent still work.
  • The e2e TestMain unsets every inherited INFER_* variable after building the binary, so no child (Orchestrator runs, direct exec, a tmux server the suite starts) sees a parent infer run's config. Each test already sets the variables it needs.
  • Memory backend doc comments updated to match.

no docs ticket: bug fix, no user-facing surface change

Verification

  • Reproduced both failures on main locally by exporting the runner's variables (GIT_CONFIG_NOSYSTEM=1 stands in for the missing credential helper, because Homebrew's system gitconfig otherwise supplies osxkeychain). TestChatTUIViaTmux shows the same Starting response... (25.0s)rname for 'https://github.com': frame as the issue.
  • GIT_TERMINAL_PROMPT=0 alone (e2e env scrub stashed) turns that run into a pass in 2.2s.
  • New TestRunGitDisablesTerminalPrompt fails without the fix and passes with it.
  • Full e2e suite green (108s) with the runner's variables exported: approval overrides, git memory backend, A2A, computer use, telemetry.
  • task precommit:run: green (golangci-lint 0 issues).

Not covered

  • If a tmux server is already running when the suite starts, panes get that server's environment rather than the scrubbed one. The git fix still prevents the hang, and the rest is left until it shows up.
  • Cross-repo: inference-gateway/tokenless could strip app-prefixed variables in Orchestrator itself. Optional follow-up, nothing filed.

Git commands now run with GIT_TERMINAL_PROMPT=0, so a missing credential
fails fast instead of taking over the TTY. The git memory backend's
session-start ls-remote used to print a credential prompt into the chat
TUI and block it for up to the 60s timeout.

The e2e TestMain drops inherited INFER_* variables. A parent infer run
(infer-action exports INFER_TOOLS_WRITE_REQUIRE_APPROVAL=false and a git
memory backend) leaked its config into the binary under test through the
harness's os.Environ().

Closes #1378
@edenreich
edenreich requested a review from a team as a code owner September 28, 2026 14:09
@edenreich
edenreich merged commit a20bb95 into main Sep 28, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1378-hermetic-e2e branch September 28, 2026 16:47
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.216.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] tests/e2e fails on main: headless Write is not blocked without an approver, TUI tests never see the mock reply

1 participant