8000 fix(minimal): a network key only in a task does not refuse a session start, and a session egress by minimal-foundry[bot] · Pull Request #3394 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): a network key only in a task does not refuse a session start, and a session egress - #3394

Merged
norrietaylor merged 2 commits into
mainfrom
agent/3383-a-network-key-only-in-a-task-does-not-refuse-a-s
Nov 13, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
agent/3383-a-network-key-only-in-a-task-does-not-refuse-a-s

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

Defect

Fixes #3383

Task marker
### D3144 — A network key only in a task does not refuse a session start, and a session egress refusal on --network none names minimal.toml
  kind: task
  size: S
  est: 60 code, 90 tests
  executor: agent
  defect: bug
  epic: 2236
  layers:
    - minimal:
      - crates/minimal/src/cmd/boxes/create.rs: declares_network reads only the egress keys of [defaults], [defaults.session] and session entries. The session create path refuses project egress on --network none and names the minimal.toml table.
      - crates/minimal/src/task.rs: shares the source and remedy wording of the none-mode egress refusal with the session path, if the fix extracts a common helper
      test: cargo test -p minimal network_key_only_in_task_does_not_refuse_session_pick
      test: cargo test -p minimal session_network_none_refusal_names_minimal_toml
  proof: A minimal.toml with two session entries and a network key only in [tasks.build] starts a session, and a session start with project egress and --network none names minimal.toml in its refusal.

Proof

A minimal.toml with two session entries and an egress key only in [tasks.build] (or [defaults.task]) now starts a session with no egress, where before the start refused because it could not pick a session entry. A session start with --network none and egress in [defaults], [defaults.session] or [sessions.] now refuses before the create request with: "... The box's egress rules come from

in minimal.toml. Run it with --network host_ip or --network own_ip."

Notes from the agent: declares_network still counts the network keys of a project Box Type: an entry whose type is not built in, and [box_types..defaults]. The client cannot resolve those roots (#3140), so they can be sessions, and the TypeUnresolved refusal stays for them. The none-mode refusal moved to task::refuse_egress_on_none, which the task path and the new create::session_effective_egress share. The task wording does not change, and task_box_network_none_refuses_egress still passes. The session remedy always offers --network own_ip, because no session path refuses own_ip on a VM host. The session check reads --network only, not network.mode from the file, because a session start does not read the file mode yet (#3238). I ran the two test lines, the task_box_network tests, and clippy -p minimal --all-targets (clean). I did not run the whole crate suite or just ci.

Tests

line exit tail
cargo test -p minimal network_key_only_in_task_does_not_refuse_session_pick 0 ate::tests::network_key_only_in_task_does_not_refuse_session_pick ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 959 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 34 filtered out; finished in 0.00s running 0 test
cargo test -p minimal session_network_none_refusal_names_minimal_toml 0 running 1 test test cmd::box_verbs::create::tests::session_network_none_refusal_names_minimal_toml ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 959 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 34 filtered out;

Verify

min task run agent-verify exited 100, so this PR is a draft.

 {
                "parent_span_id": "2b5992ae13997265",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "6d545e726d8e188d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "6d545e726d8e188d",
                "queued_behind": "0",
                "span_id": "72eaa9f67f4339fd",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "2b5992ae13997265",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "828353cbcdcf4384",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "828353cbcdcf4384",
                "queued_behind": "0",
                "span_id": "0a2e13e66c044260",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "828353cbcdcf4384",
                "queued_behind": "0",
                "span_id": "4dc54226527afd73",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "4dc54226527afd73",
                "span_id": "43e48179613d5f9f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "4dc54226527afd73",
                "queued_behind": "0",
                "span_id": "7fc723f1815ce45a",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  68.768s] 1120 tests run: 1119 passed, 1 failed, 2 skipped
        FAIL [   2.913s] (1120/1120) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

A network key in a task entry or [defaults.task] no longer refuses a
session start whose session entry the client cannot pick. A session
start with project egress and --network none now refuses before the
create request, and names the minimal.toml table the egress came from.
The none-mode refusal is shared with min task run and min box run.
@coderabbitai
coderabbitai Bot commented Nov 13, 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: 5186ff5a-e070-4dcc-af94-80a296e0de39

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

Approved: every review thread resolved at 83affb046054.

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

Nothing to do.

@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 NET-065 refusal on a session start conforms, and the shared helper is in the right place. The declares_network narrowing removes too much. It now reads [defaults.session] only, so a [defaults.<name>] table for a project Box Type no longer counts. Line 1205 of architecture.md says that layer reaches every entry of its type, and the client cannot tell whether a project type is a session (#3140). Such a start now drops the declared egress and does not refuse. Make the change in C1.

Ruled at 8fb8c5f against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
@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.

APPROVE withheld: 1 unresolved thread — minimal-arch[bot] crates/minimal/src/cmd/boxes/create.rs:1345.

minimal-review — advisory review

Verdict COMMENT — No findings.

Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

@norrietaylor
Copy link
Copy Markdown
Member

/revise The arch review at 8fb8c5f ruled CONDITIONS (arch 15b603e6, architecture.md line 1205). declares_network() now reads [defaults.session] only, so it drops [defaults.<project type>], which line 1205 says reaches every entry of that type. A start that used to refuse with TypeUnresolved now starts with no project egress and drops a declared deny_subnets silently. That fails open.

C1: in crates/minimal/src/cmd/boxes/create.rs declares_network(), in in_defaults, count a [defaults.<name>] table that has a network key when <name> is session or is not in mfile::expand::BUILTIN_BOX_TYPES. Use the same rule as can_be_session, and ignore only the built-in types other than session. In network_key_only_in_task_does_not_refuse_session_pick, add a case: a [boxes.dev] entry with type = "mydev" and [defaults.mydev.network.egress] makes project_egress_from(.., None) fail with SessionEntryUndecided::TypeUnresolved.

A [defaults.<name>] table reaches every entry of type <name>, and a
project Box Type can be a session. Its network key now refuses an
undecided session pick again, in place of a start that drops the
declared egress.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as 83affb046054.

line exit tail
cargo test -p minimal network_key_only_in_task_does_not_refuse_session_pick 0 ate::tests::network_key_only_in_task_does_not_refuse_session_pick ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 959 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 34 filtered out; finished in 0.00s running 0 test
cargo test -p minimal session_network_none_refusal_names_minimal_toml 0 running 1 test test cmd::box_verbs::create::tests::session_network_none_refusal_names_minimal_toml ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 959 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 34 filtered out;

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "9a9987c463ddc2a6",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "50fd0cef5bc5c6f6",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "50fd0cef5bc5c6f6",
                "queued_behind": "0",
                "span_id": "d8e54069aeea1a64",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "9a9987c463ddc2a6",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "ee41687bcdde8a8b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "ee41687bcdde8a8b",
                "queued_behind": "0",
                "span_id": "a05fa8364621c9ae",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "ee41687bcdde8a8b",
                "queued_behind": "0",
                "span_id": "c5f683cb9e94e3ce",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "c5f683cb9e94e3ce",
                "span_id": "9c9947671cb290c7",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "c5f683cb9e94e3ce",
                "queued_behind": "0",
                "span_id": "1e4993b0d66f90de",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
  
8000
      },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  62.408s] 1120 tests run: 1119 passed, 1 failed, 2 skipped
        FAIL [   2.767s] (1120/1120) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs: declares_network now counts [defaults.] network when is session or not built in, as can_be_session does. The test adds the [defaults.mydev] TypeUnresolved case.

A minimal.toml with two session entries and a network key only in [tasks.build] or [defaults.task] starts a session. A [defaults.] network key still refuses an undecided pick with the unresolved-type refusal. A session start with project egress and --network none names the minimal.toml table in its refusal.

Notes from the agent: Revise round 1: C1 addressed. declares_network now counts a [defaults.] table with a network key when is session or not a built-in Box Type, the same rule as can_be_session. The test adds the [boxes.dev] type = "mydev" case with [defaults.mydev.network.egress], which fails with SessionEntryUndecided::TypeUnresolved. task.rs is unchanged this round. clippy -p minimal --all-targets and cargo fmt --check are clean.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 13, 2026 15:49
@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS · the full ruling

The compare resolves the condition on 8fb8c5ff. declares_network now counts [defaults.<name>] for a type that is not built in, because line 1205 says that form works for a project type. A key in [defaults.task] or in a task entry still does not refuse a session start. The session refusal on --network none keeps the daemon check and names the minimal.toml table. Issues #3140 and #3238 own the two open edges.

Ruled at 83affb0 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@norrietaylor
norrietaylor marked this pull request as ready for review November 13, 2026 16:37
@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: 1 unresolved thread — minimal-arch[bot] crates/minimal/src/cmd/boxes/create.rs. No findings.

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

@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 against D3144 at 83affb04. declares_network now reads only the layers a session start can reach: [defaults], [defaults.session], a session entry, and a project Box Type's [defaults.<name>] or [box_types.<name>.defaults], by the same rule as can_be_session. So a network key only in a task, or in [defaults.task], no longer refuses a session pick, and a project type's network key still does (arch C1). session_effective_egress refuses project egress on --network none before the create request and names the minimal.toml table (NET-065), through the same refuse_egress_on_none as min task run. Both plan tests cover these cases. Arch: PASS on 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 83affb046054 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 13, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 13, 2026
@bryan-minimal bryan-minimal 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.

Read at 83affb0 against NET-060/NET-065, the two source issues and every session-start path. The code is
right and fails closed everywhere: the --network none refusal runs before the create request, names the
real table ([defaults], [defaults.session] or [sessions.<name>]), and reuses the task wording through
the shared helper. The narrowed declares_network still counts a project Box Type's entry and
[box_types.<name>.defaults], so #3140's refusal stays. Two things to change before it merges:

  • The Proof overclaims (PR body, and the test name). A minimal.toml with two session entries and egress
    only in [tasks.build] does not "now start a session". The egress read no longer refuses it, but every
    start then runs session_loadout_mode (create.rs:1247, called at 3477) and session_box_entry
    (create.rs:1531, called at 3533), and both call pick_session_entry(..)? when no entry is named. The start
    exits 2 with the same "no default" text, one step later. The only production callers of the egress read
    are activate_box (which runs both picks after it) and min box spec (which always passes the entry it
    already picked), so the narrowing changes no outcome anywhere; it removes a redundant refusal and adds
    the test #3144 asked for. Say that in the Proof: "the egress read no longer refuses a file whose only
    network key is in a task; such a start still needs a decided session entry". Neither #3383 nor #3144
    reports an observed failure, so nothing in the ticket is lost.
  • The session-request test helper drifted (crates/minimal/src/tests.rs:14748, and 18698). Its doc says
    it builds the request with the functions activate_box calls, but it still calls the old merge, not
    session_effective_egress. A later test of --network none with egress would build a request the real
    start refuses. One call to change.

Comments, no ask here:

  • min box spec (crates/minimal/src/cmd/box_spec.rs:729-734) renders a spec with --network none and
    project egress that the start now refuses; it did the same for tasks before. A follow-up issue is enough.
  • [box_types.<name>.defaults] counts for any type, even one extending task (create.rs:1355-1364). The
    egress read never uses that layer, so it only adds a refusal; #3140 covers it.

Traced and fine: egress only in a task with zero or one session entry starts as before; session egress with
--network none is refused with the table named, a [boxes.<name>] session entry named as written; egress
in both layers names only the layer of the box being started; the task path with --network none is
unchanged, VM-host remedy included; a loadout cannot add egress today (#3236, #3302), so nothing is dropped
there; --deny-all-egress with --network none refuses as NET-065 says; a network mode set without egress
is not a source; the extracted refusal reproduces the task path's old text exactly.

Merged via the queue into main with commit eb191b5 Nov 13, 2026
40 checks passed
@norrietaylor
norrietaylor deleted the agent/3383-a-network-key-only-in-a-task-does-not-refuse-a-s branch November 13, 2026 17:39
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.

D3144 — A network key only in a task does not refuse a session start, and a session egress refusal on --network none names minimal.toml

2 participants

0