Skip to content

feat(sessionservice): load repo secrets before cloning#254

Draft
tildesrc wants to merge 3 commits into
mainfrom
panopticon/load-secrets-before-clone
Draft

feat(sessionservice): load repo secrets before cloning#254
tildesrc wants to merge 3 commits into
mainfrom
panopticon/load-secrets-before-clone

Conversation

@tildesrc

@tildesrc tildesrc commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extends CloneCache.ensure() and the git CommandRunner protocol to accept an optional env mapping, forwarded to git clone/git fetch subprocess calls so credentials (e.g. GH_TOKEN) are available for host-side private-repo access
  • Adds prepare_workspace() logic to resolve the repo's env_file name via secrets_file_path() and parse it before any git network operation — before the container starts
  • Makes parse_env injectable throughout the call chain (prepare_workspace, Spawner, __main__.main) for testability
  • Adds env-passthrough tests in tests/sessionservice/test_spawn.py; updates fakes in spawner/host/git/local-runner tests to accept the new env kwarg

🤖 Generated with Claude Code

Panopticon Agent and others added 3 commits July 8, 2026 23:59
The host-side git operations (git clone / git fetch in CloneCache.ensure)
run before the container starts, so credentials in env_file were never
available to them. Private repos would fail at spawn-prep because GH_TOKEN
wasn't in the subprocess environment.

Fix: parse env_file into a dict in prepare_workspace (using an injectable
_parse_env_file helper) and forward it to cache.ensure(), which passes it
only to the network git operations (clone + fetch). merge --ff-only is
local and gets no env. The CommandRunner protocol and both subprocess
implementations (core.git and local_runner) gain an optional env kwarg
that merges into os.environ for that call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ution

The session service now loads repo secrets before git network operations
(clone/fetch) so private repos can be accessed on the host before the
container starts. This merge integrates that with main's changes:
- env_file is now a relative name resolved via secrets_file_path()
- test files moved to tests/sessionservice/; updated for new locations
- local_runner cli test creates the secrets file for _parse_env_file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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