8000 T132 — A refused name always reaches the log, and one box cannot hold the proxy's owner lookups by minimal-foundry[bot] · Pull Request #2997 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T132 — A refused name always reaches the log, and one box cannot hold the proxy's owner lookups - #2997

Merged
norrietaylor merged 6 commits into
mainfrom
agent/2943-a-refused-name-always-reaches-the-log-and-one-bo
Nov 4, 2026
Merged

norrietaylor merged 6 commits into
mainfrom
agent/2943-a-refused-name-always-reaches-the-log-and-one-bo

Conversation

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

T132 — A refused name always reaches the log, and one box cannot hold the proxy's owner lookups

slice: S16
kind: task
covers: NET-141, NET-070
size: M
est: 110 code, 140 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: min bug bundles carry the daemon log, where every refused name a box asked for appears within its window, and a proxied request refused for want of an owner lookup records how many connections were waiting
observability: the relay's refusal line is rate-limited per name with one line per window counting names past the per-box bound; the proxy logs at debug each shared /proc walk with the connections it answered
layers:
- dns:
- crates/minimald/src/net/dns_gate.rs: unmatched_refused_key rate-limits the refusal line per name instead of per hash bucket, with a bound of 256 distinct names per box per window and one line counting the names past it
test: cargo nextest run -p minimald refused_names_sharing_a_bucket_each_logged
- proxy:
- crates/minimald/src/net/proxy.rs: Router::caller_for answers concurrent owner lookups from one shared /proc walk, refreshed at most once a second, instead of a walk per connection, and caps the connections waiting on it at 64, refusing past the cap with the existing unattributed refusal, so a burst from one box cannot starve another box's lookups
test: cargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookups
produces: none
consumes: none
depends on:
- blocked by #2932
proof: A box that asks for many refused names sees each one in the daemon log, and a host-address box opening many connections at once does not get another box's proxied requests refused.

Proof

A box that asks for many refused names now sees each name once a minute in the daemon log, up to 256 names per box per minute. One warn line counts the refusals past that bound. Concurrent proxied connections from the node's address now share one owner walk, at most once a second, with at most 64 connections waiting. In the test with a slow batch lookup, a burst of 63 connections from one host-address box does not delay the lookup for a second box's connection past the wait bound. In production, each connection is still looked up one at a time inside the shared walk, so the proof holds in full only when a batch lookup exists (see notes).

Notes from the agent: 1) dns_gate.rs: unmatched_refused_key and its 256 hash buckets are removed. They are replaced by a per-box RefusedNames window: each name is logged once a minute, up to 256 names, and one warn line counts the refusals past the bound. That line is written when the next window starts or when the box's gate is dropped. This line does not use the shared PolicyWarnLimiter, because that limiter nev 8000 er evicts keys. The old bucket test unmatched_name_refusal_keys_stay_bounded is replaced by refused_names_past_the_bound_are_counted_once_a_window. 2) proxy.rs, partial: the layer asks for one shared /proc walk. The batching, the 1 s pacing, the 64 cap and the debug line for each walk are in proxy.rs. But crates/minimald/src/net/dns.rs (outside this task's layers) has only a per-connection lookup, connecting_box, and its helpers are private. So in production a shared walk still calls connecting_box once per waiting connection, on at most 4 threads, the same parallelism as before. A walk of 64 connections therefore costs 64 /proc passes. To get one real /proc pass, a follow-up task must add a batch lookup in dns.rs (read the socket tables once, walk /proc/*/fd once for the set of inodes). It can then plug into SocketOwners (today Router::with_socket_owners is a test-only hook). The test uses such…[truncated]

Tests

line exit tail
cargo nextest run -p minimald refused_names_sharing_a_bucket_each_logged 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-ae88... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookups 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-373b... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

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.

Closes #2943

The batch owner lookup is in this PR: Router::new uses dns::connecting_boxes, so a walk makes one /proc pass. Any wording above that says otherwise describes cde5eaca. Past OWNER_LOOKUP_WAITING (64 waiting lookups), a connection is refused as unattributed, as the task specifies.

Closes #3000

The REFUSED warning for a name outside allow_dns_hosts was keyed by one
of 256 hash buckets, so names in one bucket shared one line a minute.
Each box now logs each refused name once a minute, up to 256 names,
and one line counts the refusals past that bound.
Concurrent connections from the node's address now wait on one shared
owner walk, run at most once a second, instead of a walk each on four
slots. At most 64 connections wait. One more is refused as a caller the
proxy cannot name, and the refusal line counts the waiting connections.
The one-name-at-a-time lookup still runs per connection inside the walk,
until the socket lookup can name a batch in one pass.
@coderabbitai
coderabbitai Bot commented Nov 4, 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: 12741aed-7ef3-4775-9fc0-0d5b92b9bbda

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 4, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at eadad7abe697.

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

Nothing to do.

@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 — 3 findings, 2 inline.

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

Comment thread crates/minimald/src/net/proxy.rs Resolved
Comment thread crates/minimald/src/net/proxy.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: CONDITIONS · 1 condition · the full ruling

NET-141 and NET-070 conform to the design. The proxy still refuses every caller it cannot name, as §7.1 line 254 requires. One gap is open. In production, the shared walk still calls connecting_box once for each connection, so a burst costs one /proc pass for each connection. The starvation test passes only through the test-only with_socket_owners hook. No issue owns the batch lookup in dns.rs. Make the change in C1: file that issue, name it in the PR body and the code, and make the test's doc comment say what it proves.

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

Comment thread crates/minimald/src/net/proxy.rs Resolved
Comment thread crates/minimald/src/net/proxy.rs Resolved
A connection that timed out or went away left its entry in the shared
owner walk's queue. The entry held a place under the cap of 64, and the
next walk still looked it up. The queue now drops closed entries before
the cap check and when a walk takes its batch.
@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: 4 unresolved threads — minimal-foundry[bot] crates/minimald/src/net/proxy.rs:365, minimal-foundry[bot] crates/minimald/src/net/proxy.rs:382, minimal-arch[bot] crates/minimald/src/net/proxy.rs:240, minimal-arch[bot] crates/minimald/src/net/proxy.rs:4864. No findings.

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

@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: CONDITIONS · 1 condition · the full ruling

The refusal log and the shared owner walk conform to §5.3 and §7.1, and every path with no answer fails closed. In production the walk still does one /proc pass for each connection, because Router::new uses OwnerSource::One(connecting_box). The PR body states this gap, but no issue owns it, and the PR closes #2943. Section 9 line 331 requires that one box cannot exhaust shared state. Open the batch-lookup issue and name it in the PR body as a residual (C1). Then the change conforms.

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

Comment thread crates/minimald/src/net/proxy.rs Resolved
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald refused_names_sharing_a_bucket_each_logged 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-dc49... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookups 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-0068... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👎 invalid — crates/minimald/src/net/proxy.rs:365: Host-address boxes share the node's address, so a per-address cap does not separate boxes. No signal names the box before the walk, so no room can be reserved for 'other' boxes either. The task specifies a cap of 64 with the unattributed refusal past it. That tradeoff is deliberate. The doc comment
  • 👍 valid — crates/minimald/src/net/proxy.rs:382: lookup now drops entries with a closed sender before the cap check, and walk skips them when it takes the batch. Test: owner_lookups_that_stop_waiting_free_the_cap.

A box that asks for many refused names sees each one in the daemon log. A host-address box that opens up to 63 connections at once does not get another box's proxied request refused, and connections that go away no longer hold places in the owner-lookup queue.

Notes from the agent: Revise round 1. The shared owner walk now drops entries whose connection stopped waiting, both before the cap check and when a walk takes its batch. A new test pins this. The doc comment on OWNER_LOOKUP_WAITING now states the limit of the cap: the proxy cannot tell which box opened a connection before the walk names it, so a burst that fills all 64 places refuses another box's connection until the next walk takes the batch. That cap and its refusal are what the task specifies. clippy -p minimald --all-targets and cargo fmt --check are clean. just clippy-strict was not run.

@norrietaylor
Copy link
Copy Markdown
Member

/revise crates/minimald/src/net/dns.rs is now in the task's layers, so deliver the batch lookup in this PR. Add a SocketOwners function in dns.rs that names the owners of a slice of (peer, local) pairs from one read of the socket tables and one walk of /proc/*/fd. In crates/minimald/src/net/proxy.rs, Router::new sets owners: Some(<that function>), so production uses OwnerSource::Batch, and Router::with_socket_owners stays a test hook only. Make burst_of_connections_does_not_starve_other_boxes_lookups drive the production path. Remove the Residuals heading from the PR body, and add Closes #3000 beside Closes #2943. Answer the arch threads at proxy.rs:240, :569 and :4864.

Add dns::connecting_boxes, which reads the socket tables once and walks
/proc/*/fd once for every waiting connection. Router::new uses it, so
the shared owner walk no longer does one /proc pass per connection.
The burst test now drives this production lookup.
@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: 5 unresolved threads — minimal-foundry[bot] crates/minimald/src/net/proxy.rs:369, minimal-foundry[bot] crates/minimald/src/net/proxy.rs:386, minimal-arch[bot] crates/minimald/src/net/proxy.rs:240, minimal-arch[bot] crates/minimald/src/net/proxy.rs, minimal-arch[bot] crates/minimald/src/net/proxy.rs:580. No findings.

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

@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 head resolves the open item from the ruling on cde5eaca. dns::connecting_boxes reads the socket tables once and walks /proc once for all waiting connections, and Router::new uses it. Each failure path gives Unknown, as connecting_box does, and the proxy refuses Unknown (design §7.1 line 254). This head does the work of issue #3000. Close that issue, and update the Proof and Notes in the PR body, because they describe the earlier head.

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

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as eadad7abe697.

line exit tail
cargo nextest run -p minimald refused_names_sharing_a_bucket_each_logged 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-fae8... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookups 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-e118... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/minimald/src/net/proxy.rs:240: Production now sets the batch hook. Router::new uses dns::connecting_boxes (one socket-table read and one /proc/*/fd walk), and the SocketOwners and owners_one_by_one doc comments say so. A separate issue is not needed.
  • 👍 valid — crates/minimald/src/net/proxy.rs: burst_of_connections_does_not_starve_other_boxes_lookups now drives Router::new's production lookup over real connections. The slow_walk_owners test is renamed burst_from_one_box_does_not_starve_another_box_with_a_slow_walk, and its doc says that it uses a slow batch hook.
  • 👍 valid — crates/minimald/src/net/proxy.rs:580: In production, owners is now Some(dns::connecting_boxes), so this line selects OwnerSource::Batch. A walk does one /proc pass for all waiting connections. There is no residual left to name.

A box that asks for many refused names sees each one in the daemon log. A host-address box that opens many connections at once does not get another box's proxied requests refused, because production now names every waiting connection's owner from one read of the socket tables and one walk of /proc/*/fd.

Notes from the agent: This round adds dns::connecting_boxes, the batch SocketOwners function. Router::new sets owners: Some(connecting_boxes), so production uses OwnerSource::Batch. with_socket_owner (the one-pair test hook) now clears owners, so owners_one_by_one runs only in those tests. burst_of_connections_does_not_starve_other_boxes_lookups now uses Router::new with 64 real loopback connections. The test process is in no box's leaf, so each one is named 'no box'. The test asserts that all 64 are answered inside OWNER_LOOKUP_WAIT in 3 walks or fewer. The earlier slow two-box test is kept as burst_from_one_box_does_not_starve_another_box_with_a_slow_walk. A new dns test, connecting_boxes_names_each_pair_as_connecting_box_does, checks that the batch gives the same answers as connecting_box. OwnerWalk counts its walks, and the debug line logs the count. Each holder pid gets its cgroup r 10000 ead and one more fd-directory read, once per holder and not once per pair, to keep connecting_box's pid-reuse check. The directive asks to remove the Residuals heading from the PR body and to add 'Closes #3000' beside 'Closes #2943'. I cannot edit the PR body, and my instructions forbid closing keywords in commits, so the runner must make that body change. The batch lookup that #3000 asks for is now in this PR. Also ran cargo nextest run -p minimald net::proxy net::dns:: (110 passed) and clippy -p minimald --all-targets (clean).

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

Reviewed eadad7ab against T132's plan block. Refused names are logged per name up to a bound, with the rest counted. Owner lookups share one walk in production through dns::connecting_boxes, and an unknown owner fails closed. Past 64 waiting lookups a connection is refused as unattributed: the task specifies that cap, and the doc comment states it, so a burst that size can still refuse another box. Arch-review passes on this head.

@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 eadad7abe697 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 4, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit f02cbc0 Nov 4, 2026
36 checks passed
@norrietaylor
norrietaylor deleted the agent/2943-a-refused-name-always-reaches-the-log-and-one-bo branch November 4, 2026 20:58
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

1 participant

0