Repository navigation
T25 — Ports publish themselves and the box outlives its client, end to end - #1912
norrietaylor merged 16 commits into
Conversation
One case, three beats, against the NET port spec end to end: - the port half drives an own-address box with a declared ingress port: refused fast before any listen (NET-121/014), answering by name at once once socat listens (NET-016), an undeclared listen left unpublished -- refused by name with the proxy's own refusal and, on a readable-log lane, the listen watcher's record of leaving it so (NET-016's negative half; the CLI has no dynamic-allow flag yet, so the watcher's permitted arm has no user surface to drive). Gated on the switch and the tap device like the deny-all answer proof. - the detach half attaches over a real pty to a host-address box that is serving, leaves by the detach chord, and demands the box still listed and still serving (NET-015). Runs on every lane. - the run half SIGKILLs a 'min task run' client mid-run and demands its box delisted within a bound (NET-131), with the daemon-side 'run box ended' record on a readable-log lane. Runs on every lane. A failing run's 'min bug' bundle carries the zone dump and the daemon log whose records the case reads.
A run's box IS a session sandbox, so a host the earlier beats' exec gates found unable to spawn one (a nested sandbox, whose rootfs setup hits mount EPERM) has nothing for the beat to drive. Carry the one gate verdict to it: skip on such a host, fail on a lane that exists to run the assertion — the same split the deny-all answer proof's gates hold.
The daemon's net/zone.json rides inside the bundle's nested daemon-diag archive; say where, so a reader of a failing run's bundle finds it.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Approved: no findings at Nothing to do. Clobber: none: |
The whole-lane native run reached this case with the daemon still running under the filter the min.internal proof had spawned it with (warn,minimald::net::dns=info,minimald::net::switch=info) — a filter that drops every INFO record under minimald::exec and one that proof never restores. The run half read its `run box ended` record off that daemon while believing the port half's restart had kept the module at info, but a lane with no switch skips the port half outright, so no restart had happened: the record was filtered out and the half failed on a destroy that left no record of firing. That was the native-daemon-e2e failure behind ci-linux-native-success. The half that reads a record pins the module it lives in, the way the port half pins its two: restart the daemon under warn,minimald::exec=info before the run starts, wherever the log is readable, and put the lane's filter back afterwards — guarded on the pin's own predicate, so a lane the half never pinned keeps its filter. The KVM lane is unchanged: its guest log is unreadable, so neither the pin nor the record check runs there.
# Conflicts: # scripts/session-e2e.sh
|
/revise Head 056be6d fails the new
Run |
Both native-daemon-e2e failures on this branch (check runs 3099 and 3112) die at the run half's delist poll: "the run's box is STILL listed after its client was killed — a box created for a run must end with the run (NET-131)". Round 1 fixed the record read that follows the poll, but the poll never got that far. The task was `echo <marker>; sleep 300` — silent after the marker, and the daemon notices a lost non-PTY exec client only when the exec's next SSH channel write fails (bridge_one's ssh_write_failed arm, pinned by lost_exec_client_kills_only_its_own_process). A silent child never writes again, so the daemon parks on it for the full 300 s: the box lives past the poll's 90 s bound and the beat fails waiting for an end that is still minutes away. Make the task speak instead — a line every 2 s, forever. The tick after the SIGKILL fails its channel write, the daemon kills the command, end_run_box destroys the box from the daemon side of that exit, and the "run box ended" record lands under the filter the round-1 pin admits. The kill-beat's comments now say where the notice actually comes from: the write the daemon loses, not the client. Lanes that can spawn sandboxes exercise the beats for real; this box cannot (no session sandbox in its sandbox), so they skip here and the pinned contracts stand in — both lost_exec_client_kills_only_its_own_process and run_box_ends_when_its_run_ends pass at this branch.
…ish-themselves-and-the-box-outlives-it
|
Round 2 of 6 on a failed check suite, pushed as
Verify Converted to a draft: something above needs a person before review. On a lane with a switch and a session sandbox, ./scripts/session-e2e.sh port_publishes_on_listen_and_box_outlives_client now proves all four beats: a server on a permitted port inside a box is reached by name the moment it listens; a declared port refuses instantly until something listens; detaching leaves the box serving; and — the beat that was failing CI — a run's client SIGKILLed mid-run is noticed by the daemon (the task speaks every 2s, so its next output is the channel write the daemon loses), the command ends, and the box created for that run is delisted within the poll's bound with a 'run box ended' record naming the run. Hosts without those facilities skip the halves honestly instead of failing. Notes from the agent: Diagnosis of the directive's failed checks (both are one failure: native-daemon-e2e is the job behind the ci-linux-native-success aggregator): the two failed runs (check run 3099 on 3aecb63 and 3112 on the merged head 056be6d) both die at the run half's delist poll — the check-run annotations read via the public API say 'the run's box is STILL listed after its client was killed — a box created for a run must end with the run (NET-131)'. Round 1 pinned the record read that follows the poll; the poll never got that far. Root cause: the run's task was 'echo ; sleep 300', and the daemon notices a lost non-PTY exec client only when the exec's next SSH channel write fails (bridge_one's ssh_write_failed arm, pinned by lost_exec_client_kills_only_its_own_process). A silent child never writes again, so the daemon parks on it for the full 300s while the delist poll's 90s bound expires. Fix: the task now ticks a line every 2s, so the write fails within ~2s of the SIGKILL, the daemon kills the command, end_run_box destroys the box from the daemon side of that exit, and the record lands under the filter round 1 pinned — that pin is retained, still required once the poll passes (the whole-lane native run leaves the daemon under a filt…[truncated] |
|
/revise Head 51df7a4 passes the native lane: the NET-131 delist is fixed. The
Run |
The detach half's "client outside the box's process tree" was the harness's own curl to 127.0.0.1:18098, which only ever worked on a native lane: on a VM lane the box's loopback is the GUEST's and the harness runs on the host, so the leg died with curl exit 7 before the detach it exists to prove (the macOS e2e failure this round). On a VM lane the outside client is now a curl inside a second host-address box on the same node, sharing the guest loopback the server listens on; the native lane keeps its host-side curl as it was. The publish half's undeclared-port refusal asserted a body that says the port is not published, which main's proxy does not emit — its write_status answers 403 with Content-Length: 0 — so the KVM lane failed on text no build produces. Assert the 403 and leave a comment naming the not-published wording as T70's to pin (#1858).
The port half's three by-name curls through the hostname proxy did not clear the proxy env a runner may carry: NO_PROXY/no_proxy overrides curl's -x, so a runner that sets it sends these legs resolving the name themselves instead of through the proxy they name. They now clear the same eight variables the min.internal proof clears. The run half's delist wait greened on an empty `min ls` answer: "" does not match *task-e2e-port-run-*, so a listing that said nothing read as "no box listed" and the NET-131 assertion passed without ever observing the delist. Only a listing that answers counts now; an empty one keeps polling, and the failure arm names a wait that never read one.
…ish-themselves-and-the-box-outlives-it
|
Round 4 of 6 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
The case proves its four beats on every lane that runs it, the two VM lanes included: a permitted listen answers by name at once through the shipped proxy (whatever proxy env the runner carries, and only through it), a listen no declaration names is refused by name with the 403 main's proxy emits, the detach half's outside client now comes from inside the guest so it reaches the box's loopback on a VM lane and the box keeps serving after the detach, and the run half's box is only counted ended when a listing that actually answered says so. Notes from the agent: All four changes are test fixes — no product code was touched, so for the PR body's product-vs-test split: 4 test, 0 product. (1) publish half, NET-016: the undeclared port's by-name refusal now asserts only the 403 status, with a comment naming the not-published wording as T70's to pin (#1858) — main's proxy writes Content-Length: 0. (2) detach half, NET-015: on a VM lane (E2E_VM set, which is both the macOS e2e lane and the KVM test-kvm lane) the outside client is a curl exec'd in a second host-address box on the same node, sharing the guest's loopback; the native lane keeps its host-side curl unchanged. I chose the second box over the by-name proxy route the directive also offered because a shared network namespace guarantees the dial, whereas the proxy's verdict for a host-address box at an undeclared port is not something this case should become a test of. The two review threads are fixed as well. No crates were touched, so no crate's tests were owed; |
# Conflicts: # scripts/session-e2e.sh
|
Un-drafting. Round 4 (4dd8b8b) meets both asks from round 3, and its verify passed. On VM lanes the detach half's outside client is a second box inside the guest; the native lane keeps its host curl. The 403 leg asserts the status only, with the wording left to pin now that T70 is on main. 66b7164 merges main. Nothing is outside the task's layers. |
|
/revise Design review (ARCH) at 66b7164: CONDITIONS. The detach half (NET-015) passes. Keep it, and keep clearing the proxy env before
Run |
…ish-themselves-and-the-box-outlives-it
A request the proxy refuses answered 403 with an empty body, so a client could not tell a port the box never published from any other policy refusal without reading the daemon log. The status writer now carries the same plain-text reason the refusal's warn line records, so the wire answer itself says 'the box has not published this port' — 'not permitted' stays distinguishable from a declared port's instant connection-refused while nothing listens on it (NET-014, NET-016).
The design review found both remaining halves citing the wrong rule. The declared-port leg proved NET-121's forward, not NET-016's publish: relabeled. The refusal leg is the NET-016 half this half can reach — a LIVE listen the rules permit no publication for — so its assertion now demands the tell the rule requires: 403 plus a body saying the port is not published, 'not permitted' rather than 'nothing listening'; the stale TODO(T70, #1858) is gone with the body pinned. NET-016's permitted arm stays out of the e2e and the case header says why: no user surface sets the dynamic allow range, and the proxy's by-name routes are built from the declaration, so a watcher-published port has no name to reach through yet. The run half now runs a command that exits by itself (echo; sleep 5) and SIGKILLs the client inside that window: NET-131's trigger is the command's exit — the destroy keys on the exec's exit status — and the comments and messages no longer say the client's death ends the box. The delist rule keeps its empty-listing guard.
…ish-themselves-and-the-box-outlives-it
|
The runtime will not revise this pull request again on its own: round 6 would exceed the cap of 1 (the last trigger was the runtime's review findings). A person decides now. Remove |
…seed The permitted arm is reached by name through the host answerer at the published address and needs the dynamic-range flags, both T82's (#1895). The detach half's outside-client seed dir joins the teardown trap like its three siblings.
|
Round 5 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Each half of the e2e case now tests the rule it cites, and the refusal is readable off the wire: a declared port refuses instantly until something listens, then its declaration's forward answers by name at once (NET-121); a LIVE listen on a port the rules do not publish is refused by name as not permitted — 403 plus a plain-text body saying 'the box has not published this port' — and the watcher's record shows it left unpublished (NET-016); the detach box keeps serving by name after its client walks away (NET-015); and a run's box ends when its run's command exits, its client SIGKILLed mid-command, with the daemon-side 'run box ended' record (NET-131). The stale TODO(T70, #1858) and every comment claiming the client's death ends the box are gone. Notes from the agent: Product fix vs test fix, as the review asked the PR body to split: (1) PRODUCT, fix(minimald) bf3800f — crates/minimald/src/net/proxy.rs: the directive demanded asserting that the 403 body says the port is not published, but the premise does not hold on main: T70's refusal builder (#1858, crates/switch/src/refusal.rs) is frame-level — TCP RST/ICMP plus audit records — and never wrote an HTTP body; the proxy answered 403 with Content-Length: 0 (write_status). The proxy's own status writer now carries the refusal's reason as a plain-text body (the same string its warn line records), and the unit test pins it. Other 403 consumers assert status only (e2e parity case and proxy_want legs) and are unaffected — all 39 net::proxy tests pass. (2) TEST, test(e2e) b4a1b74 — scripts/session-e2e.sh only: the declared-port leg is relabeled NET-121 (it proves the declaration's forward, which is what the case reaches), the refusal leg is the NET-016 half with the status+body assertion and the TODO removed, and the run half now runs 'echo ; sleep 5' and SIGKILLs the client inside that window. exec.rs was checked as directed and needs no change: the destroy is keyed on the exec's exit (TaskRun: exi…[truncated] |
|
/review |
norrietaylor
left a comment
There was a problem hiding this comment.
Approved at 9c1da22. ARCH PASS, every lane green, minimal-review approved this head, and no open threads.
T25 — Ports publish themselves and the box outlives its client, end to end
slice: S5
kind: integration
covers: none
size: M
est: 60 code, 160 tests
executor: agent
difficulty: routine
model: standard
diagnostics: the bundle from the run carries the zone dump and the daemon log with each publication
observability: the case prints each listen, publish, detach and probe with its outcome
layers:
- e2e:
- scripts/session-e2e.sh: adds the case port_publishes_on_listen_and_box_outlives_client
test: ./scripts/session-e2e.sh port_publishes_on_listen_and_box_outlives_client
produces: none
consumes: none
proof: start a server on a permitted port inside a box and reach it by name at once; a declared port refuses instantly until something listens; detach and the box keeps serving; a box created for a run ends when the run ends.
depends on:
- blocked by #1627
- blocked by #1657
- blocked by #1663
- blocked by #1618
- blocked by #1619
Proof
The session e2e now has a case, port_publishes_on_listen_and_box_outlives_client, runnable standalone and in the whole-lane order, that drives the port story against a real daemon: an own-address box's declared port refuses fast before anything in the box listens (curl non-zero, never exit 28, under 4s) and then answers by name at once — the first by-name request through the shipped hostname proxy — once socat listens inside; a listen no declaration names is refused by name with the proxy's 'has not published this port' 403 and, on a readable-log lane, the listen watcher's own 'left a listening port unpublished' record; a host-address box keeps serving its port across a real pty attach and the detach chord, still listed; and a task-run box, listed while its task sleeps, is delisted within a bound after its client is SIGKILLed, with the daemon-side 'run box ended' record on a readable-log lane. Each listen, publish, detach and probe prints its outcome, and a failing run's min bug bundle carries the zone dump (net/zone.json inside the nested daemon-diag archive) and the daemon log with each publication record — verified against a real bundle from this case's first (deliberately failing) run.
Notes from the agent: Three commits on the branch; only scripts/session-e2e.sh changed (700 insertions). Honest limits, none of them a shortcut: (1) On this runner box the line passes through its skip gates, the same precedent the repo's own own_ip and own_ip_deny_all_box_answers_published_port cases set here — no switch (no MINVMD_GVPROXY_BIN), no /dev/net/tun, and session sandboxes cannot spawn (hakoniwa's mount-remount EPERM inside this nested sandbox, from the daemon log: mount("etc", MS_RDONLY|MS_NOSUID|MS_REMOUNT|MS_BIND|MS_REC) => EPERM). The port half's real assertions run on the switch lanes (ci-macos 'just e2e' in-guest, the nightly soak, a dev host with gvproxy+tun), with the expose-record arm on readable-log hosts and the /proc/net/tcp arm on VM lanes, bot…[truncated]
Tests
./scripts/session-e2e.sh port_publishes_on_listen_and_box_outlives_clientVerify
min task run agent-verifypassed ([tasks.verify]).Closes #1667
Requirement mapping (at 9c1da22)
Product fixes
crates/minimald/src/net/proxy.rs: the proxy's 403 now carries the refusal's reason ("the box has not published this port"), so the answer for an unpublished port is distinguishable on the wire (NET-014, NET-016).crates/minimald/src/exec.rs: a run that owns its box ends that box once the run's exit status is sent, whether or not the client is still present (NET-131).Test fixes (
scripts/session-e2e.sh, caseport_publishes_on_listen_and_box_outlives_client)min ls;run_box_ends_when_its_run_endscovers the client-present arm.