Skip to content

guest context: name reachable hosts + a clean host-handoff protocol#11

Merged
jx-wi merged 1 commit into
mainfrom
egress-aware-guest-context
Jul 18, 2026
Merged

guest context: name reachable hosts + a clean host-handoff protocol#11
jx-wi merged 1 commit into
mainfrom
egress-aware-guest-context

Conversation

@jx-wi

@jx-wi jx-wi commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

The guest ~/.claude/CLAUDE.md gave the in-VM agent too little to act on two recurring failure modes:

  1. With an egressAllowlist set, egress is default-deny and a request to any unlisted host silently HANGS then times out. The old context only said "network access may be restricted", so the agent kept retrying doomed fetches. The wrapper now emits a per-run line in the # ccvm session header naming the EXACT reachable hosts (the resolved EGRESSALLOW plus the always-added api.anthropic.com), and says anything else will hang — don't retry. Open egress emits a short "you can reach any host" line instead. Built from the live EGRESSALLOW var, so no new @token@.

  2. Host-only work (unreachable fetches, git fetch/push needing host creds, host-side CI) was handed back ad hoc. ccvm-context.md now documents a "Handing work to the host" protocol: exact commands in a fenced block, one per line, with NO inline # comments (they break when pasted into zsh), each command described in prose outside the block.

Tests: host.sh asserts the open-egress line; egress.sh (baked 10.0.0.0/8) asserts the locked line names the host + api.anthropic.com. Both green under nix flake check. egress.md documents the agent-awareness behaviour.

What & why

Checklist

CI runs nix flake check (host-side guarantees, guest build, shellcheck) automatically. The
full-boot smoke test (tests/boot.sh) needs a real VM and is not in CI — so if your change
touches the guest, wrapper, or boot path, you must run it locally on a Nix+KVM box and paste
the result here. (See CLAUDE.md → "Definition of done".)

  • nix flake check is green (CI on this PR, or run locally)
  • Ran bash tests/boot.sh on a Nix+KVM box — pasted the N passed, M failed line below; or N/A (docs / CI-only change, no guest/wrapper/boot impact)
  • Touches the TTY (zsh/ZLE/terminfo/ssh -tt)? Did a human ccvm --shell pass — resize, vim, less, vi-mode — since terminal fidelity isn't automated
  • Security invariants still hold (no secret to disk/argv/seed; host key pinned; only the CWD shared) — see CLAUDE.md "Security invariants"
  • Commit trailer is the exact ccvm form: Co-authored-by: Claude <noreply@anthropic.com>

The guest ~/.claude/CLAUDE.md gave the in-VM agent too little to act on two
recurring failure modes:

1. With an egressAllowlist set, egress is default-deny and a request to any
   unlisted host silently HANGS then times out. The old context only said
   "network access may be restricted", so the agent kept retrying doomed
   fetches. The wrapper now emits a per-run line in the `# ccvm session`
   header naming the EXACT reachable hosts (the resolved EGRESSALLOW plus the
   always-added api.anthropic.com), and says anything else will hang — don't
   retry. Open egress emits a short "you can reach any host" line instead.
   Built from the live EGRESSALLOW var, so no new @token@.

2. Host-only work (unreachable fetches, git fetch/push needing host creds,
   host-side CI) was handed back ad hoc. ccvm-context.md now documents a
   "Handing work to the host" protocol: exact commands in a fenced block, one
   per line, with NO inline `#` comments (they break when pasted into zsh),
   each command described in prose outside the block.

Tests: host.sh asserts the open-egress line; egress.sh (baked 10.0.0.0/8)
asserts the locked line names the host + api.anthropic.com. Both green under
nix flake check. egress.md documents the agent-awareness behaviour.

Co-authored-by: Claude <noreply@anthropic.com>
@jx-wi

jx-wi commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

boot.sh: 47 passed, 0 failed

@jx-wi
jx-wi merged commit a17d474 into main Jul 18, 2026
1 check passed
@jx-wi
jx-wi deleted the egress-aware-guest-context branch July 18, 2026 20:24
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