8000 T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable by minimal-foundry[bot] · Pull Request #1906 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable - #1906

Merged
norrietaylor merged 23 commits into
mainfrom
agent/1878-publish-runtime-exposures-at-the-registered-addr
Oct 4, 2026
Merged

norrietaylor merged 23 commits into
mainfrom
agent/1878-publish-runtime-exposures-at-the-registered-addr

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable

slice: S13
kind: task
covers: NET-044, NET-047
size: M
est: 220 code, 260 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the bundle's daemon log tail carries one expose line per request on every path, including a record-read failure and a non-numeric port, with the box, the port as given and the outcome
observability: the existing one-info-line-per-expose-request line, now emitted on every path
layers:
- daemon:
- crates/minimald/src/session.rs: publish_exposed_port takes its local address from the hostname registry's published own address for the box, the source the declared ingress path reads through OwnAddressReporter::published_address, and keeps box_addresses.switch_address as the forward target; no published address or a failed bind there returns a typed error and leaves nothing behind, never falling back to the raw handed loopback address; the Active-with-a-live-host check runs inside the actor in the same step that pushes to live_ingress, so a stop cannot interleave and stop_running's unexpose sweep stays complete; a stopped box gets a new typed ExposeRefusal variant saying it is not running
- crates/minimald/src/net/policy.rs: the no-published-address refusal is its own typed error, never DeniedByPolicy or the deny code; AlreadyPublished is idempotent success or its own code, never the deny code
- crates/minimald/src/env.rs: the record-read failure and the non-numeric port reply each emit the expose info line with the box, the port as given and the outcome
- crates/minimald/src/env_min_helper.sh: until the relay gate admits runtime-published ports, the in-box min net expose prints "published; not yet reachable" rather than a bare "published" (message text only)
- crates/minimald/src/rpc.rs: the policy handler fills the live mapping's reachability state
- crates/minimald-rpc/src/lib.rs: LiveMapping gains a pending/reachability field
- crates/minimald/src/session/tests.rs: hosts the expose tests
test: cargo nextest run -p minimald expose_publishes_at_the_registered_address
test: cargo nextest run -p minimald expose_on_stopped_box_refused
test: cargo nextest run -p minimald expose_without_published_address_is_not_a_policy_deny
test: cargo nextest run -p minimald expose_logs_every_path
- cli:
- crates/minimal/src/cmd/session.rs: min session policy shows a live mapping's pending state in both its text and its JSON output
test: cargo nextest run -p minimal policy_shows_pending_live_mapping
produces: none
consumes:
- crates/minimald/src/session.rs
- crates/minimald-rpc/src/lib.rs
proof: A box whose hand the loopback verdict has not vouched for publishes its runtime port at the same address its declared ports use and the live mapping names that address; an expose after Stop is refused with a not-running error and leaves no forward and no listed mapping; a box with no published address gets an error that is not a policy deny; every expose request, failed reads and bad ports included, leaves one info line; and min session policy text and JSON both show a runtime mapping as pending until the gate admits it.

Proof

A runtime min net expose on a box whose hand the loopback verdict has not vouched for now publishes at the same address its declared ports use — the hostname registry's published own address, never the raw handed loopback — and the live mapping names that address; an expose after Stop is refused with the new not-running error and leaves no forward and no listed mapping; a box with no published address gets a refusal of its own that is not a policy deny; every expose request, failed record reads and non-numeric ports included, leaves one info line naming the box and the port as given; and min session policy shows a runtime mapping as pending; not yet reachable in both its text and its JSON until the relay gate's admitted set grows to admit it.

Notes from the agent: env_min_helper.sh (a named layer) needed no edit: its msg) case echoes the daemon's reply verbatim, so the 'published; not yet reachable' message is carried by the new reply text in env.rs (msg:pub 8000 lished port {} at {}; not yet reachable) — the note in the layer is message text only, and the message a user sees in the box is exactly that line. One file outside the named layers was touched: crates/minimald/src/net/gvproxy_network.rs, a mechanical one-line test-module fix — a LiveMapping literal in a RuntimeIngress::record(...) call gained the new non-optional pending: false field; no production code in that file changed. crates/minimald/src/net/provider.rs only stores and clones LiveMapping and needed no change. The daemon's switch control socket is one shared path across sessions, so expose_logs_every_path sequences its two switch stand-ins (the serving one is aborted and the socket file removed before the failing-bind one binds) rather than binding both at once. Beyond the five task lines: one whole-crate run each of the two crates the shared-type change could ripple through (minimald 652 passed, minimald-rpc 51 passed), `cargo clippy -p minimald -p minimald-rpc -p minimal …[truncated]

Tests

line exit tail
cargo nextest run -p minimald expose_publishes_at_the_registered_address 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-ed04... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/cda72/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/cda72/tree/crates/ot) C
cargo nextest run -p minimald expose_on_stopped_box_refused 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-3e73... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/1109e/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/1109e/tree/crate
cargo nextest run -p minimald expose_without_published_address_is_not_a_policy_deny 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-b619... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/0c114/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/0c114/tree/crate
cargo nextest run -p minimald expose_logs_every_path 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-c11e... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/85fa3/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/85fa3/tree/crate
cargo nextest run -p minimal policy_shows_pending_live_mapping 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-d393... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/f78aa/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/f78aa/tree/crates/args) C

Verify

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

Base

The base branch moved while the coder worked; it was merged in before the tests ran.

Out of scope

These files are outside the task's layers:, so this PR is a draft:

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

Closes #1878

A runtime `min net expose` bound at the raw handed loopback address,
which is not the address the box's name answers at when the loopback
verdict has not vouched for its hand: the hand then publishes at the
127.0.0.1 interim, and a landed verdict can move the registry's publish
off the hand. The publish now takes its local address from the
hostname registry's published own address — the one source the
declared path reads through OwnAddressReporter::published_address —
and keeps box_addresses.switch_address as the forward target, with
the reported lease standing in for a self-allocated box. A missing
publish stays its own typed refusal, never a policy deny.

A publish also needs a box standing behind it: a stopped box's
record still reads active, but the resurrected actor holds no host,
so an expose reaching it is refused with a new NotRunning typed
refusal — checked before the switch is asked, and again in the same
synchronous step that records the forwarder, so a stop cannot leave
a publish behind its unexpose sweep.

LiveMapping gains a pending field: a runtime publish is bound on the
host but the box's relay gate admits only declared ports, so the
serving handler fills the reachability state from the gate's compile
set on every read, the CLI renders it as "(pending; not yet
reachable)" — as does the in-box publish reply — and the JSON wire
shape carries it.

Every expose request now leaves exactly one info line: the actor
logs each request it sees, and the env channel logs the paths no
actor can — a non-numeric port, a session that is gone, and a record
that will not read, whose line the actor cannot write because the
box's name lives in that record. A record that will not read is its
own ExposeFailure arm rather than a publish failure.

The pending field also reaches the LiveMapping literal the
gvproxy_network test drives, spelled mechanically.
The daemon's switch control socket is one shared path, so the
failing-bind stand-in in expose_logs_every_path now takes the
socket over from the serving one instead of racing it for the
bind.

The gone-session refusal logs its reason through %format_args!
like the other expose reasons, the record walk behind
expose_logs_every_path_from_the_channel filters the sessions
directory down to record files, and the per-transport admitted
set the reachability fill reads is computed per mapping — the
match on the proto enum no longer needs every transport spelled
out.

The reachability round-trip assertion keeps its expected value
in a clone, and rustfmt settles the rest.
@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: 4075430c-428f-4e60-9e90-8b486e2e865f

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.

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Round 1. ARCH design check at bbe1067: CONDITIONS. The core conforms: the published-address bind with no fallback, the double live-host check with unbind, NotRunning, RecordUnreadable, and pending read from the gate's own set. Five asks, nothing else. Scope: crates/minimald/src/{env.rs,session.rs,net/policy.rs,session/tests.rs}, crates/minimal/src/{cli.rs,cmd/session.rs} and crates/minimal/tests/cli.rs. Merge main first.

  1. min session policy -o json. Add -o json (short -o, long --output, value json) to min session policy. This is the CLI output contract: one JSON document whose top-level object carries "schema": "min/v1/session-policy", with each live mapping carrying its pending field. Text output stays the default and stays unchanged. Errors in this mode go to stderr as one JSON object {"schema":"min/v1/error","code":…,"message":…}. Do not add --json.
    Test policy_json_carries_schema_and_pending: drive the real render path the command uses, not a serde round-trip of LiveMapping. Assert the schema string and pending: true for a runtime-only port, and pending: false for a declared port.

  2. A shared-address collision is a typed bind error. On the macOS interim, every box publishes at 127.0.0.1, so a runtime expose of a port another box already holds there must fail with the typed bind error naming the port. It must leave no forward and no listed mapping, and never fall back.
    Test expose_colliding_on_shared_address_is_a_bind_error: two boxes with the same published address; the second exposes the first's port.

  3. A dedicated ActorGone failure. env.rs (around :1585) infers "actor gone" from a Publish failure whose source is NotConnected. A real ENOTCONN from a bind would then be logged twice. Add ExposeFailure::ActorGone, returned when the actor's reply channel drops, and match on that.
    Test: extend expose_logs_every_path_from_the_channel with a Publish failure of kind NotConnected and assert the channel logs no line for it.

  4. One pending predicate for the in-box reply. env.rs (around :1562) always appends "; not yet reachable". Append it only when the port is outside the same declared_ingress_ports set rpc.rs reads, by calling that same function. Do not keep a parallel list.
    Test expose_reply_says_not_yet_reachable_only_for_runtime_ports: assert both reply texts.

  5. Doc comment. net/policy.rs around :416: the NoPublishedAddress comment still mentions the VM host's hand; name only the registry. No test.

Add the new test names as test: lines in the result table. Out of scope: the publish address source, the forward target, AlreadyPublished, the gate's admission set, and the PR body.

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Round 1. ARCH design check at bbe1067: CONDITIONS. The core conforms: the published-address bind with no fallback, the double live-host check with unbind, NotRunning, RecordUnreadable, and pending read from the gate's own set. Five asks, nothing else. Scope: crates/minimald/src/{env.rs,session.rs,net/policy.rs,session/tests.rs}, crates/minimal/src/{cli.rs,cmd/session.rs} and crates/minimal/tests/cli.rs. Merge main first.

  1. min session policy -o json. Add -o json (short -o, long --output, value json) to min session policy. This is the CLI output contract: one JSON document whose top-level object carries "schema": "min/v1/session-policy", with each live mapping carrying its pending field. Text output stays the default and stays unchanged. Errors in this mode go to stderr as one JSON object {"schema":"min/v1/error","code":…,"message":…}. Do not add --json.
    Test policy_json_carries_schema_and_pending: drive the real render path the command uses, not a serde round-trip of LiveMapping. Assert the schema string and pending: true for a runtime-only port, and pending: false for a declared port.

  2. A shared-address collision is a typed bind error. On the macOS interim, every box publishes at 127.0.0.1, so a runtime expose of a port another box already holds there must fail with the typed bind error naming the port. It must leave no forward and no listed mapping, and never fall back.
    Test expose_colliding_on_shared_address_is_a_bind_error: two boxes with the same published address; the second exposes the first's port.

  3. A dedicated ActorGone failure. env.rs (around :1585) infers "actor gone" from a Publish failure whose source is NotConnected. A real ENOTCONN from a bind would then be logged twice. Add ExposeFailure::ActorGone, returned when the actor's reply channel drops, and match on that.
    Test: extend expose_logs_every_path_from_the_channel with a Publish failure of kind NotConnected and assert the channel logs no line for it.

  4. One pending predicate for the in-box reply. env.rs (around :1562) always appends "; not yet reachable". Append it only when the port is outside the same declared_ingress_ports set rpc.rs reads, by calling that same function. Do not keep a parallel list.
    Test expose_reply_says_not_yet_reachable_only_for_runtime_ports: assert both reply texts.

  5. Doc comment. net/policy.rs around :416: the NoPublishedAddress comment still mentions the VM host's hand; name only the registry. No test.

Add the new test names as test: lines in the result table. Out of scope: the publish address source, the forward target, AlreadyPublished, the gate's admission set, and the PR body.

The review round's minimald asks:

- ActorGone is its own ExposeFailure arm, not a Publish whose source
  happens to be ENOTCONN: a dead actor never reached the bind, so a
  real ENOTCONN out of a bind the actor did attempt is no longer
  conflated with it, and one request no longer risks two lines. The
  env channel matches the new arm, and a stand-in actor fixture
  drives both it and a genuine ENOTCONN through the channel's
  one-line-per-request test.
- The in-box reply appends "not yet reachable" only for ports the
  box did not declare, decided by the same declared_ingress_ports set
  the live-ingress list reads -- no parallel list.
- A shared-address collision, the shape every box at the 127.0.0.1
  interim makes, is the typed bind error naming the port: no forward,
  no listed mapping, no fallback address -- pinned by a scripted
  stand-in switch that refuses the duplicate bind.
- NoPublishedAddress names only the registry, not the VM host's hand.
The typed-failure batch landed with two lines rustfmt would reflow:
the stand-in actor fixture's answer list and the collision test's
panic message. No behaviour change — `just fmt-check` was the gate
that caught them.
A machine-readable twin for `min session policy`: `-o json` writes one
`min/v1/session-policy` document on stdout — the schema stamp a client
checks first, the policy's blocks as keys (an own-address box carries
its ingress, a host-address box none, a none box only the mode — the
same shape decisions the text rendering makes), and the live mappings as
the wire's own rows with each one's `pending` state carried.

Failures in the mode answer in the same currency: one `min/v1/error`
object on stderr — `code` a name a script can branch on
(daemon_unreachable / session_not_found / policy_unavailable), `message`
the same chain the text mode's error line carries — written by the walk
where the kinds can be told apart, and carried to main as the typed
`PolicyJsonExit` so the run ends non-zero without printing a second,
plain-text line for the same failure.

The text rendering is unchanged; its live-ingress fetch moved verbatim
into a helper both walks share. main.rs carries the sentinel's downcast
and the stdout-contract gate for the json arm, without which tracing
would pollute the document.
@norrietaylor
norrietaylor marked this pull request as ready for review October 4, 2026 00:40
@norrietaylor
Copy link
Copy Markdown
Member

Recovered the round that was quarantined when the pkgs pin bump changed .minimal/minimal.toml on main: merged main into it with no conflicts (bf08e8f). The out-of-layer file crates/minimald/src/net/gvproxy_network.rs is a one-line test literal that gains the new pending field, so this is ready for review.

@norrietaylor
norrietaylor requested a review from a team as a code owner October 4, 2026 00:40
@minimal-foundry
minimal-foundry Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: no findings at 80e286c0478a.

Nothing to do.

Clobber: none: git log on the touched files shows no recent fix reverted; the 2fd7ed34 merge resolved against a moved base.

@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 4, 2026
@norrietaylor
Copy link
Copy Markdown
Member

Correction to my earlier note: gvproxy_network.rs is not the only file outside the layers. crates/minimal/src/cli.rs, crates/minimal/src/main.rs and crates/minimal/tests/cli.rs are outside them too. They add a new -o json output mode for min session policy, with its own schema stamps and error-code vocabulary. The plan assumed that mode already existed. Its scope is going to design review before this merges.

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the -o json machine mode stays: it is the architecture's CLI contract, and the task's layers now declare cli.rs, main.rs, tests/cli.rs and docs/reference/cli-min.md. Make these changes:

  1. Error code spelling. A missing session uses the architecture's code not_found, not session_not_found. Put the kind of thing that was missing in the message and hint. daemon_unreachable and policy_unavailable stay.
  2. One generic machine-mode error path. Replace the policy-specific PolicyJsonExit sentinel with a single machine-mode error emitter in main.rs, keyed on the output mode. It writes the one {"schema":"min/v1/error","code","message","hint"} object on stderr. The next command that takes -o json must be able to call it directly. If you keep a downcast, name and place it as that shared mechanism, not a policy one. Do not touch min ls --json.
  3. Pending never fails open. Make LiveMapping.pending an Option<bool> with #[serde(default)], so a reply from a daemon that predates the field decodes as None. Display None as unknown (daemon predates this field) in the text row and as null in the JSON document. Never display it as reachable. Add a test that a pre-field reply shows unknown.
  4. Log-capture tests pass under cargo test and just test-cross, not only nextest.
    • The tests are expose_on_stopped_box_refused, expose_without_published_address_is_not_a_policy_deny, expose_logs_every_path, expose_logs_every_path_from_the_channel, plus the existing expose_allow_publishes_and_lists and expose_deny_typed_error that now collide.
    • Give each test its own unique box name instead of the shared web.
    • Filter the captured lines by name=<that box> before taking a line or counting. Assert with contains, per crates/minimald/src/test_harness.rs.
    • Prove it with cargo test -p minimald --lib -- session:: running them together.
  5. Docs. Update the session policy entry in docs/reference/cli-min.md for -o json, its min/v1/session-policy document, the pending/unknown marker, and the machine-mode error object. Remove the stale "as JSON" help wording if -o json now replaces it.

Keep every plan test name.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise was refused. task names 12 layer files, above 10: two tasks.

Round 3 of 6 was not counted; #1878 carries the same sentence.

@norrietaylor
norrietaylor c 8BD0 ommented Oct 4, 2026
Copy link
Copy Markdown
Member

/revise

Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the -o json machine mode stays: it is the architecture's CLI contract, and the task's layers now declare cli.rs, main.rs and tests/cli.rs. docs/reference/cli-min.md is accepted outside the layers for item 5. env_min_helper.sh left the layers because it needed no edit: the env.rs reply carries the message. Make these changes:

  1. Error code spelling. A missing session uses the architecture's code not_found, not session_not_found. Put the kind of thing that was missing in the message and hint. daemon_unreachable and policy_unavailable stay.
  2. One generic machine-mode error path. Replace the policy-specific PolicyJsonExit sentinel with a single machine-mode error emitter in main.rs, keyed on the output mode. It writes the one {"schema":"min/v1/error","code","message","hint"} object on stderr. The next command that takes -o json must be able to call it directly. If you keep a downcast, name and place it as that shared mechanism, not a policy one. Do not touch min ls --json.
  3. Pending never fails open. Make LiveMapping.pending an Option<bool> with #[serde(default)], so a reply from a daemon that predates the field decodes as None. Display None as unknown (daemon predates this field) in the text row and as null in the JSON document. Never display it as reachable. Add a test that a pre-field reply shows unknown.
  4. Log-capture tests pass under cargo test and just test-cross, not only nextest.
    • The tests are expose_on_stopped_box_refused, expose_without_published_address_is_not_a_policy_deny, expose_logs_every_path, expose_logs_every_path_from_the_channel, plus the existing expose_allow_publishes_and_lists and expose_deny_typed_error that now collide.
    • Give each test its own unique box name instead of the shared web.
    • Filter the captured lines by name=<that box> before taking a line or counting. Assert with contains, per crates/minimald/src/test_harness.rs.
    • Prove it with cargo test -p minimald --lib -- session:: running them together.
  5. Docs. Update the session policy entry in docs/reference/cli-min.md for -o json, its min/v1/session-policy document, the pending/unknown marker, and the machine-mode error object. Remove the stale "as JSON" help wording if -o json now replaces it.

Keep every plan test name.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise was refused. a line under layers: matches no line form: "- crates/minimald/src/rpc.rs: the policy handler fills the live mapping's reachability state".

Round 3 of 6 was not counted; #1878 carries the same sentence.

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the -o json machine mode stays: it is the architecture's CLI contract, and the task's layers now declare cli.rs, main.rs and tests/cli.rs. docs/reference/cli-min.md is accepted outside the layers for item 5. env_min_helper.sh left the layers because it needed no edit: the env.rs reply carries the message. Make these changes:

  1. Error code spelling. A missing session uses the architecture's code not_found, not session_not_found. Put the kind of thing that was missing in the message and hint. daemon_unreachable and policy_unavailable stay.
  2. One generic machine-mode error path. Replace the policy-specific PolicyJsonExit sentinel with a single machine-mode error emitter in main.rs, keyed on the output mode. It writes the one {"schema":"min/v1/error","code","message","hint"} object on stderr. The next command that takes -o json must be able to call it directly. If you keep a downcast, name and place it as that shared mechanism, not a policy one. Do not touch min ls --json.
  3. Pending never fails open. Make LiveMapping.pending an Option<bool> with #[serde(default)], so a reply from a daemon that predates the field decodes as None. Display None as unknown (daemon predates this field) in the text row and as null in the JSON document. Never display it as reachable. Add a test that a pre-field reply shows unknown.
  4. Log-capture tests pass under cargo test and just test-cross, not only nextest.
    • The tests are expose_on_stopped_box_refused, expose_without_published_address_is_not_a_policy_deny, expose_logs_every_path, expose_logs_every_path_from_the_channel, plus the existing expose_allow_publishes_and_lists and expose_deny_typed_error that now collide.
    • Give each test its own unique box name instead of the shared web.
    • Filter the captured lines by name=<that box> before taking a line or counting. Assert with contains, per crates/minimald/src/test_harness.rs.
    • Prove it with cargo test -p minimald --lib -- session:: running them together.
  5. Docs. Update the session policy entry in docs/reference/cli-min.md for -o json, its min/v1/session-policy document, the pending/unknown marker, and the machine-mode error object. Remove the stale "as JSON" help wording if -o json now replac 10000 es it.

Keep every plan test name.

LiveMapping.pending becomes Option<bool>, still defaulted on the wire.
A reply from a daemon that predates the field carries no pending key,
and that absence decoded as plain false — the reachable reading —
before. It now decodes as None, and both renderings spell it rather
than failing open: the text row prints "(unknown; daemon predates this
field)", the JSON document carries null, and nothing parsing either
surface reads the port as reachable. The daemon fills Some(..) at read
time, so only a genuinely older daemon answers with the absence.

One construction site in net/gvproxy_network.rs rides along — the type
change forces its literal, and that file sits outside the task's layer
list.

Refs #1906
The policy-specific PolicyJsonExit sentinel is gone. A machine-output
run now fails its walk into MachineModeFailure — a generic payload of
code, message and hint, defined beside the -o flag it keys on — and
main.rs holds the single emitter that writes the one min/v1/error
object on stderr, gated on the output mode the failed run was under
and downcasting the payload, the way it downcasts TaskExit. The next
command that takes -o json joins by failing its walk into the payload;
it needs no sentinel, no writer, and no change to main.

The missing-session code becomes the architecture's not_found, with
the kind of thing that was missing in the message and the hint; the
object gains a hint field, so every failure answers with what to do
about it. daemon_unreachable and policy_unavailable keep their codes.
min ls --json is untouched: its failure stays the plain-text line.

Refs #1906
# Conflicts:
#	crates/minimal/src/main.rs
#	crates/minimald/src/env.rs
#	crates/minimald/src/session.rs
#	crates/minimald/src/session/tests.rs
@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
Copy link
Copy Markdown
Member

A local fixer pushed b5f9e00. It is round 3's quarantined work, which had finished all five asks, plus a merge of main.

  • Conflict: the main collision is main's NET-045 ask path. Asks now run through this branch's publish checks:
    • a live-host check before and after the bind (NotRunning, with the forwarder removed on the second failure);
    • the published address taken from the registry;
    • typed RecordUnreadable and ActorGone failures.
  • Audit: a decision keeps its decided_by and decision fields, and only the outcome and reason come from the publish.
  • Test fix: main's expose_unenrolled_decision_audited now launches its allow box's host first.
  • Design check (ARCH): PASS at b5f9e00.

Removing needs-human.

@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 — 1 finding, 1 inline.

Comment thread crates/minimal/src/cmd/session.rs Resolved
@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Oct 4, 2026
`min session policy -o json` fed the degrading live-ingress fetch into
the document unconditionally, so a fetch the daemon could not serve — an
older build without the subsystem, a session mid-teardown — rendered as
`live_ingress: []`, which the document's own contract reads as the claim
that the box published nothing, and put a plain-text warning on the
stderr a machine run reserves for its error object.

Split the fetch from its text-mode degrade: the JSON walk threads the
fetch result and the document renders a failed fetch as `null` — the
unknown — never as an authoritative empty list, and only the text walk
warns. Pin the tri-state in the document tests: served rows (an empty
list included), `null` for an unavailable view, and no key at all for a
mode without the surface.
@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 — 1 finding, 1 inline.

Comment thread crates/minimal/src/main.rs Resolved
@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 4, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was the runtime's review findings). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1878 by hand.

…g-up reader with 141

A write or flush failure on the document's own stdout was a plain anyhow
error, so a -o json run printed prose on stderr beside the contract's one
min/v1/error object. The shared machine-mode path now answers a hung-up
reader with a quiet 141 and any other I/O failure with an output_failed
object, for every command that takes -o json.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 1 on the runtime's review findings, pushed as 2fd7ed34c81e.

line exit tail
cargo nextest run -p minimald expose_publishes_at_the_registered_address 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-9e78... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/73d56/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/73d56/tree/crates/ot) C
cargo nextest run -p minimald expose_on_stopped_box_refused 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-3f2f... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/8934b/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/8934b/tree/crate
cargo nextest run -p minimald expose_without_published_address_is_not_a_policy_deny 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-7d35... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/2c75d/tree/crates/stdlib) Compil 10BC8 ing version v0.7.0 (/home/runner/.local/state/minimal/sessions/2c75d/tree/crate
cargo nextest run -p minimald expose_logs_every_path 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-bf45... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/cac0b/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/cac0b/tree/crate
cargo nextest run -p minimal policy_shows_pending_live_mapping 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-63ce... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/8cb92/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/8cb92/tree/crates/ot) C

Verify min task run agent-verify exited 101.

Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-6f46...
    Checking ot v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/ot)
    Checking args v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/args)
    Checking paths v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/paths)
   Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/stdlib)
   Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/version)
    Checking switch v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/switch)
    Checking diagnostics v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/diagnostics)
    Checking common v0.0.1 (/home/runner/.local/state/minimal/sessions/fcd67/tree/crates/common)
error: using `chunks_exact` with a constant chunk size
   --> crates/switch/src/refusal.rs:205:10
    |
205 |         .chunks_exact(2)
    |          ^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<2>().0.iter()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: using `chunks_exact` with a constant chunk size
   --> crates/switch/src/refusal.rs:209:31
    |
209 |     if let Some(tail) = bytes.chunks_exact(2).remainder().first() {
    |                               ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/switch/src/refusal.rs:209:31
    |
209 |     if let Some(tail) = bytes.chunks_exact(2).remainder().first() {
    |                               ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks

error: could not compile `switch` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

Outside the task's layers::

  • crates/minimald/src/net/gvproxy_network.rs
  • crates/minimald/src/session_host/tests.rs
  • docs/reference/cli-min.md

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

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6ovC63: Split the live fetch from its text-mode degrade: the -o json walk threads the fetch result and the document renders a failed fetch as live_ingress: null — unknown, never an authoritative empty list — with no plain-text warning on the mode's stderr; pinned by policy_json_distinguishes_unavailable_liv (not posted on the thread: not an open thread on the pull request)

The T80 proof stands as the earlier rounds left it — a runtime publish answers at the address its declared ports use and the live mapping names it, an expose after Stop is refused as not-running and leaves no forward and no listed mapping, a box with no published address gets an error that is not a policy deny, every expose request leaves one info line whatever its outcome, and min session policy text and JSON both show a runtime mapping as pending — and this round closed the gap a machine client hit: min session policy -o json now answers a live view the daemon could not serve with live_ingress: null, the document's own unknown, instead of an authoritative empty list claiming the box published nothing, and puts no plain-text warning on a stderr the mode reserves for its error object. The document's three live-ingress states — served rows, an empty list as the box's own claim, and no key for a none-network box — are pinned by tests.

Notes from the agent: One review thread, judged valid and fixed by splitting the live fetch (fetch_live_ingress, non-printing, returns Result) from its text-mode degrade (fetch_live_ingress_degrading, still warns and prints no section); the -o json walk threads the fetch result and write_policy_json renders Err as null. The degraded fetch could not be forced deterministically against the test daemon (it serves GetLiveIngress), so the pin is the renderer's tri-state plus the structural fact that only the text walk calls the printing helper. Pre-existing, outside this round's layers, verified identical with my changes stashed: cargo clippy -p minimal --all-targets -- -D warnings is red at this branch head from two chunks_exact hits in crates/switch/src/refusal.rs under the pinned clippy 1.98 (minimald also carries three result_unit_err warnings); crates/minimal itself clippy-cleans with my changes. just clippy-strict reports one hit on a line an earlier round of this branch changed, not this round's directive: crates…[truncated]

@minimal-foundry
minimal-foundry Bot marked this pull request as draft October 4, 2026 06:06
…the rest unspecified

Any io error in the chain was read as stdout failing, so a config read or
socket error would have named the wrong remedy. The policy command now
tags its own document write with OutputWriteError, which is all
output_failed matches. In a machine mode every other failure is one
unspecified object with no hint, never a prose line.
@norrietaylor
norrietaylor marked this pull request as ready for review October 4, 2026 06:11
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (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 #1878 by hand.

@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 4, 2026
@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.

Approved at b3902d3. ARCH PASS, Linux lanes green, minimal-review approved this head, and no open threads.

@norrietaylor
norrietaylor enabled auto-merge October 4, 2026 06:24
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit a248caf Oct 4, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the agent/1878-publish-runtime-exposures-at-the-registered-addr branch October 4, 2026 08:27
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.

T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable

1 participant

0