Skip to content

feat(minimal): check store rules at box creation and ask once per item (T54) - #2552

Merged
norrietaylor merged 4 commits into
mainfrom
agent/2535-call-the-store-rule-checks-from-box-creation-and
Oct 25, 2026
Merged

norrietaylor merged 4 commits into
mainfrom
agent/2535-call-the-store-rule-checks-from-box-creation-and

Conversation

@minimal-foundry

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

Copy link
Copy Markdown
Contributor

T54 — Call the store-rule checks from box creation and expansion

slice: S9
kind: task
covers: BEP-034, BEP-035, BEP-036
size: M
est: 240 code, 220 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: a refused store reference exits 3 with the rule and the reason on stderr; an ask rule without a terminal prints the denial
observability: one info log line per creation naming the store references checked and their outcome
layers:
- create:
- crates/minimal/src/cmd/boxes/create.rs: reads the rules through read_client_config_and_store_rules, calls check_store_references for every host-store reference the spec declares and store_consent for ask rules, and passes the accepted rules to the proxy registration
- crates/minimal/src/config.rs: read_client_config no longer drops the rules on the creation path
test: cargo nextest run -p minimal store_reference_without_rule_is_refused_at_creation
test: cargo nextest run -p minimal store_rule_outside_egress_exits_3
test: cargo nextest run -p minimal ask_rule_without_a_terminal_denies
produces: none
consumes:
- crates/boxes/src/core/bep.rs
proof: A box spec that references a host-store secret is refused at creation when no rule matches or the rule's upstream is outside the box's egress, and an ask rule prompts on a terminal and denies without one.
depends on:
- blocked by T13
- blocked by T25

Proof

min session create refuses a box spec with a host-store secret before anything is created. It refuses with exit 3 when no [secret-store-rules] rule names the item, when the rule's upstream is outside the box's egress (the message names the missing host), or when the rule denies it. An ask rule asks a y/N question on a terminal. Without a terminal, or with --no-input, the command asks nothing and denies the secret.

Notes from the agent: The task asks for the accepted rules to go to the proxy registration. That part is not done. The registration (ControlClient::register_box, GrantBox, mint_and_register in crates/minimal/src/mint.rs) takes no rules, and mint.rs is not in this task's layers. Store-handle minting is also still interim (#2524). check_store_grants returns the accepted rules, and activate_box holds them as _accepted_store_rules with a comment. The registration already carries the box's egress, and the check proves that every accepted rule's upstream is inside that egress. The next task that mints store handles must pass the rules into GrantBox. A reference with no rule, a deny rule, an ask without a terminal and a declined ask each use a new GrantNotDelivered variant. main.rs already maps GrantNotDelivered to exit 3, so main.rs did not change. config.rs gets store_module_hosts and store_deny_set, so that config reading and creation use one deny set. It also gets a doc note on read_client_config. Creation reads the rules only when the spec declares a store reference. So an unreadable organization config fails only those boxes, and other boxes do not fail. The info log is one line per creation, 'checked the box's store references', with each reference and its outcome. Also ran: cargo nextest run -p minimal config:: activation_steps, 8 passed. just clippy-strict was not run.

Tests

line exit tail
cargo nextest run -p minimal store_reference_without_rule_is_refused_at_creation 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-6684... Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal store_rule_outside_egress_exits_3 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-3893... 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.
cargo nextest run -p minimal ask_rule_without_a_terminal_denies 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-3f29... 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 exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-168b...
    Checking args v0.0.1 (/workbench/crates/args)
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking common v0.0.1 (/workbench/crates/common)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = 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: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Residuals

Closes #2535


Generated by Claude Code

Box creation now reads the secret-store rules through the fail-closed
reader and judges every store reference the box spec declares. A
reference with no rule, a rule upstream outside the egress, and a deny
rule each refuse the creation with exit 3. An ask rule asks on a
terminal and denies without one. One info line names each reference
checked and its outcome.
@coderabbitai

coderabbitai Bot commented Oct 25, 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: 7f8793d9-da5e-4d22-8c3b-27f640a86507

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

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

@minimal-foundry

minimal-foundry Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 203340971996.

Address the comments on the diff.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — 2 findings, 2 inline.

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

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS · the full ruling

The change conforms to Gatehouse §6.10 line 849. Box creation refuses a store reference with exit 3 when no rule names it, when its rule denies it, or when the rule's upstream is outside the box's egress. An ask rule asks on a terminal and denies without one or with --no-input. The check runs on the client before the daemon starts, which is where line 1118 puts store consent. The accepted rules do not reach the proxy registration yet. That work stays with #2524, which owns the store-handle mint at creation.

Ruled at 5e28d6b against gominimal/arch@109541a48c31 by claude-opus-5-5.

Log each refusal reason in place of marking every reference refused.
Escape control characters in the grant, item and upstream names that
the ask prompt prints, because they come from minimal.toml.

@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 changes only the store-reference log line and the ask question. The log now records each actual refusal, and not every reference as refused. The question escapes control characters in names that come from the project. Both changes keep the consent gate of §6.10 line 849, and the gate is now stronger. The PASS on 5e28d6ba stands for this head.

Ruled at 4198340 against gominimal/arch@109541a48c31 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

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

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimal store_reference_without_rule_is_refused_at_creation 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-9d60... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal store_rule_outside_egress_exits_3 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-6078... 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.
cargo nextest run -p minimal ask_rule_without_a_terminal_denies 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-f84b... 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 exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-05d8...
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking common v0.0.1 (/workbench/crates/common)
    Checking switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = 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: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs:388: The info log now records each reason from ActivationRefused.refusals once, as refused: <reason>, in place of marking every reference refused.
  • 👍 valid — PRRT_kwDOPdfcxM6v_UJe: Added printable(), which escapes control characters. The ask prompt passes the grant, item and upstream names through it. ask_rule_without_a_terminal_denies pins an ESC and newline case. (not posted on the thread: not an open thread on the pull request)

A box spec that references a host-store secret is refused at creation with exit 3 when no rule matches or the rule's upstream is outside the box's egress. An ask rule prompts on a terminal, with control characters in the names escaped, and denies without a terminal.

Notes from the agent: Revise round 1: both review findings fixed in create.rs. cargo clippy -p minimal --all-targets reports no warnings in the minimal crate. The warnings it prints are in minimald and minimald-rpc, which this task does not touch.

Copy link
Copy Markdown
Member

/revise

Round 2 of #2552, on one review finding opened at 4198340. No round is in flight. Arch's PASS at 5e28d6b stands for this head, and the accepted rules reaching the proxy registration stays with #2524.

  1. Finding 4370065072 (accept_store_references in crates/minimal/src/cmd/boxes/create.rs line 425): the loop asks the person about each ask reference as it reaches it and only then refuses a later reference with no rule or a deny rule, so a person can answer y and still see the creation refused, and the same item used by two grants is asked twice. Run the no-rule and deny checks for every reference first, then ask once per distinct item; pin both with tests (a deny after an ask asks nothing, and one item under two grants asks once).
  2. Reply on the thread naming the commit and resolve it if the commit fixes it.

One commit, Conventional Commits subject, body lines at most 100 characters.


Generated by Claude Code

accept_store_references asked about each `ask` reference as it reached it,
so a later reference with no rule or a `deny` rule could refuse the
creation after the person answered y. It also asked twice about one item
used by two grants.

Now every no-rule, deny and no-terminal check runs first. Then the command
asks once per distinct item, and the question names every grant that reads
it. Tests pin both cases.

@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 push runs every refusal before the first question, and asks once for each item. Gatehouse §6.10 line 849 says an ask rule needs a terminal and is denied without one. The design does not set the order of the questions. Every refusal still fails closed, so BEP-034, BEP-035 and BEP-036 still conform. The rules hand-off to the registration stays interim under #2524.

Ruled at 2033409 against gominimal/arch@109541a48c31 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

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

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimal store_reference_without_rule_is_refused_at_creation 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-1570... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal store_rule_outside_egress_exits_3 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-e48d... 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.
cargo nextest run -p minimal ask_rule_without_a_terminal_denies 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-177e... 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 exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-78cb...
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking common v0.0.1 (/workbench/crates/common)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = 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: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs: Fixed in 2033409: accept_store_references now runs every no-rule, deny and no-terminal check first. Then it asks once per distinct item and names every grant that reads it. Tests pin a deny after an ask (no question) and one item under two grants (one question).

A box spec that references a host-store secret is refused at creation when no rule matches, a rule denies, or the rule's upstream is outside the box's egress. All of these refusals now come before any question. An ask rule prompts once per distinct item on a terminal, and denies without one.

Notes from the agent: Revise round 2: commit 2033409. The two new cases (a deny after an ask asks nothing, and one item under two grants is asked once) are in ask_rule_without_a_terminal_denies, so its test line pins them. When the person declines an item that two grants share, the refusal names the first grant. The question names all of the grants. I did not resolve the thread, because the reviewer decides that. clippy -p minimal --all-targets shows no warnings in minimal. The warnings it shows are in minimald and minimald-rpc, which this change does not touch.

@norrietaylor norrietaylor changed the title T54 — Call the store-rule checks from box creation and expansion feat(minimal): check store rules at box creation and ask once per item (T54) Oct 25, 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.

Babysitter approval at 2033409: every merge gate passes at this head (arch PASS at 2033409, zero open threads, every lane aggregator green including ci-macos-success). Squash title feat(minimal): check store rules at box creation and ask once per item (T54) and the squashed message pass commitlint. The hand-off of accepted rules to the proxy registration is a stated residual owned by #2524. Queued for squash merge.


Generated by Claude Code

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit 15e9079 Oct 25, 2026
37 checks passed
@norrietaylor
norrietaylor deleted the agent/2535-call-the-store-rule-checks-from-box-creation-and branch October 25, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T54 — Call the store-rule checks from box creation and expansion

1 participant