8000 T119 — Deliver cohort connections and redeem them for the named box by minimal-foundry[bot] · Pull Request #3065 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T119 — Deliver cohort connections and redeem them for the named box - #3065

Merged
norrietaylor merged 6 commits into
mainfrom
agent/2855-deliver-cohort-connections-and-redeem-them-for-t
Nov 5, 2026
Merged

norrietaylor merged 6 commits into
mainfrom
agent/2855-deliver-cohort-connections-and-redeem-them-for-t

Conversation

@minimal-foundry
@minimal-foundry minimal-foundry Bot commented Nov 5, 2026 •
Copy link
Copy Markdown
Contributor

T119 — Deliver cohort connections and redeem them for the named box

slice: S17
kind: task
covers: BEP-084
size: L
est: 260 code, 360 tests
executor: agent
difficulty: unknown ground
model: strongest
diagnostics: min box audit <box> shows a host-address box's requests marked cohort_attributed under the box the sealed value names, with that box's egress verdict
observability: the proxy's existing audit record carries the attribution, box or cohort, and the subject box id it was evaluated for
layers:
- delivery:
- crates/switch/src/bep_host.rs: while the cohort's lane is open, the node address holds a share of the connection pool, box_id_for_source answers the cohort for it, and the delivery header carries the reserved cohort id, never a member's id
- crates/minvmd/src/box_registry. 8000 rs: the box_id_for_source impl answers the cohort for the node address while a lane member is resident
- crates/minvmd/src/cmd/run.rs: the second box_id_for_source impl answers the same
- crates/bep/src/listener.rs: the header doc and its parse name the reserved cohort id, which maps to Attribution::HostIpCohort
test: cargo nextest run -p switch cohort_delivery_names_no_box
- redeem:
- crates/bep/src/redeemer.rs: under Attribution::HostIpCohort the egress re-check and the audit subject read the box the sealed value names, which must be a live host_ip box of this host; a value naming an own_ip box, an ended box or a box of another host is refused and audited cohort_misattributed
test: cargo nextest run -p bep cohort_redemption_uses_named_box_egress_and_subject
test: cargo nextest run -p bep cohort_value_naming_no_live_host_ip_box_is_refused
produces:
- cohort-attributed delivery
consumes:
- the cohort's proxy lane at the host gate
- the revocation of an ended host-address grant box
proof: A host-address box's request through the proxy is admitted for the box its sealed value names, checked against that box's egress, and recorded in that box's audit log as cohort-attributed.
depends on:
- blocked by #2854
- blocked by #3032

Proof

A host_ip box's request through the proxy on a VM host arrives under the reserved cohort id (ffffffffffffffffffffffffffffffff), never a member's id. The proxy admits it for the live host_ip box that its sealed value names, and checks it against that box's declared egress. The audit record names that box as its subject and carries the marker cohort_attributed, so min box audit <box> lists it under that box. A value that names an own_ip box, an ended box or another host's box is refused, and the refusal is recorded as cohort_misattributed.

Notes from the agent: Out of layers: crates/bep/src/forward.rs. The audit record's subject comes from Flow::record in forward.rs, not from redeemer.rs, so the proof was not possible inside the layers. The change is the smallest that I found. It adds a default trait method Redeemer::audit_subject, which returns the flow's box, and Flow::record_for. The sealed-value branch and inject_store now record under that subject. BoxRedeemer overrides audit_subject for cohort deliveries.

Design: the reserved cohort id is [0xff; 16] (switch::bep_host::COHORT_BOX_ID, mirrored as bep::listener::COHORT_BOX_ID and COHORT_BOX_ID_TEXT). It is the max UUID, which a UUIDv7 mint never gives. BepBoxSource has a new default method, cohort_source(). It gives the node address while a resident host_ip box declares a credentialed upstream (RegisteredBoxes), and only while the acceptor listens (CredentialedBoxes). The pool gives that address a share. Its deliveries carry COHORT_BOX_ID whatever box_id_for_source answers. Both impls also answer COHORT_BOX_ID for the node address while the lane is open.

The redeemer applies the new rules only to cohort deliveries. The older path, where a member id with the HostIp stance arrives, keeps its behaviour (cross_box), so the existing proptest is unchanged. For a cohort delivery, Redeemer::egress (the forwarder's plain pre-check) gives the union of the live host_ip boxes' egress, which is the reach of the…[truncated]

Tests

line exit tail
cargo nextest run -p switch cohort_delivery_names_no_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-02f7... Compiling switch v0.0.1 (/workbench/crates/switch) Finished 'test' profile [unoptimized] target(s) in 8.87s ──────────── Nextest run ID c1eece4f-344d-4a5a-a663-0c7489ce16e5 with
cargo nextest run -p bep cohort_redemption_uses_named_box_egress_and_subject 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-f5c2... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling client-config v0.0.1 (/workbench/crates/client-config) Compiling bep v0.0.1 (/workbench/crates/bep) Finished 'test
cargo nextest run -p bep cohort_value_naming_no_live_host_ip_box_is_refused 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-2b5b... Finished 'test' profile [unoptimized] target(s) in 0.42s ──────────── Nextest run ID 403de3d6-b49a-4820-af4d-b07e48c254cc with nextest profile: default Starting 1 test across 2

Verify

min task run agent-verify passed ([tasks.verify]).

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/bep/src/forward.rs

Closes #2855

Residuals

While a resident host_ip box declares a credentialed upstream, the node
address holds a share of the proxy pool. Its deliveries carry the
reserved cohort id, never a member's id (BEP-084).
A request on a host_ip cohort delivery is checked against the egress of
the live host_ip box its sealed value names, and audited under that box.
A value naming no such box is refused cohort_misattributed (BEP-084).
@coderabbitai
coderabbitai Bot commented Nov 5, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e0453c7-6469-42e1-88a9-e559592ae82f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry
minimal-foundry Bot commented Nov 5, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 632683e59ca6.

@norrietaylor resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

10000
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 2 findings, 2 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/bep/src/redeemer.rs Resolved
Comment thread crates/bep/src/redeemer.rs Resolved
@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS · the full ruling

The change conforms to Gatehouse §6.10 line 823. A cohort delivery carries the reserved cohort id and no member id. The proxy checks the egress of the box that the value names, and the audit record names that box. A value that names no live host_ip box of this host is refused cohort_misattributed. The gate admits only cohort-marked frames from the node address to the proxy, so the new pool share does not open the proxy to the node plane. The edit to crates/bep/src/forward.rs is outside the task's layers but stays in the crate that owns the audit record. That is not a design deviation.

Ruled at d07139a against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

The audit subject of a cohort delivery came from a second read of the
cohort, after the verdict's own read. A box that ended or started between
the two reads gave a record that named a different box than the verdict.
redeem_attributed now gives the subject from the same facts as the verdict.
@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS · the full ruling

This change conforms to Gatehouse §6.10 line 823. The new commit takes the audit subject from the same cohort read as the verdict. Thus the record always names the box that the verdict was reached for, as the cohort_attributed audit sentence requires. The delivery files did not change since the PASS on d07139a, and that ruling stands for them. No conditions.

Ruled at 632683e against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-foundry[bot] crates/bep/src/redeemer.rs, minimal-foundry[bot] crates/bep/src/redeemer.rs. No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as 632683e59ca6.

line exit tail
cargo nextest run -p switch cohort_delivery_names_no_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-d307... Compiling switch v0.0.1 (/workbench/crates/switch) Finished 'test' profile [unoptimized] target(s) in 11.86s ──────────── Nextest run ID 86e093fc-1b9b-4bef-93dd-c337ed92394f with
cargo nextest run -p bep cohort_redemption_uses_named_box_egress_and_subject 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-422f... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling client-config v0.0.1 (/workbench/crates/client-config) Compiling bep v0.0.1 (/workbench/crates/bep) Finished 'test
cargo nextest run -p bep cohort_value_naming_no_live_host_ip_box_is_refused 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-97f1... Finished 'test' profile [unoptimized] target(s) in 0.45s ──────────── Nextest run ID 0aff6cd0-f08c-46d2-befc-7b9fd066a95f with nextest profile: default Starting 1 test across 2

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

invmd net::egress_gate::tests::admitted_runtime_port_reaches_the_box_through_the_gate
        PASS [   0.030s] ( 730/1062) minvmd net::egress_gate::tests::admitted_runtime_udp_port_does_not_admit_tcp
        PASS [   0.020s] ( 731/1062) minvmd net::egress_gate::tests::an_admitted_probe_round_is_relayed_as_its_canonical_request
        PASS [   0.028s] ( 732/1062) minvmd net::egress_gate::tests::an_expose_on_the_boxs_leased_loopback_publishes_when_the_listener_is_declared
        PASS [   1.988s] ( 733/1062) minvmd net::egress_gate::tests::a_stalled_relay_leaves_another_relay_flowing
        PASS [   0.017s] ( 734/1062) minvmd net::egress_gate::tests::an_interim_publications_teardown_is_keyed_at_its_own_address
        PASS [   0.069s] ( 735/1062) minvmd net::egress_gate::tests::an_unanswered_hand_over_expose_is_retried_until_it_is_answered
        PASS [   0.044s] ( 736/1062) minvmd net::egress_gate::tests::an_unanswered_hand_over_expose_keeps_its_attribution
        PASS [   0.019s] ( 737/1062) minvmd net::egress_gate::tests::an_unanswered_hand_over_is_unbound_by_its_withdrawn_row
        PASS [   0.040s] ( 738/1062) minvmd net::egress_gate::tests::an_unbind_that_keeps_failing_gives_up_and_keeps_the_address_held
        PASS [   0.018s] ( 739/1062) minvmd net::egress_gate::tests::an_unbind_the_switch_says_was_not_bound_counts_as_done
        PASS [   0.016s] ( 740/1062) minvmd net::egress_gate::tests::baseline_set_never_admits_the_proxy_address
        FAIL [   5.027s] ( 741/1062) minvmd net::egress_gate::tests::a_query_dropped_at_the_queue_is_not_observed
  stdout ───

    running 1 test
    test net::egress_gate::tests::a_query_dropped_at_the_queue_is_not_observed ... FAILED

    failures:

    failures:
        net::egress_gate::tests::a_query_dropped_at_the_queue_is_not_observed

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 698 filtered out; finished in 5.01s

  stderr ───

    thread 'net::egress_gate::tests::a_query_dropped_at_the_queue_is_not_observed' (12121) panicked at crates/minvmd/src/net/egress_gate.rs:20362:9:
    the guest side keeps draining; it does not wedge
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   0.328s] ( 742/1062) minvmd net::egress_gate::tests::box_cannot_reach_switch_api
        PASS [   2.219s] ( 743/1062) minvmd net::egress_gate::tests::an_idle_reloaded_box_s_attach_announce_stands_its_row_past_the_bound
        PASS [   3.698s] ( 744/1062) minvmd net::egress_gate::tests::a_stalled_switch_does_not_hold_the_relay_past_a_guest_close
────────────
     Summary [  47.574s] 744/1062 tests run: 743 passed (1 leaky), 1 failed, 2 skipped
        FAIL [   5.027s] ( 741/1062) minvmd net::egress_gate::tests::a_query_dropped_at_the_queue_is_not_observed
warning: 318/1062 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/bep/src/forward.rs

Converted to a draft: something above needs a person before review.

Review threads the coder judged:

  • 👎 invalid — crates/bep/src/redeemer.rs: The union is deliberate. BEP-083 and networking §4.3 rule 2 give the shared cohort address the union of its members' rules as its network reach, and T28 records that residual. So an unsealed request gains no reach that the box does not have directly. BEP-030 needs unsealed requests to pass through,
  • 👍 valid — crates/bep/src/redeemer.rs: Removed audit_subject. The new Redeemer::redeem_attributed returns the subject from the same facts() call, and the same cohort read, as the verdict. forward.rs uses that subject for the record.

A request from a host-address box through the proxy is admitted for the box its sealed value names and checked against that box's egress. min box audit shows the request in that box's audit log, marked cohort_attributed. The record now always names the box the verdict was reached for.

Notes from the agent: Revise round 1. crates/bep/src/forward.rs is not in the task's layers. An earlier round of this PR touched it to add the audit-subject hook. This round replaces the trait method audit_subject with redeem_attributed, which returns the subject with the verdict from one facts() call. No test pins the race between two cohort reads, because the cohort snapshot cannot be changed between the calls from a test without a hook. The existing subject tests still pass.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 5, 2026 22:06
@norrietaylor
norrietaylor marked this pull request as ready for review November 5, 2026 22:17
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of 632683e59ca6 withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 5, 2026
@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate passed at 632683e under the standing gate-4 rule.

@norrietaylor
norrietaylor added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 8bf14c5 Nov 5, 2026
36 checks passed
@norrietaylor
norrietaylor deleted the agent/2855-deliver-cohort-connections-and-redeem-them-for-t branch November 5, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T119 — Deliver cohort connections and redeem them for the named box

1 participant

0