Repository navigation
feat(bep): free the client key of a box that ended without forget_box (T90) - #2642
norrietaylor merged 6 commits into
Conversation
… (T90) At start, each key's boxes= set in the registrations file is reconciled against the box registry. A box that the registry does not hold ended with no forget_box, so it no longer holds its key in use, and a retired key whose boxes all ended is revoked. The BEP-063 known-gap text is removed from the spec.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
Approved: no findings at Nothing to do. 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: PASS · the full ruling
This change conforms to Gatehouse §6.10. At start, the proxy frees the key of a box that it does not hold as registered. Line 839 says a box id never returns, and the redeemer already refuses such a box with no_live_box. So the change revokes a retired key sooner and changes no redemption outcome, which is the fail-closed side. The info log names each freed kid, as the task requires. The spec no longer carries the BEP-063 known gap.
Ruled at c7efb8b against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10: the container stopped before the coder ran (the container took the job and stopped before it ran (exit 0 and no result, and the second start failed: Error: The container is not running, consider calling start())). The round is given back. |
|
/revise Round 2 of #2642, on the red The failure.
Generated by Claude Code |
…lient-key-of-a-box-that-ended-without
A restart keeps every boxes= entry, so a box created before it keeps redeeming. The new live_boxes op frees each box that the file held at the start and that the list leaves out (#2617).
The proxy then frees the client key of each box that ended with no forget_box (#2617).
Request stays as it was, so a client that matches every Request keeps its match.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to Gatehouse §6.10. minvmd is the host-side creator, and it sends the live box list, as line 839 requires. The proxy frees only boxes that the file held at its start. It frees nothing before the list arrives, so a running box keeps its key for its life. The new live_boxes op uses the existing same-uid gate on the control socket. There are no conditions.
Ruled at 693a56d against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. A restart of bep serve keeps every box in the registrations file as a user of its key, so a box that still runs keeps redeeming. When bep serve starts to listen, minvmd sends one live_boxes line with every box id in its registry. bep then frees the key of each box from the file that the list leaves out, revokes a retired key whose boxes all ended, and logs an info line that names each freed kid. After that, the bound counts only the keys that running boxes use. a_stranded_box_frees_its_key_at_start shows each step, and proxy_gets_the_live_box_ids_when_it_starts_to_listen shows the minvmd side. Notes from the agent: Layer exception: the epic owner accepted the files outside T90's layers. They are crates/minvmd/src/box_registry.rs (BoxRegistry::live_box_ids, BoxRegistry::send_live_boxes, test live_boxes_names_every_box_the_registry_holds) and crates/minvmd/src/cmd/run.rs (the bep watcher runs send_live_boxes_on_listening when the proxy starts to listen, test proxy_gets_the_live_box_ids_when_it_starts_to_listen). Please add a 'Layer exception' section to the PR body that names these two files, as the /revise note asks. Design points that differ from the directive's wording: (1) live_boxes is a type of its own, LiveBoxesRequest, beside Request. A new Request variant broke the exhaustive matches in the minimal crate, and the module already keeps rotate_signing and revoked_box_ids in types of their own for this reason. (2) bep frees only boxes that the file held at this start (KeyFile::from_start), not every box the list leaves out. A box that registers its key after the start but reaches minvmd's registry after the snapshot is thus never freed by mistake. (3) bep serve binds its listener before its control socket, so minvmd retries the connect for up to 10 s on NotFound or ConnectionRefused. The send runs on a thread of its own, so the watcher does not wait. (4) A failed file write in live_boxes frees the keys in memory, logs an error and replies with a refu…[truncated] |
norrietaylor
left a comment
There was a problem hiding this comment.
Own review at 693a56d. A restart keeps every box in the registrations file as a user of its key, so T84's restart guarantee holds. Its test passes. When bep serve starts to listen, minvmd sends live_boxes with its registry's box ids. bep frees the keys of the boxes the file held at that start and the list leaves out, then revokes a retired key whose boxes all ended. A box that registers after the snapshot is never freed by mistake.
Generated by Claude Code
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter approval at 693a56d: every merge gate passes at this head (arch PASS at 693a56d, zero open threads, every lane aggregator green). Squash title feat(bep): free the client key of a box that ended without forget_box (T90) and the squashed message pass commitlint. Queued for squash merge.
Generated by Claude Code
T90 — Free the client key of a box that ended without forget_box
slice: S12
kind: task
covers: BEP-063
size: M
est: 120 code, 120 tests
executor: agent
difficulty: unknown ground
model: strongest
diagnostics: none beyond the bound's refusal text
observability: one info log line per key freed at start, naming its kid
layers:
- keys:
- crates/bep/src/control.rs: at start, each key's
boxes=set is reconciled against the boxes that are still registered, so a box that ended with noforget_box(a Ctrl-C before minvmd records it, a stopped minvmd, a failed release write) no longer holds its key in use (#2617)- docs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.md: the BEP-063 known-gap text that links #2617 is removed
test: cargo nextest run -p bep a_stranded_box_frees_its_key_at_start
produces: none
consumes: none
proof: After a restart, a box that ended without forget_box no longer holds its client key in use, and the bound counts only keys that running boxes use.
depends on:
- blocked by #2605
- assumes OQ3 (the mint reads the root certificate's own expiry, and the root is generated with a fixed default validity in one constant that gominimal/arch#85's ruling replaces)
Proof
After a restart, a key whose boxes= set names only boxes that the proxy does not hold as registered is no longer in use. A retired key of that kind is revoked. The bound then refuses a new key only when running boxes use every key: the test shows a new key refused before the restart and accepted after it, and the key of the box that is still registered stays.
Notes from the agent: KeyFile::restore now takes the box registry that Control::bind receives, and reconciles each key's boxes= set against it. It writes an info log line for each key that it frees, with its kid. A retired key that it revokes gets the existing retire_unused info line. In bep serve the box registry is always empty at bind: bep serve stops with the minvmd that started it (supervisor.rs), and nothing registers a box again after a restart. So at each start of bep serve every key is free, and every retired key is revoked. This matches the fact that a box from before the restart cannot redeem anyway, because the redeemer refuses a box that is not registered. An embedder that registers boxes before bind keeps those keys in use. The existing test the_registry_bound_never_drops_a_key_a_running_box_uses now registers boxes X and Y before its restart, so that its 'use survives a restart' step still holds. The spec's BEP-063 known-gap clause (the only #2617 link) now states the new behaviour and names the test. Vale is not installed on this box, so just lint-prose did not run. I also ran cargo nextest run -p bep control:: (14 passed) and cargo clippy -p bep --all-targets (clean).
Layer exception
The epic owner accepted these files outside T90's layers on 2026-10-27, for the design ruling that a stranded box's key is freed only on
minvmd's live set (round 2):crates/minvmd/src/box_registry.rs:BoxRegistry::live_box_idsandBoxRegistry::send_live_boxes, with the testlive_boxes_names_every_box_the_registry_holds.crates/minvmd/src/cmd/run.rs: thebepwatcher sendslive_boxeswhen the proxy starts to listen, with the testproxy_gets_the_live_box_ids_when_it_starts_to_listen.Tests
cargo nextest run -p bep a_stranded_box_frees_its_key_at_startVerify
min task run agent-verifypassed ([tasks.verify]).Closes #2617
Generated by Claude Code