Skip to content

The C++ compiler tier fetches submodule pins with the entry's GitHub token - #341

Merged
zlareb1 merged 12 commits into
mainfrom
fix/compiler-tier-submodule-token
Nov 7, 2026
Merged

zlareb1 merged 12 commits into
mainfrom
fix/compiler-tier-submodule-token

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The C/C++ compiler tier fetches submodule pins with the repository entry's GitHub token, so a repository with a private submodule of its own owner no longer stalls its compiler tier at the first pin the checkout lacks.

Why

git submodule update in the compiler-tier checkout ran through compiler_tier.git, which built its environment with auth_env(remote=...) and no token. The mirror fetch (pass_fetch, bootstrap) authenticates with cfg.github_token, so the tree-sitter tier stayed current while every C++ delta and full pass for such an entry failed with:

git submodule failed: fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: Fetched in submodule path 'contrib/<private>', but it did not contain <sha>. Direct fetching of that commit failed.

The entry's compiler tier then fell one commit further behind per merge (413 commits on one deployment). The pass isolated the failure per entry, so other entries kept indexing and nothing flagged it beyond the pass's error count.

compiler_tier.git now takes token and remote for a networked call and hands them to auth_env, which carries the token as an extraheader, never in argv or stored config, as the mirror fetch does. The delta worker and scip_full.move_checkout pass the entry's github_token and git_remote on their submodule update.

Submodule URLs come from the indexed repository's .gitmodules, so whoever can commit to it picks them. auth_env used to key the header to the whole host (http.https://github.com/.extraheader). It now keys it to the remote's owner (http.https://github.com/<owner>/.extraheader; the host alone for a remote with no owner path). The token reaches that owner's repositories and nothing else on the host, for the mirror fetch and the submodule update alike. This narrows the header: no fetch Loom makes sends the token outside the remote's owner (the host, for a remote with no owner path). The networked compiler-tier git takes the file transport from the bare clone alone, so an entry whose remote is a local mirror does not open file:// submodule URLs.

Scope and risk

  • Touches the two networked submodule update calls of the C/C++ tier and the key of auth_env's extraheader. Local fetches from the bare clone and the Go, Python and TypeScript tiers' git calls get no token, as before.
  • Credential reach: the token goes only to URLs under the entry's own owner (https://host/owner/; the whole host for a remote with no owner path). A submodule of another owner, or on another host, gets none. The egress proxy and sandbox still apply.
  • Not covered: a relative .gitmodules URL resolves against the checkout, which has no remote, and the file transport is off, so it still fails; an owner spelled in another case than the remote's gets no token (git matches the prefix byte for byte). The operations page says both.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none. An entry that has been failing catches up on its next delta pass after deploy.
  • Rollback: reverting leaves nothing behind. The tier goes back to failing on private submodule pins.

Tests

  • Both submodule callers: test_scip_full_moves_its_checkout_as_sandboxed_jobs and test_code_scip_delta_worker.py::test_fetch_does_not_recurse_submodules assert that submodule update gets the entry's token and remote and that the bare-clone fetch gets none.
  • test_a_networked_compiler_tier_git_authenticates_to_the_repository_owner: the job environment has http.https://github.com/o/.extraheader, the token is not in argv, and a call without a token has no extraheader.
  • test_a_local_remote_entry_keeps_the_file_transport_off_its_submodules: no protocol.file.allow for a local-mirror entry, with or without a token.
  • test_gitrepo_token_env.py::test_git_matches_the_header_to_the_remote_owner_only: real git's config --get-urlmatch gives the header for a repository of the remote's owner and none for another owner, an owner with the same prefix (o-evil) or another host.
  • test_gitrepo_token_env.py::test_an_ssh_remote_gets_no_extraheader: a token with an ssh remote adds no header.
  • test_gitrepo_token_env.py::test_the_token_is_sent_only_under_the_remote_owner: owner scope for GitHub, a GitLab subgroup, a remote with no owner path and an owner-only remote, which falls back to the host.
  • Ran make format lint and the sandbox, scip-delta, scip-full, token-env, hostile-sandbox, public-copy and doc-links unit files: 304 passed, 13 skipped.
  • Real git, with auth_env(token, <private repo remote>): git ls-remote of a private sibling repository of the same owner exits 0, and exits 128 ("could not read Username") without the token. Under GIT_TRACE_CURL, the request to a repository of another owner carries no Authorization header, and the request to the same owner does. make typecheck locally fails only on extractor/loom_extractor/sql.py (no sqlglot in this virtualenv), a file this diff does not touch. CI runs it with the extractor's dependencies.
  • Reproduced on a live entry: with the missing pin fetched once using the same token, git submodule update --init --recursive with GIT_TERMINAL_PROMPT=0 exits 0.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. Checked: the token path matches pass_fetch's, local fetches stay credential-free, both submodule callers are covered, and real git sends the header to the remote's owner only.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format lint and the touched unit files pass locally; make typecheck fails locally only on extractor/loom_extractor/sql.py (a missing dependency), and CI runs typecheck, the whole unit suite and the integration suite.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

zlareb1 and others added 4 commits November 7, 2026 08:58
…token

`git submodule update` in the compiler-tier checkout ran with no credential, so a
repository whose .gitmodules names a private submodule on its own host failed
every C++ delta and full pass at the first pin the checkout did not already hold
("could not read Username for 'https://github.com'"), and the tier fell
further behind with each merge. `compiler_tier.git` now takes the entry's token
and remote for a networked call, carried as an extraheader exactly as the
mirror fetch does; local fetches from the bare clone still carry none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…sport stays off submodules

auth_env keyed the token's extraheader to the whole host, so a submodule URL
naming another owner's repository would carry it. It is now keyed to
https://host/owner/ (the host alone for a remote with no owner path). The
compiler tier's networked git takes the file transport from the bare clone
alone, so a local-mirror entry does not open file:// .gitmodules URLs. Tests
cover the delta worker's submodule token, the owner scope and the local
remote; the security section names the submodule update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…remote's owner, case as written

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…odule URL is said to fail

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
zlareb1 and others added 8 commits November 7, 2026 09:41
… remote is shown to get no header

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…owner the token reads

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ions list

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ne helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 5268f52 into main Nov 7, 2026
38 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 12, 2026
3 tasks done
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.

1 participant