Skip to content

T70 — Shape every egress refusal from one builder in the switch crate - #1858

Merged
norrietaylor merged 25 commits into
mainfrom
agent/1800-shape-every-egress-refusal-from-one-builder-in-t
Oct 4, 2026
Merged

norrietaylor merged 25 commits into
mainfrom
agent/1800-shape-every-egress-refusal-from-one-builder-in-t

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Plan block (v3)

### T70 — Shape every egress refusal from one builder in the switch crate
  slice: S9
  kind: task
  covers: NET-014
  size: M
  est: 320 code, 300 tests
  executor: agent
  difficulty: needs care
  model: strongest
  diagnostics: the bundle's VM host daemon log tail and the daemon log tail carry each refusal in the one line format (rule, address, port or name, reason), so a refusal shaped on either leg reads the same in a bundle
  observability: one rate-limited warn log line per refusal class per source from whichever leg refused, in the shared format, carrying the real count of refusals for that source in the window (N refusals read N); no line per reset
  layers:
    - switch:
      - crates/switch/src/refusal.rs (new): feature-free and bytes only; classifies a frame by source address, L4 protocol and whether it is a SYN or a first packet; builds the reset for a refused TCP segment under RFC 793 section 3.4 (a SYN is answered with sequence 0, acknowledgement its sequence plus its data length plus one and RST|ACK set; a segment carrying ACK is answered with sequence equal to its acknowledgement and RST alone); the bounded, rate-limited refusal emitter: its limiter map is fixed-size with LRU eviction, a refusal from a source no row holds collapses into one bucket keyed by rule alone with the source in the line, and its bound is per source (a per-source partition or quota, never one shared channel a single box can fill), so a flooder loses only its own refusals and a sibling's are untouched; the one audit-line format naming rule, address, port or name and reason, carrying the real count of refusals for that source in the window instead of a line per reset; no constant or builder without a production caller
      - crates/switch/src/lib.rs: declares the module
      test: cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack
      test: cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data
      test: cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited
      test: cargo nextest run -p switch refusal_limiter_key_space_is_bounded
      test: cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason
      test: cargo nextest run -p switch refusal_line_carries_the_window_count
    - daemon:
      - crates/minimald/src/net/switch.rs: the native relay leg and the in-VM gate leg both call the shared classifier, builder, emitter and line format; the daemon's own reset builder and refusal line are deleted and its reset writer keeps only the transport framing; the revoked-port arm keeps its log line whether or not a reset is built; the in-VM equality test drives the gate leg's own refusal path (refuse_tcp_segment on the gate leg) and compares the bytes it writes to the shared builder's; the verdict call into the sessions crate is unchanged
      - crates/switch/src/bep_host.rs: the stack peer's pre-screen refusals (no row, foreign MAC, share spent) build their reset through the shared builder with leg_mac as the source MAC, never the incoming frame's destination MAC, and emit through the shared emitter and line format under the same per-source bound, the fourth caller; smoltcp's own unlistened-port RST and ICMP replies are active rejects, one per probe, and stay outside the emitter
      test: cargo nextest run -p minimald unpublished_port_connection_refused
      test: cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder
      test: cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder
      test: cargo nextest run -p minimald revoked_port_refusal_is_logged
      test: cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter
      test: cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac
    - e2e:
      - scripts/session-e2e.sh: adds the case unpublished_port_refused_on_vm_host, run on the VM lanes: on a VM-backed host, a peer box connects to a box's unpublished port and gets connection refused within 5 s, not a timeout, and, where a published name reaches the box from the host, the host connects through it to an unpublished port with the same result, so the host gate's pass-through is shown delivering the SYN to the relay that resets it
      test: ./scripts/session-e2e.sh unpublished_port_refused_on_vm_host
  produces:
    - crates/switch/src/refusal.rs
  consumes:
    - crates/minvmd/src/net/egress_gate.rs
    - crates/minimald/src/net/switch.rs
    - crates/switch/src/bep_host.rs
    - crates/sessions/src/core/egress.rs
  proof: One builder in the switch crate shapes every TCP refusal, and each caller's output is compared against it, not against itself: the native relay and the in-VM gate leg, each driven on its own path, answer the same frame with the byte-identical reset, and the stack peer's pre-screen reset matches it with leg_mac as its source; on a VM-backed host a connection to a box's unpublished port is refused within 5 s on the VM lanes, the in-guest relay resetting a SYN the host gate passed through; a foreign source and a denied egress rule still drop silently; and every refusal is one rate-limited line in the one format on whichever leg refused it, carrying the window's real count, bounded per source so one flooding box starves no sibling's refusals.
  depends on:
    - blocked by gominimal/minimal#1652
    - blocked by gominimal/minimal#1708
    - blocked by gominimal/minimal#1711
    - blocked by gominimal/minimal#1657

State

Round 1 hit the coder's time limit; its snapshot commit 17dba91 is that round's work as it stood, not a finished step. Round 3 timed out before the e2e layer; round 4 added it. Every v3 test line passes at the head.

Proof

One builder in the switch crate shapes every TCP refusal, and each caller's output is compared against it, not against itself: the native relay and the in-VM gate leg, each driven on its own path, answer the same frame with the byte-identical reset, and the stack peer's pre-screen reset matches it with leg_mac as its source; on a VM-backed host a connection to a box's unpublished port is refused within 5 s on the VM lanes, the in-guest relay resetting a SYN the host gate passed through; a foreign source and a denied egress rule still drop silently; and every refusal is one rate-limited line in the one format on whichever leg refused it, carrying the window's real count, bounded per source so one flooding box starves no sibling's refusals.

Tests

line exit note
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0
cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data 0
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0
cargo nextest run -p switch refusal_line_carries_the_window_count 0
cargo nextest run -p minimald unpublished_port_connection_refused 0
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0
cargo nextest run -p minimald revoked_port_refusal_is_logged 0
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0
cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac 0
./scripts/session-e2e.sh unpublished_port_refused_on_vm_host 0 skipped in the coder's sandbox (no KVM); ran in CI and passed: test-kvm, macOS e2e

Deviations

  • The window's reset count is reported on the opening line of the next window, not as a separate closing line.
  • RST stragglers on a port whose publication was revoked are not logged.
  • crates/minimald/src/net/dns_gate.rs carries two payload_len: 0 test-literal lines outside the plan block's layers, added in round 3 alongside the shared-builder change.
  • smoltcp's own reset and port-unreachable for an unlistened port stay outside the shared emitter, as the plan block says.
  • The e2e case's host leg (connect through a published name from the host) is WHERE-gated: the name does not resolve on either CI lane today, so it skipped on both, and the host gate pass-through is not proven by e2e. The peer leg ran on both lanes: refused in under 100 ms (curl exit 7) with the switch's no ingress mapping audit line.

Verify

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

Base

Merged main at 2003e16 (main d78716e).

Closes #1800

Every leg that refuses a connection — the daemon's switch relay, its
per-session gate, the VM host's egress gate, the box egress proxy's
stack peer — builds its reply and its audit line through this module
(NET-014, NET-081):

- classify() reads one frame into a Segment: the one parser, so every
  leg agrees on what a frame is before any of them answers it.
- refused_tcp_reset() builds RFC 793 §3.4's two shapes: a bare SYN is
  answered from sequence zero, acknowledging it, with RST|ACK; a
  segment carrying ACK is answered with its own acknowledgement as
  sequence and RST alone. refused_udp_port_unreachable() builds the
  type 3 code 3 ICMP that quotes the datagram's IPv4 header and the
  first eight payload bytes.
- RefusalEmitter bounds and rates every refusal per source — a
  fixed-size row table with expired-LRU eviction, one overflow bucket
  per rule when every row is live, and a per-window quota per row, so
  a flooder loses only its own refusals — and renders the one audit
  line, which carries the count of replies written to that source this
  window instead of one line per reply.
The daemon's reset builder, its checksum helpers and its per-source
ResetBudget are deleted: the native relay leg and the in-VM gate leg
— the one spawn_relay both attachment paths funnel into — now build
their resets with switch::refusal's builders and audit every refusal
through its shared RefusalEmitter (NET-014, NET-121).

- L4Packet is the shared crate's Segment, re-exported under the name
  this module's readers use; parse_ipv4_l4 is its classify() in one
  line. The revocation resets keep their wire shapes: the gate's
  tracked-tail arithmetic stays, the byte assembly moves to the
  shared tcp_reset_frame().
- refuse_tcp_segment takes the refusal's Class and consults the
  emitter after it has a reset to write: a segment the gate can build
  nothing for spends nothing. The relay arms drop their limiter line
  for TCP refusals — the emitter says the one shared line when a
  source's window opens and when its quota is spent — and the UDP
  ingress drop keeps the drop limiter's own vocabulary.
- The gate's wire end-to-end and its decision unit are each compared
  against the shared builder byte for byte
  (native_relay_refusal_matches_the_shared_builder,
  in_vm_gate_refusal_matches_the_shared_builder), and the audit tests
  assert the shared line format end to end.
… ran out

the coder's uncommitted work as it stood when its 7200s ran out

The coder was stopped at the end of its time with these changes
not committed. The runtime committed its working tree as it stood so
the work is kept: this commit is a snapshot, not a finished step, and
may not build or pass its tests.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

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

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42d80ade-bbed-4587-973e-d12a75a92ba4

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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

main's delivery PR rewrote bep_host around the listener pool: the leg now
holds sockets of its own and every frame it accepts goes through the
interface, so the unlistened-port reset and the UDP port-unreachable are
smoltcp's own answers and the hand-rolled paths this branch had charged to
the shared refusal audit no longer exist as hand-rolled ones.

The resolution keeps main's pool and moves the shared audit onto the
refusals that stay the peer's own — the pre-screen's, a connection attempt
from a source no row holds, from a MAC the switch would never lease to its
address, or from a source already holding its share's cap. Those now say
the one shared line format, bounded per source, and the reset they answer
with is the shared builder's, so the peer stays the fourth caller of the
shared refusal audit.

The conflicted path was crates/switch/src/bep_host.rs; every other path
merged cleanly.
…s audit

The shared refusal audit gains the three classes the box egress proxy's
pre-screen refuses under — no registered row, a foreign source MAC, a
spent per-source share — and the stack peer's test that pins the fourth
caller: the reset a refused SYN is answered with is the shared builder's,
byte for byte; the line it says is the one shared format, naming the
rule, the address, the port and the reason with the count of resets
written to that source this window; and the bound is per source, so a
box that floods the proxy address loses only its own replies while a
sibling's are untouched.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a conflict with the base branch, pushed as 209111352b5a.

Resolved conflicts in: crates/switch/src/bep_host.rs

line exit tail
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-7d6a... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/1e33c/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 1.16s ──────────── Nextest run ID
cargo nextest run -p switch refusal_icmp_port_unreachable_quotes_the_datagram 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-0d6f... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID 83834995-9efd-4a05-ae54-e87345a3ba2c with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-7bbd... Finished 'test' profile [unoptimized] target(s) in 0.15s ──────────── Nextest run ID ad2dfcf9-9c57-412c-9226-a5ede9c3c8eb with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-b48f... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID 539dd02e-9dd0-462d-94cb-d9c44a19766f with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-e3a3... Finished 'test' profile [unoptimized] target(s) in 0.15s ──────────── Nextest run ID 002d0d1e-d3b6-4837-8447-4ff5ea88cdf8 with nextest profile: default Starting 1 test across 1
cargo nextest run -p minvmd host_gate_resets_syn_to_unadmitted_port 4 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-f449... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/7a9b4/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/7a9b4/tree/crates/ot) C
cargo nextest run -p minvmd host_side_rules_applied_outside_vm 0 Applying loadouts: default Running task runtime-implement-test-6 in session task-runtime-implement-test-6-5260... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/103cb/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/103cb/tree/crates/
cargo nextest run -p minvmd unknown_source_default_deny 0 Applying loadouts: default Running task runtime-implement-test-7 in session task-runtime-implement-test-7-f7ac... Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/b6959/tree/crates/version) Compiling mlog v0.0.1 (/home/runner/.local/state/minimal/sessions/b6959/tree/crates/
cargo nextest run -p minimald unpublished_port_connection_refused 0 Applying loadouts: default Running task runtime-implement-test-8 in session task-runtime-implement-test-8-334e... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/7205c/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/7205c/tree/crates/args) C
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-9 in session task-runtime-implement-test-9-f8c9... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/45bb6/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/45bb6/tree/crate
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-10 in session task-runtime-implement-test-10-4118... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/aee2c/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/aee2c/tree/cra
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0 Applying loadouts: default Running task runtime-implement-test-11 in session task-runtime-implement-test-11-136d... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/385f0/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 3.27s ──────────── Nextest run

Verify min task run agent-verify passed.

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

One builder in the switch crate now shapes every refusal the four callers still author: the stack peer's pre-screen refusals answer with a reset byte-equal to the shared builder's and are charged to the shared per-source emitter in the one audit-line format, so a flooding box gets exactly two lines and sixteen resets in its window while a sibling's first refusal still gets its own reset and its own line; the native relay and the in-VM gate leg answer the same frame with the byte-identical reset, proven by their parity tests; and a refused UDP datagram gets one port-unreachable built by the same module. The proof's VM-host-gate clause is not delivered as written: a SYN toward a box address at an unpublished port still crosses the host gate verbatim and is refused by the target box's own guest minimald - a reset, not a timeout - rather than by the gate itself; the reasons are in notes.

Notes from the agent: Conflict round: the directive's one item is done. bep_host.rs is resolved against main's listener-pool rewrite (#1810) in merge commit b36a0cf; the branch's hand-rolled unlistened-port reset and port-unreachable no longer exist on main (smoltcp answers them), so the fourth caller was re-targeted onto the refusals that remain the peer's own - the pre-screen's three arms (no registered row, foreign source MAC, per-source share spent) - which now build their reset with refusal::refused_tcp_reset (byte-identical to main's own shape for a bare SYN, so no wire change) and charge the shared per-source emitter. enforce_caps, the acceptor-down reset and the dropped ARP claim keep main's WarnThrottle on purpose: an abort's reset comes from smoltcp and suppressing it would hang a withdrawn row's box, a failed delivery is not a rule's refusal, and a dropped claim writes no reply. ONE test line not run: 'cargo nextest run -p minvmd host_gate_resets_syn_to_unadmitted_port'. It is not implemented: main's gate decides nothing on ingress by design (egress_gate.rs: 'sw…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 3. The plan block on #1800 was amended after the architecture review: re-read it before you start. The host gate step is gone. The VM host gate passes ingress through untouched and holds no table of a box's own ports, so on a VM-backed host the in-guest relay's reset meets NET-014. The ICMP builder is out, the stack peer is scoped to its pre-screen, and there is one new e2e case. Scope: crates/switch/src/refusal.rs, crates/switch/src/bep_host.rs, crates/minimald/src/net/switch.rs, scripts/session-e2e.sh. Do not edit crates/minvmd/src/net/egress_gate.rs or anything in crates/sessions; the switch's-own-addresses clause moved to #1874.

  1. Remove what has no production caller. Delete refused_udp_port_unreachable and its test refusal_icmp_port_unreachable_quotes_the_datagram, and delete UNLISTENED_PROXY_PORT (refusal.rs:393-439). No task owns a UDP reject yet. Do not add a vmhost layer or host_gate_resets_syn_to_unadmitted_port.
  2. Make the in-VM equality test drive the in-VM path. in_vm_gate_refusal_matches_the_shared_builder (switch.rs:3075) currently calls the function both legs share, so it only proves the builder equals itself. Drive the gate leg's own refusal path (refuse_tcp_segment on the gate leg), capture the bytes it writes, and assert they are byte-equal to refusal::refused_tcp_reset for the same frame. native_relay_refusal_matches_the_shared_builder must do the same on the native leg.
  3. Report the real window count. The audit line's count can only be 1 or 16 today. It must carry the actual number of refusals for that source in the window. New test refusal_line_carries_the_window_count: send N refusals from one source inside one window and assert the emitted line reads N.
  4. Count a SYN's data in the RST|ACK. The acknowledgement for a SYN must be its sequence plus its data length plus one (RFC 793 section 3.4); refusal.rs:313-324 ignores the data length. New test refusal_rst_acks_a_syn_carrying_data: a SYN carrying 10 bytes is answered with ack = seq + 11. Keep refusal_rst_carries_rfc_seq_ack.
  5. Restore the revoked-port log line. The revoked-port arm no longer logs when no reset is built (switch.rs:2121 and :1326). The refusal must be logged through the shared emitter whether or not a reset frame is written. New test revoked_port_refusal_is_logged.
  6. Use leg_mac as the stack peer's reset source. Its pre-screen reset copies the incoming SYN's destination MAC as its source MAC, so a SYN sent to broadcast produces an invalid frame. Set the source MAC to leg_mac always. New test stack_peer_reset_source_is_leg_mac (--features stack-peer): a broadcast-destination SYN gets a reset whose source MAC is leg_mac. Leave smoltcp's own unlistened-port RST and ICMP replies outside the emitter, as the plan says.
  7. Add the VM-lane proof. In scripts/session-e2e.sh, add the case unpublished_port_refused_on_vm_host, run on the VM lanes:
    • On a VM-backed host, a peer box connects to another box's unpublished port and gets connection refused within 5 s, not a timeout.
    • Where a published name reaches the box from the host, the host connects through it to an unpublished port and gets the same result.
    • Print one transcript line per leg.
    • Use the script's existing proxy-env guard (env -u HTTP_PROXY ... -u no_proxy) on any host-side curl.

Every test: line in the amended plan block must exist by that exact name and pass.

The reset a refusal writes now acknowledges a SYN's payload along with
its sequence weight (RFC 793 s3.4), and a caller that is not the link a
frame was addressed to writes its own MAC as the reset's source - the
shape the stack peer's pre-screen needs for a SYN sent to the broadcast.
The emitter says one line per (source, rule) per window, at the
window's first refusal, carrying the refusals that window saw - answered
or suppressed alike - instead of only the first and the quota's last.
The ICMP port-unreachable builder and its unlistened port rule are gone:
no production caller refuses a datagram yet.
The pre-screen's reset took its source MAC from the frame it refused,
so a SYN sent to the broadcast - which reaches the leg like any other,
since only its IP destination names the leg - produced a reset claiming
the broadcast's MAC, a frame no switch would forward. The reset is now
written from the leg's own MAC through the shared builder's leg-source
variant, and its audit line is the window's one: said at the window's
first refusal, never again for the flood that spends the quota.
The revoked-port arm bailed before the shared audit whenever no reset
frame could be built, so a spoofed segment to a revoked port — one the
gate holds no tail for — was refused silently: nothing on the wire,
nothing in the log. The audit is now consulted for every refusal, with
the reset's existence passed to it: the line is said at the window's
first refusal whether or not a reply was written, while a refusal with
no reply spends none of the source's quota and writes nothing back.

The two equality proofs now drive their own legs and capture the bytes
each writes — the native leg through the relay onto its wire, the
in-guest leg through the gate onto its channel — checked byte-for-byte
against the shared builder's frame and against the wire's own oracle
(addressing, flags, acknowledgement arithmetic, checksum), so neither
is the builder against itself. rst_from_flow counts the flow's own
data in the reset it acknowledges, the way the shared builder now does,
and the quota proofs carry the window's real count.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 6 on a /revise note, pushed as e8b3ae2f750a.

The coder ran out of its 7200s before it finished. If it left work uncommitted, its last commit is the runtime's snapshot of that work as it stood — the commit message says so — and not a finished step: it may not build or pass its tests.

line exit tail
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-0ff5... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/4460a/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 1.33s ──────────── Nextest run ID
cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-0360... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID c91fe3a4-3032-4686-aba2-c1c46f70c2f7 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-5ceb... Finished 'test' profile [unoptimized] target(s) in 0.19s ──────────── Nextest run ID 7d13d611-c457-4b5d-8fa5-f494c5ae132b with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-d664... Finished 'test' profile [unoptimized] target(s) in 0.20s ──────────── Nextest run ID c6fe8599-c297-4ffe-ae4f-3849efe19f7c with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-0800... Finished 'test' profile [unoptimized] target(s) in 0.20s ──────────── Nextest run ID a32d749f-8c1a-49f2-91da-a8f940af6ec6 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_line_carries_the_window_count 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-4a60... Finished 'test' profile [unoptimized] target(s) in 0.21s ──────────── Nextest run ID 0711f741-8446-40a6-b277-92204bc67efb with nextest profile: default Starting 1 test across 1
cargo nextest run -p minimald unpublished_port_connection_refused 0 Applying loadouts: default Running task runtime-implement-test-6 in session task-runtime-implement-test-6-30f6... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/d7930/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/d7930/tree/crates/ot) C
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-7 in session task-runtime-implement-test-7-60cb... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/9bfb0/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/9bfb0/tree/crate
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-8 in session task-runtime-implement-test-8-029d... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/df371/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/df371/tree/crate
cargo nextest run -p minimald revoked_port_refusal_is_logged 0 Applying loadouts: default Running task runtime-implement-test-9 in session task-runtime-implement-test-9-81e3... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/52a61/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/52a61/tree/crate
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0 Applying loadouts: default Running task runtime-implement-test-10 in session task-runtime-implement-test-10-90f0... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/54dad/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 4.17s ──────────── Nextest run
cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac 0 Applying loadouts: default Running task runtime-implement-test-11 in session task-runtime-implement-test-11-51a5... Finished 'test' profile [unoptimized] target(s) in 0.22s ──────────── Nextest run ID cb2cdb39-f20b-4f94-97f8-98e5dd11d30e with nextest profile: default Starting 1 test across
./scripts/session-e2e.sh unpublished_port_refused_on_vm_host 2 no usable 'min' on PATH and no build under target/; building the pair this run drives (cargo build --locked -p minimal --bin min -p minimald --bin minimald) built the pair: /work/build-cache/target/debug/min and /work/build-cache/target/debug/minimald usage: ./scripts/session-e2e.sh [case] no argu

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minimald/src/net/dns_gate.rs

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

One builder in the switch crate shapes every TCP refusal, and each caller's output is compared against it, not against itself: the native relay and the in-VM gate leg, each driven on its own path, answer the same frame with the byte-identical reset, and the stack peer's pre-screen reset matches it with leg_mac as its source; on a VM-backed host a connection to a box's unpublished port is refused within 5 s on the VM lanes, the in-guest relay resetting a SYN the host gate passed through; a foreign source and a denied egress rule still drop silently; and every refusal is one rate-limited line in the one format on whichever leg refused it, carrying the window's real count, bounded per source so one flooding box starves no sibling's refusals.

@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 4. Round 3 completed asks 1 to 6. It never started ask 7, the e2e layer: scripts/session-e2e.sh is untouched and unpublished_port_refused_on_vm_host doesn't exist. This round has one ask.

  1. Add the VM-lane e2e case. This is round-3 ask 7, which was not started. scripts/session-e2e.sh has no unpublished_port_refused_on_vm_host at e8b3ae2, and the PR diff does not touch the script. Merge main first: main moved scripts/session-e2e.sh by about 1.4k lines since the merge-base 3bf6b09 (T62 — Allow github.com and nothing else, end to end #1838 and others), so add the case on top of main's version.
    • The case must be named exactly unpublished_port_refused_on_vm_host and run as ./scripts/session-e2e.sh unpublished_port_refused_on_vm_host on the VM lanes. If it is only ever invoked standalone, give it the standalone E2E_VM=1 / --provider local-minvmd defaulting that the case "${1:-}" block at session-e2e.sh:166 gives the KVM cases.
    • Peer leg: on a VM-backed host, a peer box connects to another box's unpublished port and gets connection refused within 5 s, not a timeout.
    • Host leg: where a published name reaches the box from the host, the host connects through it to an unpublished port and gets the same result. This is the leg that shows the host gate's pass-through delivering the SYN to the in-guest relay that resets it.
    • Print one transcript line per leg. Use the script's existing proxy-env guard (env -u HTTP_PROXY -u HTTPS_PROXY -u http_proxy -u https_proxy ..., as at session-e2e.sh:5141/5883 on main) on every host-side curl.
    • File scope: scripts/session-e2e.sh only. Touch nothing in Rust.

Add the unpublished_port_refused_on_vm_host case to
scripts/session-e2e.sh (T70's e2e half, NET-014's VM-lane half): on a
VM-backed host, a peer box's connect to another box's unpublished
port must be refused within 5 s - curl exit 7, the kernel's own
connection-refused shape - never the connect timeout a silent drop
reads as; and where a published name reaches the box from the host,
the host's own connect through that name to the unpublished port
gets the same refusal, the leg that shows the host gate passing a
host-originated SYN through to the in-guest relay that resets it.

Each leg completes its control in the same run first - the peer
reaches the target's published port by the same name, the host
reaches it through the name - so the refusal reads as the port's
own and not weather. The host leg's control is the requirement's
WHERE clause: on a lane whose host resolver is not pointed at the
box zone's answerer it prints the observed fact and asserts nothing.
Each leg prints one transcript line, and beneath it the window the
in-guest daemon's log gained - the one shared refusal audit line,
read from the guest boot log with the console's SGR codes stripped.

The case self-skips off the VM lanes (a native relay's refusal is
the github-only case's zone legs), without a switch, and - on
Linux only - on hosts with no writable /dev/kvm, the fresh-install
KVM cases' criterion scoped to the OS where it is the right one,
since the macOS lane hypervises without it.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 6 on a /revise note, pushed as 2003e16a9aca.

line exit tail
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-393f... Downloading crates ... Downloaded bit-set v0.8.0 Downloaded chacha20poly1305 v0.10.1 Downloaded aead v0.5.2 Downloaded chacha20 v0.9.1 Downloaded cipher v0.4.4 Downloaded ax
cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-afaf... Finished 'test' profile [unoptimized] target(s) in 0.17s ──────────── Nextest run ID 80fd5fd7-a570-4785-8c29-53280e832aec with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-d60e... Finished 'test' profile [unoptimized] target(s) in 0.21s ──────────── Nextest run ID bd5192c5-80dc-4f9b-9f22-5e9de8685eac with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-5e6c... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID d596c3af-65f6-40d1-94ad-6f3bcc008f89 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-2207... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID 3dbedce0-51e0-4f31-bb63-7db9cdd112ad with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_line_carries_the_window_count 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-c86a... Finished 'test' profile [unoptimized] target(s) in 0.18s ──────────── Nextest run ID ccdc326b-1738-4d3f-8694-3d698f070789 with nextest profile: default Starting 1 test across 1
cargo nextest run -p minimald unpublished_port_connection_refused 0 local/state/minimal/sessions/85c82/tree/crates/ot) Compiling paths v0.0.1 (/home/runner/.local/state/minimal/sessions/85c82/tree/crates/paths) Compiling google-cloud-longrunning v1.14.0 Compiling google-cloud-lro v1.11.0 Compiling google-cloud-iam-v1 v1.13.0 Compiling stdlib v0.0.21 (
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-7 in session task-runtime-implement-test-7-733c... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/d0059/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/d0059/tree/crate
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-8 in session task-runtime-implement-test-8-ca4c... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/ca205/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/ca205/tree/crate
cargo nextest run -p minimald revoked_port_refusal_is_logged 0 Applying loadouts: default Running task runtime-implement-test-9 in session task-runtime-implement-test-9-7f4f... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/68b24/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/68b24/tree/crate
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0 Applying loadouts: default Running task runtime-implement-test-10 in session task-runtime-implement-test-10-67d0... Compiling byteorder v1.5.0 Compiling syn v3.0.3 Compiling syn v2.0.119 Compiling errno v0.3.14 Compiling signal-hook-registry v1.4.8 Compiling hash32 v0.3.1 Compil
cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac 0 Applying loadouts: default Running task runtime-implement-test-11 in session task-runtime-implement-test-11-29fa... Finished 'test' profile [unoptimized] target(s) in 0.22s ──────────── Nextest run ID 39d57ad1-10b2-46cd-8caf-772ab6795d58 with nextest profile: default Starting 1 test across
./scripts/session-e2e.sh unpublished_port_refused_on_vm_host 0 ::group::an unpublished port is refused on a VM-backed host (NET-014) unpublished-port refusal on a VM host SKIPPED (no writable /dev/kvm: a Linux VM boots on KVM and this host has none — the case drives a VM-backed host, and a native host's own refusal is the github-only case's zone legs, not this

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minimald/src/net/dns_gate.rs

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

The session e2e now has an unpublished_port_refused_on_vm_host case, run by name or in the whole-lane order on the VM lanes: on a VM-backed host a peer box's connect to another box's unpublished port is refused within 5 s (curl exit 7, never the timeout), and where a published name reaches the box from the host, the host's own connect through that name gets the same refusal — the host gate's pass-through delivering the SYN to the in-guest relay that resets it — each leg with its control completed in the same run and the one shared refusal audit line printed from the guest boot-log window beneath it.

Notes from the agent: The VM legs cannot run on this box (no /dev/kvm, no libkrun, no gvproxy, no guest images), so the real VM-lane run is owed by the ci-linux-kvm and macOS lanes, where the case runs in the whole-lane order between the github-only and proxy-source cases. What was verified here instead: (1) the test line itself runs — dispatches by name, standalone-defaults as the KVM cases do, and exits 0 with the case's own skip reason printed (needed one build the script would itself have done on an empty cache: cargo build --locked -p minvmd --bin minvmd, which compiles a runtime-bailing stub without libkrun, so the script's CLI gate passes); (2) bash -n and shellcheck 0.11.0 are clean on the whole script, with zero new alerts versus origin/main's copy; (3) every leg body was exercised by a /tmp-only stub harness (fake mnl, fake curl, fake uname, a fake guest boot log carrying an SGR-painted refusal record): the happy path prints one verified result line per leg with the SGR-stripped rule_matched="no ingress mapping" ... refusals=1 audit line in its window, and each failure branch fires its own ::error — peer/host answered, exit 28 (the timeout shape NET-014 retires), refusal slower than 5 s, control not completing, responder never up — plus the two honest host-leg skips (name did not resolve, curl exit 6; name resolved but the published port did no…[truncated]

@norrietaylor
norrietaylor marked this pull request as ready for review October 3, 2026 19:21
@norrietaylor
norrietaylor requested a review from a team as a code owner October 3, 2026 19:21
@minimal-foundry

minimal-foundry Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: no findings at 254089d44c8a.

Nothing to do.

Clobber: none: git log on the touched files shows only this PR's own commits, and the two minimal-foundry review threads (the per-leg flush and the no-reset early-return) are addressed at the head by the sweep-ahead-of-charge and the Drop flushes.

@norrietaylor

Copy link
Copy Markdown
Member

/revise

Round 5. ARCH design check at 2003e16: conditions. Everything else conforms. Three asks, nothing else. Scope: crates/switch/src/refusal.rs and scripts/session-e2e.sh only (plus the minimald caller if the expiry flush needs a call site). Merge main first.

  1. Emit the final window's count when no further refusal comes. The count now rides on the next window's opening line, which is accepted only if (a) that line says which window the count belongs to, and (b) the last window's count is not lost. When a limiter bucket's window expires, is evicted from the LRU, or the emitter is dropped at teardown with a pending count, emit one line in the shared format carrying that count. Test: cargo nextest run -p switch refusal_final_window_count_emitted_on_expiry sends N refusals from one source, then silence past the window. It forces the expiry with an injected clock, not a sleep, and asserts exactly one line reading N for that source and window. Add the matching LRU-eviction case to the same test or a sibling refusal_pending_count_emitted_on_eviction. Add both as test: lines in the result table.

  2. Re-aim the e2e host leg to connect by address, not name. Host-side forwarders bind only admitted ports, so a host SYN to an unpublished port is refused by the host kernel and never reaches the VM. The leg therefore proves the published address refuses fast. In unpublished_port_refused_on_vm_host, add a host leg that:

    • takes the box's published loopback address from min session policy or the start line;
    • picks a port the box has not published and that the e2e knows is free on the host (under the macOS 127.0.0.1 interim, choose one the script checks with a bind or connect probe first);
    • connects from the host with the proxy-env guard;
    • requires curl exit 7 (not 28) within 5 s.
      It must run, not skip, on both the test-kvm and macOS lanes. Keep the existing name-based leg as is, WHERE-gated.
  3. Make the OK line truthful. The case's final OK line (around session-e2e.sh:8083) claims the host's connect got the same refusal even when the name leg was skipped. Print each leg's outcome (refused / skipped with reason) on the OK line, or make the clause conditional.

Out of scope: no change to the reset builder, the stack peer, the in-VM or native legs, or the revoked-port straggler behaviour (ruled conforming).

@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 — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 3, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 5 of 6 on a /revise note, pushed as a9f63d443bf9.

line exit tail
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-cf85... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/63980/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 1.68s ──────────── Nextest run ID
cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-d7d1... Finished 'test' profile [unoptimized] target(s) in 0.21s ──────────── Nextest run ID 3fb10087-41fa-44fc-816b-1cc0fa446486 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-0476... Finished 'test' profile [unoptimized] target(s) in 0.26s ──────────── Nextest run ID 635e3054-e244-4f17-8412-dbad005ef964 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-2060... Finished 'test' profile [unoptimized] target(s) in 0.24s ──────────── Nextest run ID d1a5c3b4-823c-4ce0-b66f-53106607e653 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-84a6... Finished 'test' profile [unoptimized] target(s) in 0.19s ──────────── Nextest run ID ea5a7849-78b6-41eb-bbda-8b53d6949d98 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_line_carries_the_window_count 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-f7b4... Finished 'test' profile [unoptimized] target(s) in 0.25s ──────────── Nextest run ID e97d41fd-0d2d-4040-9aa1-e06de1a5ff2a with nextest profile: default Starting 1 test across 1
cargo nextest run -p minimald unpublished_port_connection_refused 0 Applying loadouts: default Running task runtime-implement-test-6 in session task-runtime-implement-test-6-0c89... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/32192/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/32192/tree/crates/ot) C
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-7 in session task-runtime-implement-test-7-cabf... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/b8952/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/b8952/tree/crate
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-8 in session task-runtime-implement-test-8-97c0... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/55443/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/55443/tree/crate
cargo nextest run -p minimald revoked_port_refusal_is_logged 0 Applying loadouts: default Running task runtime-implement-test-9 in session task-runtime-implement-test-9-f5df... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/2752c/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/2752c/tree/crate
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0 Applying loadouts: default Running task runtime-implement-test-10 in session task-runtime-implement-test-10-382f... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/ea48e/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 6.57s ──────────── Nextest run
cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac 0 Applying loadouts: default Running task runtime-implement-test-11 in session task-runtime-implement-test-11-5a9a... Finished 'test' profile [unoptimized] target(s) in 0.23s ──────────── Nextest run ID d914876c-0549-4d8c-8c61-5aa6cba75400 with nextest profile: default Starting 1 test across
./scripts/session-e2e.sh unpublished_port_refused_on_vm_host 0 ::group::an unpublished port is refused on a VM-backed host (NET-014) unpublished-port refusal on a VM host SKIPPED (no writable /dev/kvm: a Linux VM boots on KVM and this host has none — the case drives a VM-backed host, and a native host's own refusal is the github-only case's zone legs, not this

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minimald/src/net/dns_gate.rs

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

One builder in the switch crate shapes every TCP refusal, and every comparison is against it, not against itself: the native relay and the in-VM gate leg answer the same frame with the byte-identical reset, the stack peer's pre-screen reset matches it with leg_mac as its source, and on the VM lanes a connection to a box's unpublished port is refused within 5 s — now from the host by the box's published address too, after a probe proves the port free on that host, with each leg's own outcome (refused, or skipped with its reason) said on the case's OK line. A window whose last refusal never came — expired, LRU-evicted, or the emitter dropped at teardown — now says its final count as one line in the same format, so a source's refusals are never lost to silence; the count is the window's own (since_line + 1), clearing what the next window's opening line would have carried, so nothing is reported twice.

Notes from the agent: Three asks, three layers. (1) Final window count: Window now carries an owed sample (class/source/address/about, set on every counted refusal, cleared at roll) and the Limiter holds evicted windows' owed lines in a queue bounded at rows (drop-newest, so a drain's oldest line survives); flush_expired(now) and flush_pending() render each owed line in the shared format at since_line + 1 — the count the riding line would have carried — and clear since_line, so a window flushes exactly once and the next window's opening line reports from zero. The two new tests inject the clock (no sleeps): refusal_final_window_count_emitted_on_expiry (N refusals then silence past the window: exactly one line reading N for that source and window; the second flush is empty) and refusal_pending_count_emitted_on_eviction (eviction flushes the evicted source's 5; a second half proves the queue's cap drops the newest line at rows). (2) crates/minimald/src/net/switch.rs is the one file beyond the two named layers, and the directive's own scope l…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise

Round 6, the last. ARCH ruled on round 5's CI result: the host leg by address failed at its own control step on both VM lanes, because the registry's loopback_address (127.0.64.0) is not where the box is published. That allocation is a separate bug, filed as #1908 and #1909, and not yours to fix. Four asks, nothing else.

  1. Aim the host leg at the address the host answerer returns for the box's name. Query the answerer directly at its own port (dig @127.0.0.1 -p <answerer port> <name> +short, or the script's existing answerer-query helper if it has one), so no OS resolver hook is needed. Use that address for the control GET to the published port (18101).
    • If the control returns 200, run the refusal leg at that address on 18102 and require connection-refused within 5 s.
    • If the control does not return 200, skip the leg (a WHERE-gated skip) and print plainly: the VM host does not serve the box's published ports at its published address (<addr>). In that case the OK line must not claim the host leg.
    • Never fail the case on the host control alone.
  2. Stack-peer leg flushes (crates/switch/src/bep_host.rs). refuse_syn only calls refuse, and nothing in the file calls flush_expired or flush_pending, so the stack peer's final-window counts are never said.
    • In BepStack::poll, emit every line from self.refusals.flush_expired(Instant::now()). poll runs at least every POLL_DELAY, so expired windows are said on time.
    • Add impl Drop for BepStack that emits flush_pending(), mirroring SessionGate's Drop.
    • Test: a stack-peer burst that stops yields its owed line with the true count after the window passes, and a dropped stack yields its pending lines.
  3. The minimald relay's sweep (crates/minimald/src/net/switch.rs, SessionGate::refuse_tcp_segment, around L1408–1427). The audit line already prints before let Some(reset) = reset else { return false; }, but that early return skips the flush_expired sweep. So every unanswered refusal (a spoofed ACK, or a revoked flow with no held tail) misses it.
    • Restructure so the sweep always runs: match reset { Some(reset) => { send; true } None => false }, then the flush, then return.
    • Run the flush before refuse in both legs, so a rolled window's own count is said before the next window opens rather than folded into it.
    • Test: extend revoked_port_refusal_is_logged with a no-reset path after a window has expired, and assert the expired window's line is emitted.
  4. Nit: the case's error-path dump globs minvmd.log.*. Use minvmd.log*, as upr_host_log does, so the unsuffixed file is included.

Out of scope: a timer-driven flush on the minimald relay (it has no periodic hook; teardown and next-refusal flushing stay), the allocators, any change to how ports are published on a VM host, and the refusal builder itself. dns_gate.rs's two test literals stay as they are. Do not rewrite the PR body.

@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 3, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 7 would exceed the cap of 6 (the last trigger was a conflict with the base branch). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1800 by hand.

The relay leg's `let Some(reset) = reset else { return false; }` returned
before the expiry sweep, so every unanswered refusal — a spoofed segment
to a revoked port — skipped it, and a window that ended holding an unsaid
count was not flushed until a reset-producing refusal arrived or the gate
dropped. The sweep now runs ahead of the charge, so a rolled window's own
count is said at the window it belongs to rather than folded into the next
window's opening line, and no refusal path can return around it.

The stack peer leg charged its refusals and never swept at all: its final
windows were unsaid until the daemon ended. Its turn now opens with the
expiry sweep (poll runs at least every POLL_DELAY) and its own Drop says
every count its still-live windows hold, mirroring the gate's.
The host address leg connected by the box-registry record's
loopback_address, which is an allocation the forwarders do not bind at
(#1908) -- an address the leg could only ever time out at, and one whose
control failing took the whole case down with it. It now asks the host's
own zone answerer, straight at the port 'min ls' reports for it, for the
A record it holds for the box's name: the address the box's declaration
publishes at, the one the host-side forwarders bind. The question is one
datagram in python3 (the pty driver's dependency, no lane declares dig),
with the answer's reason on stderr when there is none.

The leg is WHERE-gated end to end now, like the name leg beside it: no
answerer line, no address for the name, a published port that does not
answer at it, or no candidate port nothing on the host answers -- each
says what it lacks and asserts nothing, and the control alone never
fails the case. The OK line carries the leg's own sentence, refused with
its address or skipped with its reason, so it can never claim a leg that
did not run. The registry's record stays in the transcript, labelled as
the registry's half of the pair; the error-path dump now globs
minvmd.log* so the unsuffixed log is read too, like upr_host_log does.
The case's header bullet still said the leg connects by the
registry record's loopback address and that the KVM lane runs no
host-side answerer; both were false after the last commit (the
forwarders publish the answerer on the host loopback, and the record's
address is one nothing binds at), so the bullet now names the answerer
as the address's source and the WHERE gate as the leg's shape.
Two inject_frame calls in the new test overran the line budget; rustfmt
splits them, nothing else changes.
…y-egress-refusal-from-one-builder-in-t

# Conflicts:
#	crates/minimald/src/net/switch.rs
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 6 of 6 on a /revise note, pushed as aca9625bce3b.

Resolved conflicts in: crates/minimald/src/net/switch.rs

line exit tail
cargo nextest run -p switch refusal_rst_carries_rfc_seq_ack 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-7108... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/5f698/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 1.66s ──────────── Nextest run ID
cargo nextest run -p switch refusal_rst_acks_a_syn_carrying_data 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-0a8a... Finished 'test' profile [unoptimized] target(s) in 0.20s ──────────── Nextest run ID a41f5505-fac2-4d52-a6aa-e791712b56bb with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_emitter_is_bounded_and_rate_limited 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-70fd... Finished 'test' profile [unoptimized] target(s) in 0.25s ──────────── Nextest run ID 1c906e4b-86d8-4d56-9e8c-04c76736a715 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_limiter_key_space_is_bounded 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-9b8a... Finished 'test' profile [unoptimized] target(s) in 0.25s ──────────── Nextest run ID a31aa584-d29a-4290-8b87-ff06bfe6090d with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_audit_line_names_rule_address_port_and_reason 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-2537... Finished 'test' profile [unoptimized] target(s) in 0.29s ──────────── Nextest run ID 2389bfa6-4cc7-4669-ab2c-5fd42258f498 with nextest profile: default Starting 1 test across 1
cargo nextest run -p switch refusal_line_carries_the_window_count 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-721c... Finished 'test' profile [unoptimized] target(s) in 0.23s ──────────── Nextest run ID 3f4f89c6-5569-40ba-9c85-e67799f20b3f with nextest profile: default Starting 1 test across 1
cargo nextest run -p minimald unpublished_port_connection_refused 0 Applying loadouts: default Running task runtime-implement-test-6 in session task-runtime-implement-test-6-a02c... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/7b90c/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/7b90c/tree/crates/ot) C
cargo nextest run -p minimald native_relay_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-7 in session task-runtime-implement-test-7-68ca... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/6f39e/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/6f39e/tree/crate
cargo nextest run -p minimald in_vm_gate_refusal_matches_the_shared_builder 0 Applying loadouts: default Running task runtime-implement-test-8 in session task-runtime-implement-test-8-867b... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/cd912/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/cd912/tree/crate
cargo nextest run -p minimald revoked_port_refusal_is_logged 0 Applying loadouts: default Running task runtime-implement-test-9 in session task-runtime-implement-test-9-8b31... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/c3a74/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/c3a74/tree/crate
cargo nextest run -p switch --features stack-peer stack_peer_refusals_use_the_shared_emitter 0 Applying loadouts: default Running task runtime-implement-test-10 in session task-runtime-implement-test-10-e284... Compiling switch v0.0.1 (/home/runner/.local/state/minimal/sessions/75ac3/tree/crates/switch) Finished 'test' profile [unoptimized] target(s) in 4.35s ──────────── Nextest run
cargo nextest run -p switch --features stack-peer stack_peer_reset_source_is_leg_mac 0 Applying loadouts: default Running task runtime-implement-test-11 in session task-runtime-implement-test-11-04eb... Finished 'test' profile [unoptimized] target(s) in 0.22s ──────────── Nextest run ID 36bfc85c-4d50-42bc-8bc8-858573781b2c with nextest profile: default Starting 1 test across
./scripts/session-e2e.sh unpublished_port_refused_on_vm_host 0 ::group::an unpublished port is refused on a VM-backed host (NET-014) unpublished-port refusal on a VM host SKIPPED (no writable /dev/kvm: a Linux VM boots on KVM and this host has none — the case drives a VM-backed host, and a native host's own refusal is the github-only case's zone legs, not this

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minimald/src/net/dns_gate.rs

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

Review threads the coder judged:

  • 👍 valid — crates/switch/src/bep_host.rs:1209: BepStack::poll now opens with flush_expired on the real clock and BepStack's Drop says flush_pending, mirroring SessionGate's; a burst that stops yields its owed refusals=10 line once the window passes and a dropped stack says its pending refusals=3 (stack_peer_says_a_silent_windows_count).
  • 👍 valid — crates/minimald/src/net/switch.rs: The no-reset early return is gone: the sweep runs ahead of the charge on every refusal and the tail matches on reset after it, so a spoofed-only source's expired window says its refusals=5 line with still no reset written (revoked_port_refusal_is_logged's new no-reset path).

Every leg now says each window's true count at the window it belongs to, in the one audit format: the minimald relay's sweep runs ahead of the charge on every refusal — including the spoofed, no-reset segments that used to return around it — the stack peer's turn opens with the same sweep and its stack's Drop says what its live windows still hold, so a source that stops flooding no longer needs one more refusal to have its last window's count said; and the e2e case's host leg now connects at the address the host's own zone answerer returns for the box's name — the address the forwarders actually bind, not the registry's unbound loopback allocation — asking for it straight at the answerer's port with no OS resolver hook, and where the host does not serve the box's published ports at that address the leg prints plainly that it does not, asserts nothing, and the OK line claims no leg it did not run.

Notes from the agent: Round 6's four asks, all in the layers the task names. (1) The host address leg's answerer query is one python3 datagram (upr_answerer_a), not dig — dig is on no lane's declared dependency list while the script's own pty driver already owes python3; the helper was exercised against a fake answerer for a compressed-name reply, a no-answer reply, and no listener, and the min-ls port extraction against both the single-VM and multi-VM ZONE ANSWERER shapes. (2) BepStack::poll's sweep reads std::time::Instant::now(), the clock the pre-screen charges the audit at, not the stack's stepped now; the new test stack_peer_says_a_silent_windows_count covers the burst-that-stops and the dropped-stack halves (exit 0). (3) Moving the sweep ahead of the charge retired the fold-into-the-next-window behavior the_shared_quota_spends_per_source_and_says_the_windows_count used to pin, so that test was retaught to the new semantics (each window opens with its own count, the closed window's is said by the sweep; exit 0) — the directive's intent, not a regression. …[truncated]

@norrietaylor
norrietaylor marked this pull request as ready for review October 3, 2026 22:58

@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 — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 3, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 7 would exceed the cap of 6 (the last trigger was a conflict with the base branch). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1800 by hand.

# Conflicts:
#	scripts/session-e2e.sh
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 7 would exceed the cap of 6 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1800 by hand.

@norrietaylor norrietaylor removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 4, 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.

Own review and ARCH pass hold at 254089d. The KVM rerun is green, and the host leg of the unpublished-port proof ran: the host connect was refused in 9 ms. The name leg skips on KVM by design because the host resolver isn't pointed at the box zone.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 4, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit a4cad26 Oct 4, 2026
36 of 38 checks passed
@norrietaylor
norrietaylor deleted the agent/1800-shape-every-egress-refusal-from-one-builder-in-t branch October 4, 2026 02:29
minimal-foundry Bot added a commit that referenced this pull request Oct 4, 2026
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).
minimal-foundry Bot added a commit that referenced this pull request Oct 4, 2026
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.
yermakoffivan pushed a commit to yermakoffivan/minimal that referenced this pull request Oct 4, 2026
…o end (gominimal#1912)

* test(e2e): add the port-publish and box-outlives-client case

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.

* test(e2e): skip the run half where no session sandbox spawns

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.

* test(e2e): name the zone dump's path in the case's diagnostics note

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.

* test(e2e): pin the run half's daemon filter before reading its record

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.

* test(e2e): make the run half's task speak so a lost client is noticed

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.

* test(e2e): reach the detach box's loopback from inside the guest

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 (gominimal#1858).

* test(e2e): pin the by-name legs to the proxy and the delist to a listing

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.

* fix(minimald): carry the refusal's reason in the proxy's 403 body

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).

* test(e2e): key each half of the port case on the rule it cites

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, gominimal#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.

* test(e2e): claim NET-016's refusal arm only and tear down the client 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 (gominimal#1895).
The detach half's outside-client seed dir joins the teardown trap like
its three siblings.

---------

Co-authored-by: minimal-foundry[bot] <327719912+minimal-foundry[bot]@users.noreply.github.com>
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.

T70 — Shape every egress refusal from one builder in the switch crate

1 participant