Repository navigation
fix(mctx,minimald,minvmd): a task on a VM-backed host_ip box runs in the classifier leaf of its box - #3610
Conversation
A context made for a host-address box carries the leaf of that box. The task env args now take it, so the task sandbox joins the leaf and the box egress verdict decides the task connections.
A task of a host-address box ran with no leaf. On a VM host the guest filter then dropped its connections, while the same connection from min box exec passed. run_task keeps the box leaf on its context and logs it, and the task network follows the verdict of that leaf.
A node-plane or host_ip drop line is rate limited, so it can name a later frame or an ACK in place of the packet that opened the flow. The gate now logs the first dropped opening packet of each source once, with the source, the destination and the port.
An entry with no recorded read was stale at once, so a clean could delete a package written moments before. It is now stale only when its write time is before the cutoff. The minimald clean RPC test writes its cold entries an hour back to match.
…a-vm-backed-host-ip-box-runs-in-the-cl
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
…a-vm-backed-host-ip-box-runs-in-the-cl
An unread cache entry now stays when its write time is after the cutoff. The maintenance tests wrote their cold entries with the current time, so a clean kept them. Write them twice UNUSED_FOR ago.
|
Round 1 of 10 on a failed check suite, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. On macOS with host_ip, a task in a box runs in the classifier leaf of that box and gets the same egress verdict. A task that opens /dev/tcp/www.google.com/443 and /dev/tcp/1.1.1.1/443 connects, the same as min box exec in that box. This round also makes the Linux test lane pass again: the minimald maintenance tests now agree with the new cache-clean rule. Notes from the agent: The CI log excerpt did not name the failing test. I found it locally: three minimald maintenance::tests (clean_runs_with_no_sessions, clean_keeps_what_a_session_needs_and_drops_the_rest, concurrent_requests_are_serialized) failed. The cause is the op cache_clean change in this task. An unread entry now stays when it is written after the cutoff, and these tests wrote their 'cold' entries with the current time. The fix gives the test helper write_entry a write time of 2 * UNUSED_FOR ago. crates/minimald/src/maintenance.rs is outside the task's layers. I changed it only in its test module because the layer's behavior change requires it. crates/minimald/src/rpc/tests.rs is also outside the layers. An earlier round changed it for the same reason. Local environment issues that do not come from this branch: (1) MINIMAL_OTEL=off in this box makes env::tests::task_entrypoint_carries_env_cwd_and_args fail and two stdin tests hang, so I ran minimald tests with MINIMAL_OTEL unset. (2) rustdoc is missing here, so mctx doctests did not run. (3) Some net::switch, box_actor, connection and answerer tests fail in a full parallel run but pass when run alone. Those modules are unchanged on this branch. A full |
|
Round 2 of 10 on a failed check suite: the coder changed nothing. Revise round 2: I changed nothing. The directive gives two failed checks. ci-linux-kvm-success is only the aggregator of test-kvm. The test-kvm excerpt holds only the source lines of the workflow scripts that contain '::error::', and setup lines. It does not show the step that failed or its output. So I cannot tell which harness failed, or if the cause is this branch or a flake. This box has no /dev/kvm, so I cannot run 'just test-vm', the lifecycle script or scripts/session-e2e.sh. I read the branch diff against the KVM paths. Only host-address boxes get a classifier leaf (box_actor/setup.rs says an own-address box has none), so own_ip tasks keep their earlier sandbox and network. The new gate line is a WARN, and the e2e script says WARN drop lines pass either way. I found no e2e proof that the change breaks. All four test: lines pass at the merged head 807bebac. Next step: someone with access must read the full test-kvm log (run 44445651300, job 135300067912), find the fa…[truncated] |
|
Un-drafted: the failed job passed on a re-run of the same head (a timing flake in a test this diff does not touch), and every lane is now green. |
|
/review |
|
/arch-review |
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
…a-vm-backed-host-ip-box-runs-in-the-cl
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The task placement conforms. A host_ip task now joins its box's classifier leaf, as §4.1 and the min box exec contract require. The new minvmd drop line does not record what it claims. It latches on the source address. On both rules that address is shared, by minimald or by the whole host_ip cohort. §4.1 says per-box attribution in the cohort is impossible. Fix the message, the doc comments and the marker text in C1. Run the macOS proof leg and record it, as C2 says.
Ruled at 8539c8f against gominimal/arch@8b824707cde6 by claude-opus-5-5.
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The change conforms to the design. A task of a host_ip box now runs in the classifier leaf of its box. So its connections take the cohort address and not the node-plane address, as deployment-and-egress-gateway.md §4.1 line 54 requires. The gate log line and the cache-clean rule are design-silent. The task's own proof is not run: the PR body says no macOS VM run was made. C1 asks for that run on macOS with host_ip, for both task paths, and its result in the ## Proof section.
Ruled at 8539c8f against gominimal/arch@8b824707cde6 by claude-opus-5-5.
There was a problem hiding this comment.
I traced both task paths, the in-box run_task and the exec-channel task_producer. Each carries the box leaf into the task env: Context::task_env_args passes it to place_in_classifier_leaf, and the sandbox pre-exec join puts the task in the leaf. task_network_in_box_leaf builds the same HostIpAddressNetwork plan that the box launch builds. The None decision matches what tasks passed before, so this is not a regression. I found no correctness bug. The cache_clean write-time rule is sound: an entry whose meta is missing or unreadable still counts as old. The test updates in maintenance.rs and rpc/tests.rs match the new rule. The minenv_run_forwards_stdin_to_the_task hang in the Verify section uses a stub channel and does not reach the code changed here. One low note is inline, about test coverage of the wiring. The existing architect threads are still open and need answers before merge: the FirstOpeningDrops doc and message say "box", but the latch keys on (rule, node source address), and the macOS host_ip proof run is still owed.
Generated by Claude Code
A task of a native deny-all host_ip box joins its box leaf. Its plan now carries a decided decision with the carve-out the leaf's tree records, so a task started after the answerer moved or stopped is refused, the same as the box launch, and never falls back to the constant answerer.
|
The macOS |
|
Round 3 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
A task started in a host_ip box runs in the classifier leaf of that box and gets the same egress as min box exec in that box. On macOS with host_ip, a task that opens /dev/tcp/www.google.com/443 and /dev/tcp/1.1.1.1/443 connects. On a native deny-all host_ip box, a task started after the DNS answerer moved or stopped is refused, the same as the box launch. Notes from the agent: Revise round 3. The review thread is valid. The fix adds classifier::task_box_decision: a native deny leaf of a running box exists only when its launch decided per box, so the task plans over a decided decision with the carve-out that the leaf's tree records now. The task does not run the table probe again. That probe binds a listener and forks a child, so it is too heavy for each task run. The macOS proof needs a VM host, and this box did not run it. cargo clippy -p minimald --all-targets and cargo fmt --check are clean. |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The code conforms to §4.1 line 54. A task of a host_ip box now runs in its box's classifier leaf, and a deny-leaf task repeats the stale carve-out check. That check fails closed. C1 stays open. The PR body still says that no macOS VM end-to-end run was made. On a VM host, §7.1 line 245 puts the split in the VM's netfilter, so only that run proves the fix. Run the task proof on macOS for both task paths. Then record the command, the exit code and the output tail in ## Proof.
Ruled at 7a65a15 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The task placement fix conforms to §4.1. A task of a host_ip box now joins its box's leaf and gets the box's verdict, and a deny leaf fails closed on a stale carve-out. The new first-opening drop line in egress_gate.rs claims a per-box record that the gate cannot make. Section 4.1 says per-box attribution in the cohort is impossible, and node-plane drops are minimald's own traffic. Make the edit in C1, so the line says it is once per rule and source address. The verify run is still open: it timed out with a test failure that this review cannot name.
Ruled at 7a65a15 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
|
/revise Apply arch condition C1 at 7a65a15 exactly as ruled (crates/minvmd/src/net/egress_gate.rs,
Also from the three C1 threads: rename the test at line ~8563 that uses two node addresses as two boxes, and assert that a second opening under |
…a-vm-backed-host-ip-box-runs-in-the-cl
The source address on a relay does not name a box: every host_ip box and the node plane leave from the node address. Say so in the doc comment and the log line, and rename the test to match.
…a-vm-backed-host-ip-box-runs-in-the-cl
|
Round 4 of 10 on a /revise note, pushed as
Verify The coder's box did not compile these files. Check them in CI: Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
On macOS with host_ip, a task that opens /dev/tcp/www.google.com/443 and /dev/tcp/1.1.1.1/443 connects, the same as min box exec in that box. This round changes only the minvmd drop log: it now says one line per rule and source address, and it does not claim a box. Notes from the agent: Revise round 4 applies arch condition C1 only. The doc comment of FirstOpeningDrops and of its note method now say that the latch is one line per rule and source address on this relay. The warn message is the C1 text, with the fields source, destination, port and rule_matched. The test node_plane_drop_is_logged_once_per_box is renamed to first_opening_drop_is_logged_once_per_rule_and_source. It no longer uses a second node address as a second box. It asserts that a second HOST_IP_BOXES_RULE opening from the same node address writes no line. The task.md test line still names the old test, so |
|
Marked ready: the round pushed and every lane aggregator is green at 8dcc569; the draft came from the round's verify step, not from a failing lane. |
|
/review |
|
/arch-review |
| let stale: Vec<SpecHash> = cache | ||
| .iter_entries() | ||
| .filter(|hash| !self.keep.contains(hash)) | ||
| .filter(|hash| atimes.last_read(hash).is_none_or(|last| last < cutoff)) | ||
| .filter(|hash| match atimes.last_read(hash) { | ||
| Some(last) => last < cutoff, | ||
| None => written_before(cache, hash, cutoff), | ||
| }) |
There was a problem hiding this comment.
LOW · correctness · confidence 0.55 · in CleanCache::run
This hunk changes how CleanCache treats never-read entries. An unread entry now stays until its write time passes the cutoff. Before, it was always stale. This does not trace to the PR goal of running a task in its box leaf. It also changes what min cache clean removes for every user. Move it to its own PR, or state the reason in the PR body.
What the reviewer checked
cache_clean.rs:131 None => written_before(cache, hash, cutoff), (was: is_none_or(|last| last < cutoff))
Hand this to an agent
Act on a code-review finding.
File: crates/op/src/cache_clean.rs
Lines: 128-134
Category: correctness
Severity: low (reviewer confidence 0.55)
Finding:
This hunk changes how `CleanCache` treats never-read entries. An unread entry now stays until its write time passes the cutoff. Before, it was always stale. This does not trace to the PR goal of running a task in its box leaf. It also changes what `min` cache clean removes for every user. Move it to its own PR, or state the reason in the PR body.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Disputed — not addressed: This change is in scope. The task's cache layer names crates/op/src/cache_clean.rs: "An entry with no recorded read is stale only when its write time is before the cutoff". The test line clean_keeps_an_unread_entry_written_after_the_cutoff pins it. Before this change, a clean could delete an entry that was written moments earlier and not read yet.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
C1 is met at this head. The FirstOpeningDrops doc and log line now say one line per rule and source address, and they do not claim a box. This agrees with §4.1 line 54, which says per-box attribution in the host_ip cohort is impossible. The renamed test asserts that a second host_ip opening from the node address writes no line. The merges of main do not touch the task leaf placement or the cache rule, so the earlier status stands. Update the task marker test name to first_opening_drop_is_logged_once_per_rule_and_source when you run the proof again.
Ruled at 8dcc569 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
|
Round 5 of 10 on the runtime's review findings: the coder changed nothing. every commit this round put on the branch above 8dcc569 is a merge of the base branch, so it carries no work of its own Review threads the coder judged:
|
|
/revise Revert cb2a272's changes to crates/op/src/cache_clean.rs and crates/minimald/src/rpc/tests.rs, so this branch leaves the cache clean as main has it. Then run |
|
That What the platform saidcould not start the coder: Error: there is no container instance that can be provided to this durable object Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
Follow-up
Fixes #3582
crates/mctx/src/env.rscrates/mctx/src/lib.rscrates/minimald/src/env.rscrates/minimald/src/exec/process.rscrates/minimald/src/net/provider.rscrates/minimald/src/net/classifier.rscrates/minvmd/src/net/egress_gate.rscrates/op/src/cache_clean.rsTask marker
Proof
A task of a host_ip box now runs in the classifier leaf of its box. This applies to an in-box
min task runand to a task run over the exec channel. The task sandbox joins that leaf, so on a VM host the guest filter decides the task connections with the box verdict, the same as formin box exec.macOS VM run
7a65a15d(this PR's head)local-minvmd(libkrun microVM), every box--network host_ipmin,minvmdandbepbuilt from this head byjust minimal-cli minvmd-build(codesign last). The guestminimaldis fromjust initramfson this head; its initramfs carries this branch's newrunning an in-box task in the box's classifier leafline. The VM ran from a private state dir (min --minimal-dir), so no existing box or daemon was involved. The minvmd log reportsservice.version0.8.0-dev.632.g7a65a15d. The cross-built guest reports plain0.8.0, because the container build has no git describe, so the run setMINIMAL_ALLOW_VERSION_SKEW=1.The probe is the scratch project's task
probe:min session activate -n p3610 --network host_ip .01a1f45d-b454-79bf-ad82-5153efb72311min box exec p3610 -- bash -c 'exec 3<>/dev/tcp/www.google.com/443 && echo google ok; exec 4<>/dev/tcp/1.1.1.1/443 && echo cf ok'google ok/cf okmin task run --network host_ip probeRunning task probe in box probe-1.../google ok/cf ok/Kept box probe-1. ...min box exec p3610 -- min task run probegoogle ok/cf okGuest
minimaldlog for leg 1 (task boxprobe-1,01a1f45e-0003-7577-8106-0991e1f229c4):Guest
minimaldlog for leg 2 (sessionp3610,01a1f45d-b454-79bf-ad82-5153efb72311):In the
minvmdlog, each box is held as a host_ip box (holding the host_ip box's egress rules ... resident_host_ip_boxes1, then 2). The log has nodropped the first opening packetline for either box.Notes from the agent: Touched outside the layers: crates/minimald/src/rpc/tests.rs. The test clean_cache_streams_progress_then_a_terminal_done wrote two unread entries just now and expected a 1s clean to delete them. That contradicts the new cache rule, so the test now writes them with a write time one hour back. Two tests inside the cache layer file needed the same kind of change: deletes_only_unused_unkept_entries now keeps the just-written unread entry, and reports_deletions_as_events records an old read for its entry. Design choices: (1) task_network keeps its signature, because exec/tests.rs and box_actor/setup.rs call it and are outside the layers. A new task_network_in_box_leaf takes the box leaf. run_task and the exec-channel task path call it. (2) task_network_for takes the box verdict and a decision. The callers pass decision None, because the box launch does not keep its Decision anywhere a task can read it. A Decision::decided() with no carve-out would make a native deny-all task refuse on the stale carve-out check. The verdict comes from the leaf (deny or allow subtree). On a VM host the plan does not depend on the verdict, so the leaf placement is the part of the fix that matters there. (3) classifier.rs had no literal 'a task places no leaf' note. That note was in provider.rs and process.rs, and both are updated. classifier.rs gets the task_box_leaf helper wi…[truncated]
Tests
cargo test -p mctx task_env_carries_the_box_classifier_leafcargo test -p minimald run_task_runs_in_the_box_classifier_leafcargo test -p minvmd node_plane_drop_is_logged_once_per_boxcargo test -p op clean_keeps_an_unread_entry_written_after_the_cutoffVerify
min task run agent-verifytimed out after 1800s, so this PR is a draft.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimald/src/rpc/tests.rs