Skip to content

feat: route workspace Git through fixed read and push proxies - #65

Merged
oldsj merged 2 commits into
mainloop-substrate-1-0from
port/git-proxies
Nov 10, 2026
Merged

oldsj merged 2 commits into
mainloop-substrate-1-0from
port/git-proxies

Conversation

@oldsj

@oldsj oldsj commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Third part of the per-Session Git workspace port: 0.4 cd91422 (#14) and 3afcc2d (#17), cherry-picked with -x and adapted. Stacked on the session-credentials PR.

What it adds

  • Harness.spec.git.readProxyOrigin / pushProxyOrigin: the trusted proxy profile. Only the two fixed Mainloop proxy origins are accepted; push requires read; the profile excludes credentialSecretRef and allows only github.com as the repository identity. CRD validation enforces this.
  • With the profile, the Actor's egress gets the proxy origins instead of GitHub, and the harness rewrites the canonical https://github.com/... remote to the read proxy for fetch and the push proxy for push. Credentials are per-Session references; nothing Git-related is compiled into the revision.
  • Both native compilers reject a proxy or no-Git revision that would reach GitHub host families directly, carry the legacy mainloop-git-auth Secret, or bind a revision credential on a proxy host.
  • The checkout fetches the remote default branch as well as the requested ref (Fetch the default branch into workspace checkouts #17).

Adapted to upstream

  • Credentials are matched by exact origin; the checks parse Credential.Origin instead of a hostname.
  • Substrate 1.0 egress policies accept leftmost-label wildcards. The GitHub check still rejects *.github.com-style destinations; the test that expected every wildcard to be rejected was updated.
  • CRDs are generated only into the Helm chart, and Agents no longer embed a Harness, so the schema test checks the Harness CRD there.

Limits to know

  • The compile-time check covers what a revision compiles to. An EgressPolicy grant added later is not checked by it, so a grant could still open GitHub directly for a proxy Harness. Not addressed here; worth deciding whether grants should be validated the same way.
  • Which Secrets a caller may bind for the proxy origins is not restricted yet. That is the Mainloop credential allowlist, the next PR, required before prod cutover.

Not ported in this PR

  • 0.4 23ee46c (second Mainloop instance's proxy origins, gitInstanceNamespaces): it edits the allowlist and the preparation code, neither of which exists on this branch yet. It follows them. Until then only the mainloop namespace proxies are accepted, so mainloop-dev cannot use Git transport.
  • 0.4 0e9ef8a (Git executable rewriting in runtime payload images): belongs to runtime composition.
  • Tests left out, to be restored with the code they need: the two TestCompileTrustedGitCompleteUnion cases (they use the dropped extraHTTPSOrigins and the 0.4 runtime-generation policy builder), the gRPC test that exercises the allowlist, the Suspend/Resume warm-up readiness test (that API is gone), and the proxy e2e test.

Tests

Pass locally: ./api/... (CRD CEL cases), ./core/internal/translator/... (proxy policy, schema, effective egress), ./core/internal/egress, ./core/internal/substrate, ./harness/runtime/... (proxy rewriting, default-branch fetch), ./harness/claude/..., ./harness/codex/..., ./core/internal/grpcserver, ./core/internal/service/session. Not run: a real clone or push through the proxies on a cluster.

🤖 Generated with Claude Code

🤖 Generated with Claude Code

@github-actions github-actions Bot added the enhancement New feature or request label Nov 10, 2026
@oldsj
oldsj force-pushed the port/session-credentials branch from 2a8c329 to 54f0a3a Compare November 10, 2026 18:01
@oldsj
oldsj force-pushed the port/session-credentials branch from 54f0a3a to beeedd3 Compare November 10, 2026 18:14
@oldsj
oldsj changed the base branch from port/session-credentials to mainloop-substrate-1-0 November 10, 2026 18:27
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 10, 2026
Route native workspace Git through distinct fixed read and push proxies, preserve canonical repository identity, and enforce complete compiled credential/network policy and exact Git-purpose control tuples. Qualify bootstrap and non-turn readiness with retained local fixtures; installation and live isolation remain separate gates.

Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit cd91422)
Workspaces now get refs/remotes/origin/<default> and origin/HEAD after
checkout, so tools that diff against origin/main work. An unspecified
depth now means full history, giving feature branches a merge-base with
the default branch; an explicit positive depth stays shallow. Failures
to fetch the default branch are logged and do not fail the bootstrap.

Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit 3afcc2d)
@oldsj
oldsj merged commit e17a8bb into mainloop-substrate-1-0 Nov 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant