| index 15282226..a4f4d1b2 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md |
| @@ -4213,3 +4213,141 @@ No UI text, README prose or `copy.go` entries were added. The new internal diagn |
| No known failing implementation gate remains. Real provider compatibility, refresh hostnames and complete deployed-policy certification remain Task 11b release work; this run claims local fixture and namespace evidence only. The actual auth-host fields remain empty by default. The strict CONNECT parser permits only Host, User-Agent, Proxy-Connection and Connection headers; Task 11b should verify the pinned provider transports against that grammar without relaxing framing or destination checks. Full CI and controller review remain outside this task's requested gate list. |
| |
| All fixture listeners and processes finished or were stopped. Scratch created for test evidence and the runner build is removed after copying it into both reports. No server, watcher, provider session, credential home or background command is left running. No other worktree was touched. The controller owns review and push. |
| + |
| + |
| +## Task 3 fix round 1: Bind the socket through its verified directory |
| + |
| +Status: DONE. Base: `e06320a` on `plan-2b`. |
| +Commit subject: `fix: bind the egress socket through its verified directory`. |
| + |
| +### What changed |
| + |
| +`egress.Open` now binds `/proc/self/fd/<fd>/proxy.sock` using the directory descriptor already checked by `openat2` and `fstat`. Socket address length no longer depends on ScratchRoot. The real Linux launch test confirms that this machine resolves the descriptor path during bind. |
| + |
| +The proxy uses the same descriptor path for chmod and retains the directory until the listener closes and unlinks the socket. Failed construction closes the descriptor too. This also fixes cleanup after a directory rename: the proxy removes its original socket and leaves a replacement directory untouched. |
| + |
| +`SocketPath()` still returns the real filesystem path. Containment continues to open that path with its existing symlink-rejecting `pin()` function and passes the retained socket descriptor to bubblewrap with `--ro-bind-fd`. No containment production code or mount rules changed. |
| + |
| +Files changed: |
| + |
| +- `internal/runner/egress/proxy.go`: descriptor-relative bind, chmod and cleanup lifetime. |
| +- `internal/runner/egress/proxy_test.go`: `TestEgressSocketDirectoryPinned` renames the socket directory, installs a replacement file, and verifies cleanup affects only the original directory. |
| +- `internal/runner/containment/egress_test.go`: `TestEgressLongScratchRoot` creates a deep subdirectory under the existing on-disk TMPDIR, asserts a root of at least 70 bytes, starts a full namespace launch, exchanges a CONNECT request and policy-denial response through the relay, checks the real socket path and mode, and verifies cleanup after exit. |
| +- `docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md`: this appended section. |
| +- `.superpowers/sdd/2026-11-03-equipo-plan-2b-direct/task-3-report.md`: the same appended evidence, retained locally under the repository's existing ignore rule. |
| + |
| +### Interpretations |
| + |
| +This fix supersedes original-report interpretation 1, which required callers to keep Unix socket paths short. Descriptor-relative bind works on this machine, so no constructor length rejection or new error string is needed. |
| + |
| +The full launch uses an owned Python fixture inside the production namespace helper. Its request to `localhost:443` receives the exact `403 Forbidden` response from the host proxy through the namespace relay. It does not resolve, connect to or prompt a provider. The existing TLS fixture and destination-policy tests also pass in the covering command. |
| + |
| +The task's explicit rules override generic writing and handoff workflows: no copy-review skill/server, delegation, model call or `.claude/HANDOFF.md`. All commands ran in the specified worktree, with default Go caches and `CGO_ENABLED=0` for Go checks. Absolute package paths below select the same packages as the requested covering commands. |
| + |
| +### RED before implementation |
| + |
| +Both regression tests were written before changing production code. This command exited 1 with compiled test failures: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run 'TestEgressLongScratchRoot|TestEgressSocketDirectoryPinned' -count=1 |
| +``` |
| + |
| +```text |
| +--- FAIL: TestEgressSocketDirectoryPinned (0.00s) |
| + proxy_test.go:425: socket survived close in verified directory: <nil> |
| + proxy_test.go:428: close touched replacement directory: "" open /home/paulca/t/e2b/e3-1942956935/private/proxy.sock: no such file or directory |
| +FAIL amadan.net/oficina/equipo/internal/runner/egress 0.003s |
| +--- FAIL: TestEgressLongScratchRoot (0.00s) |
| + egress_test.go:109: namespace capability/start failed (userns, pidfd required): listen unix /home/paulca/t/e2b/e3-1724877323/s/deepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeep/state/attempt-e4c7c01b4fa5d537e515509ec81955cc/egress/proxy.sock: bind: invalid argument |
| +FAIL amadan.net/oficina/equipo/internal/runner/containment 0.004s |
| +``` |
| + |
| +### GREEN before mutations |
| + |
| +The same focused command then exited 0: |
| + |
| +```text |
| +ok amadan.net/oficina/equipo/internal/runner/egress 0.002s |
| +ok amadan.net/oficina/equipo/internal/runner/containment 0.060s |
| +``` |
| + |
| +The covering command and namespace gate also passed before mutations: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run 'TestEgress|TestNamespaceHidesHostControl' -count=1 |
| +make -C /home/paulca/amadan.net/oficina/equipo-plan-2b runner-namespace-test |
| +``` |
| + |
| +```text |
| +ok amadan.net/oficina/equipo/internal/runner/egress 3.269s |
| +ok amadan.net/oficina/equipo/internal/runner/containment 0.456s |
| +CGO_ENABLED=0 go test ./internal/runner/containment -run '^TestNamespace' -count=1 |
| +ok amadan.net/oficina/equipo/internal/runner/containment 3.205s |
| +``` |
| + |
| +### Independent mutations |
| + |
| +Each mutation ran alone against the green source and was restored in a Python `finally` block before the next one. All three compiled and exited 1 with the named test failure. |
| + |
| +1. Replace `net.Listen("unix", bindPath)` with `net.Listen("unix", path)`. |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run '^TestEgressLongScratchRoot$' -count=1 |
| +``` |
| + |
| +```text |
| +--- FAIL: TestEgressLongScratchRoot (0.00s) |
| + egress_test.go:109: namespace capability/start failed (userns, pidfd required): listen unix /home/paulca/t/e2b/e3-522231684/s/deepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeepdeep/state/attempt-92cfe44ad327dd4bee20cdab87708242/egress/proxy.sock: bind: invalid argument |
| +FAIL amadan.net/oficina/equipo/internal/runner/containment 0.004s |
| +``` |
| + |
| +2. Insert `directory.Close()` immediately before `directory = nil` in `open`, ending the retained descriptor's lifetime before listener cleanup. |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress -run '^TestEgressSocketDirectoryPinned$' -count=1 |
| +``` |
| + |
| +```text |
| +--- FAIL: TestEgressSocketDirectoryPinned (0.00s) |
| + proxy_test.go:425: socket survived close in verified directory: <nil> |
| +FAIL amadan.net/oficina/equipo/internal/runner/egress 0.003s |
| +``` |
| + |
| +3. Change `SocketPath()` to return `p.listener.Addr().String()`, exposing the proc alias to containment instead of the real path. The existing mount pin rejects that magic link. |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run '^TestEgressLongScratchRoot$' -count=1 |
| +``` |
| + |
| +```text |
| +--- FAIL: TestEgressLongScratchRoot (0.00s) |
| + egress_test.go:109: namespace capability/start failed (userns, pidfd required): namespace_mount_rejected: too many levels of symbolic links |
| +FAIL amadan.net/oficina/equipo/internal/runner/containment 0.005s |
| +``` |
| + |
| +### Final GREEN after restoration |
| + |
| +```sh |
| +CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run 'TestEgress|TestNamespaceHidesHostControl' -count=1 |
| +make -C /home/paulca/amadan.net/oficina/equipo-plan-2b runner-namespace-test |
| +CGO_ENABLED=0 go vet /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment |
| +git -C /home/paulca/amadan.net/oficina/equipo-plan-2b diff --check |
| +gofmt -l /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress/proxy.go /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/egress/proxy_test.go /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment/egress_test.go |
| +``` |
| + |
| +```text |
| +ok amadan.net/oficina/equipo/internal/runner/egress 3.260s |
| +ok amadan.net/oficina/equipo/internal/runner/containment 0.440s |
| +CGO_ENABLED=0 go test ./internal/runner/containment -run '^TestNamespace' -count=1 |
| +ok amadan.net/oficina/equipo/internal/runner/containment 2.220s |
| +``` |
| + |
| +Every command exited 0. Vet, diff checking and formatting produced no output. No full suite or `make ci` ran. |
| + |
| +### User-facing strings and concerns |
| + |
| +No new user-facing strings, protocol responses, diagnostics or `copy.go` entries. Only test assertion messages and one implementation comment were added. |
| + |
| +No new concerns or failing gates. Provider certification remains the existing Task 11b release gate. Tests closed their listeners, stopped their namespace processes and removed their owned TMPDIR trees. No separate scratch, background server or credential home was created. No push, merge, deployment or other worktree access occurred. The controller owns review and push. |
| + |
| +The final fixture reads the response through EOF so a split TCP read cannot cause a false failure. After that test-only adjustment, `CGO_ENABLED=0 go test /home/paulca/amadan.net/oficina/equipo-plan-2b/internal/runner/containment -run '^TestEgressLongScratchRoot$' -count=1` passed (`ok amadan.net/oficina/equipo/internal/runner/containment 0.061s`), and `git diff --check` remained clean. |