Skip to content

engine: fetch private repos for worktrees with the session GitHub token (WI-1666) - #1037

Merged
thedancingdeveloper merged 4 commits into
mainfrom
wi-1666-worktree-github-token
Oct 16, 2026
Merged

thedancingdeveloper merged 4 commits into
mainfrom
wi-1666-worktree-github-token

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Contributor

The engine's worktree fetch now authenticates with the brokered GitHub token, so private repos work. The token never appears in argv, logs or .git/config. Three review rounds; the last found no blockers (handoff on WI-1666).

🤖 Generated with Claude Code

sprooty added 3 commits October 15, 2026 23:02
session_start worktree=true fetched origin as the engine user, whose
credential cannot see private GitHub organisation repositories, and the
failure came back as "Repository not found". The fetch now uses
ENGINE_WORKTREE_GITHUB_TOKEN (or GH_TOKEN on the engine process) through
GIT_ASKPASS only, and a GitHub origin with no token refuses by name.
Review of 8c2bdc6: the token was attached to every origin, github.com was
matched as a substring, the askpass test wrapped git instead of running the
shipped script, and tests leaked token env vars. The fetch now uses the
token only for an https origin whose host is exactly github.com, askpass
parses that host the same way, and the tests restore the environment.
The re-review of 4ef5e11 still had no test that git_command sets
GIT_ASKPASS, blanks credential.helper, and strips GH_TOKEN, GITHUB_TOKEN
and GIT_AUTH_TOKEN. A PATH git wrapper now records that environment for an
https GitHub origin and checks the shipped askpass prints the worktree
token. A second test shows a non-GitHub origin keeps its own credentials.
@thedancingdeveloper
thedancingdeveloper enabled auto-merge (rebase) October 16, 2026 00:09
Comment thread engine/server/src/git.rs Fixed
…odeQL, WI-1666)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thedancingdeveloper
thedancingdeveloper merged commit aa25438 into main Oct 16, 2026
15 checks passed
@thedancingdeveloper
thedancingdeveloper deleted the wi-1666-worktree-github-token branch October 16, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants