Skip to content

Prove the coordination bridge inside a real container - #62

Merged
ilovecrayons merged 2 commits into
mainfrom
varram/sup-59-prove-the-coordination-bridge-in-a-container
Sep 4, 2026
Merged

Prove the coordination bridge inside a real container#62
ilovecrayons merged 2 commits into
mainfrom
varram/sup-59-prove-the-coordination-bridge-in-a-container

Conversation

@not-varram

Copy link
Copy Markdown
Contributor

Summary

Closes SUP-59. The coordination E2E was pinned to the in-process runtime because under go test the binary at /proc/self/exe is the test binary and has no mcp subcommand, so the two bind mounts, the staged 0555 binary and a non-root agent reaching the 0666 socket were never exercised in real Docker. That failure would be silent: a wrong mount degrades every Claude Code run to notice-only, which is a legal state.

  • selfExe is now scheduler.Config.ServerBinary (default /proc/self/exe, unreachable from any flag or config key), passed from server.Config.ServerBinary.
  • TestIntegrationCoordinationInContainer builds a real aether-server with CGO_ENABLED=0 and a fixture agent, builds a busybox image where the fixture is the claude executable running as a non-root user, launches two overlapping runs on the shipped claude profile, and asserts from both sides: the daemon's view (both binds realized, read-only, the staged binary named by the built binary's sha256, non-root user) and the agent's report over a real SSH attach (the --mcp-config argument, uid, the 0755 directory, 0444 config, 0666 socket, both mount targets present in /proc/self/mountinfo as ro, and a status/send/inbox round trip through /opt/aether/aether-server mcp).
  • docs/mcp-bridge.md drops its gap note; docs/testing.md describes the scenario.

Validation

  • The Docker test runs and passes here (8 to 10 s per run, stable across -count=3); the full make test-integration passes (41 packages).
  • make fmt-check vet lint test test-scripts public-audit pass.
  • Fresh-context adversarial review: MERGE, with a fixture-image leak in cleanup ordering, a write probe that could not distinguish a read-only bind from mode bits, and a timing sleep on the diff watch; all fixed before opening.

🤖 Generated with Claude Code

https://claude.ai/code/session_019irxg6aWWKmn2w3QsJR5CJ

The coordination E2E only ran on the in-process runtime, because under
`go test` /proc/self/exe is the test binary and has no mcp subcommand, so
nothing could stage a bridge a container could execute. That left the
container half unproven: the two mounts were asserted as fields on a
runtime.Spec rather than as realized binds, the staged 0555 binary was
never executed as /opt/aether/aether-server mcp, and no non-root user
ever traversed the 0755 directory, read the 0444 config, or connected to
the 0666 socket. The failure would have been silent - a run that cannot
reach the bridge degrades to notice-only, which is a legal state.

- scheduler.Config.ServerBinary names the binary the stager copies,
  replacing the unexported package var, and server.Config passes it
  through so a test can point it at a binary it built.
- TestIntegrationCoordinationInContainer builds an aether-server and a
  fixture agent, installs the agent as the claude executable of a
  non-root image, and asserts both the daemon's view of the two realized
  read-only binds and the agent's own status/send/inbox round trip
  through the staged binary.
- docs/mcp-bridge.md loses the gap note; docs/testing.md describes what
  the new scenario proves and the two seams it needs.
Review follow-ups on the scenario added in the previous commit.

The image cleanup ran before the runtime's container sweep, because
cleanups run last-in-first-out and the image was built after the runtime.
Removing an image a live container still holds only untags it, so every
run left its layers behind. The daemon probe is now its own helper that
registers nothing, so the skip decision can be made before the image is
built and the image's cleanup outlives the sweep.

The /opt/aether write probe proved nothing about the bind: the image has
no /opt, Docker creates the directory root-owned 0755, and the refusal
was a mode-bit EACCES. Nor can a write to the staged binary itself
separate the two, since it is 0555 and the agent is not root. The fixture
now reads the kernel's own mount record for both targets and requires
each to be a mount point carrying "ro", which is the fact a mode bit
cannot imitate, and keeps a write probe only where the answer is
unambiguous: the coordination directory, where it must be EROFS.

The single edit before the diff watch existed was a race - the watch is
fsnotify-driven and registered after the attach, so a missed event cost
the scenario its whole two-minute poll. The agent now rewrites the file
while it waits for a peer, on an interval that leaves the watch its quiet
period: rewriting on every poll is sustained churn, and held off the
snapshot until the watch's own ceiling, taking the scenario from 8s to
55s.

Also: a 3-minute test context rather than 10, which equalled the default
go test timeout, and slices.Sort in the fixture.
@ilovecrayons
ilovecrayons merged commit 04c69fa into main Sep 4, 2026
6 checks passed
@not-varram
not-varram deleted the varram/sup-59-prove-the-coordination-bridge-in-a-container branch September 4, 2026 04:18
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.

2 participants