Repository navigation
fix(minvmd): a resumed host_ip box gets its egress back after a VM host daemon restart with no new - #3368
Conversation
Persist each held host_ip box's declared egress policy and credentialed lane to box-host-ip-rules.json beside the host_ip id file. A restart reloads them as set-aside rules, so the next reconcile that finds the guest runs the box puts its egress back with no client admit.
…host-ip-box-gets-its-egress-back-after
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: no findings; approval withheld, 2 threads unresolved at APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minvmd/src/box_registry.rs:4313, minimal-arch[bot] crates/minvmd/src/box_registry.rs:7064. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The change persists each host_ip box's declared policy and reloads it as set-aside rules after a restart. This fits §7.1 and §4.3 of the egress gateway design. One path fails open. When the rules write fails after a client retires a box, the code only logs a warning, and the earlier file still lists the box. After a restart, a false guest report brings a stopped box's rules back into the union. UC5 and §5.5 forbid this. C1 removes the file on a write failure, so a restart reloads nothing.
Ruled at 1019bcc against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| .collect(), | ||
| } | ||
| }; | ||
| if let Err(error) = write_registry_file(&path, &file) { |
There was a problem hiding this comment.
C1 · A write failure here leaves the earlier file in place. After a retire, that file still lists the stopped box. A restart reloads it, and a false guest report brings its rules back (UC5, §5.5 line 184). Remove HOST_IP_RULES_FILE on this error and log it with error!. Then the next start reloads nothing.
There was a problem hiding this comment.
Addressed in f7dd9c115826: persist_host_ip_rules now removes HOST_IP_RULES_FILE on a write error and logs it with error!, so the next start reloads no rules.
| .set_published(resident.boxes.keys().copied().collect()); | ||
| } | ||
| drop(resident); | ||
| if removed || dormant_rules.is_some() { |
There was a problem hiding this comment.
C1 · This persist is the one that must not fail open. The test must cover a failed write on this path: retire, restart, report the box Active, and assert that nothing is admitted.
There was a problem hiding this comment.
Addressed in f7dd9c115826: Added host_ip_box_rules_write_failure_on_retire_reloads_nothing: the write on retire fails, then restart, report the box Active, and assert that nothing is admitted.
|
/revise apply the arch condition C1 from the Evidence: Do:
Change nothing else in the file. The rest of the change was ruled to fit §7.1 and §4.3. |
A failed write left the earlier file, which can still list a box a client retired. A restart then reloaded it, and a guest report brought its rules back. Remove the file and log an error, so the next start reloads no rules.
|
Round 1 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
After a minvmd restart, a host_ip box that the guest reports running gets its admitted egress from the next reconcile, and no client admits it again. When the rules write fails, the old rules file is removed, so a retired box does not come back after a restart. Notes from the agent: Revise round 1 applies arch condition C1. persist_host_ip_rules now removes HOST_IP_RULES_FILE on a write error (NotFound is ignored) and logs with tracing::error!. The new test host_ip_box_rules_write_failure_on_retire_reloads_nothing puts a directory at the write's temporary path (box-host-ip-rules.json.tmp), so the write fails. Then it retires the box, restarts, reports the box Active, and asserts that outcome.admitted is empty. A directory at the rules path itself was not used, because remove_file cannot remove a directory, so that case does not exercise the fail-closed path. cargo clippy -p minvmd --all-targets and cargo fmt --check are clean. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to UC5 line 107 and §5.5 lines 184-185. After a restart, reloaded rules stay set aside until the guest reports the box running, as on a resume without a restart. This head closes the open path from the earlier ruling: a failed write now removes the earlier rules file, so a box a client retired does not come back. The new test proves that rule. No conditions.
Ruled at f7dd9c1 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minvmd/src/box_registry.rs:4313, minimal-arch[bot] crates/minvmd/src/box_registry.rs:7064. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
Defect
Fixes #3355
crates/minvmd/src/box_registry.rsTask marker
Proof
After a minvmd restart, the registry reloads each held host_ip box's declared policy and lane from box-host-ip-rules.json as set-aside rules. The first reconcile that finds the guest runs the box puts the same rules back in the gate's union, and the client admit count does not change. The test host_ip_box_rules_survive_a_restart_and_rejoin_on_resume shows this.
Notes from the agent: The new file box-host-ip-rules.json sits beside box-host-ip-ids.json. It holds every box whose rules are held, resident or set aside. It stores the declared policy, and a reload fills it under the current egress default, as an admit does. Rules that a client retired are not persisted. A reconcile that finds the guest no longer lists a box removes it from the file. An unusable file is set aside, and no rules are reloaded. HostIpBoxRules now carries the declared policy, so its equality also compares the declared policy. One effect: two declarations with the same effective rules now count as a change, and the cohort record is rebuilt. Clippy (-p minvmd --all-targets) is clean, and the 20 lib tests that match host_ip pass. One full run of
cargo test -p minvmd --libfailed 5 timing tests in bep_attach, net::answerer and sock, which this change does not touch. Each of them passed when I ran it alone or in a small group, so I think the full parallel run's load caused the failures.Tests
cargo test -p minvmd host_ip_box_rules_survive_a_restart_and_rejoin_on_resumeVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked; it was merged in before the tests ran.