Skip to content

S08-01 - Into the Guest

Purpose: How the project’s code reaches the guest: the clone, its transport, its remotes, and the uncommitted changes carried in at session start.

On first use, the project user’s home receives a clone of the host repository, transferred over vsock. Later sessions fetch only new objects.

The guest uses a git remote helper, git-remote-wb, for a remote named host. The helper ships with wb-guestd.

Nothing in the guest can write to the host repository through this path.

Git doesn’t tell a connect helper which protocol version it wants. The helper asks for v2 itself. wb-hostd passes only version=0, 1 or 2 on to git.

The guest’s clone gets the host repository’s remotes next to host. The agent can then push to the forge through the egress gateway (SEC06-repo-writesSEC06-repo-writes: Repository-scoped writesGit pushes and repository-mutating API calls are allowed only for the repositories of the projects that have a session in the VM.). wb reads each remote’s URLs as the user’s git resolves them, with git remote get-url --all, which applies url.<base>.insteadOf. It cleans each URL before it sends it on:

  • Git’s own rule tells an SSH short form from a path. host:path is SSH only when no slash comes before the first colon. On Windows a drive letter (C:/x) is a local path. An IPv6 host is in brackets ([::1]).
  • User name, password, query string and fragment are removed.
  • An SSH remote becomes https://host/path: both ssh://[user@]host[:port]/path and the short form [user@]host:path. The port is dropped.
  • An https:// URL keeps its host, port, and path.
  • Any other URL isn’t given to the guest: http://, git://, file://, git+ssh://, ssh+git://, a local path, a <helper>:: URL, a URL whose host is an IP address, and a URL the cleaner can’t parse. The session summary lists each such remote with the reason. Each withheld URL goes to wb-hostd’s audit writer with its reason (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.).

The guest pushes to the cleaned URL. Nothing else from the repository’s configuration reaches the guest: no pushurl, pushInsteadOf, insteadOf, proxy, http.<url>.extraHeader or credential.*.

Some remotes don’t work after the cleaning. An SSH host alias from the user’s SSH configuration gives an HTTPS URL that doesn’t reach the forge. So does a path that only works on a non-default SSH port. The push then fails at the egress gateway, which refuses the unknown host (fail closed).

A .gitmodules URL is tracked content and isn’t rewritten. Submodules are out of scope (S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem., “Out of scope”). Project identity records the URLs after this cleaning, but they aren’t part of the project key (S05-04-namingS05-04-naming: NamingHow wb identifies a project, a session and its branch, and how projects are registered, checked, moved and removed.).

wb-guestd creates a worktree for the session at <home>/sessions/<session-id> (S06-08-projects-and-sessionsS06-08-projects-and-sessions: Projects and Sessions Inside a VMHow projects map onto guest users and sessions onto worktrees, and how Claude Code runs in the guest.). The worktree is checked out at the session’s HEAD in export.git. Then wb-guestd applies the carry-in (FR04-carry-inFR04-carry-in: Uncommitted changes carried inUncommitted host changes (staged, unstaged, untracked-not-ignored) are carried into the session at start.):

  • staged and unstaged changes, as a binary diff;
  • untracked files that are not ignored, up to a size cap.

Files over the cap are listed in the session summary rather than silently dropped.

The carry-in can hold a secret. A new credentials.json that the user hasn’t ignored yet is an untracked file that isn’t ignored, so the carry-in would send it. wb collects the carry-in in the user’s repository. It checks each changed or untracked path before it sends any of it on (SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.):

A skipped file is skipped whole. The guest doesn’t get an untracked file, and a tracked file keeps its HEAD version in the guest.

No carry-in reaches the guest when no scanner is configured or chosen, or when the scanner fails or times out. The session then starts at its HEAD without the carry-in, and says why.

Committed content isn’t scanned. Committing a file on a selected branch is the user’s choice to send it.

No secret scanner is chosen yet (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage., “Sealing”), so carry-in is off until one is. The carry-in scan assumes the scanner is precise enough on working trees that it skips few files by mistake. That isn’t measured.

The guest gets the host’s remotes, cleaned to HTTPS.

wb scans every changed and untracked file before the carry-in leaves the host.

Status: Draft