Skip to content

T98 — Seal a store handle per accepted store rule at box creation - #2803

Merged
norrietaylor merged 6 commits into
mainfrom
agent/2525-seal-a-store-handle-per-accepted-store-rule-at-b
Oct 31, 2026
Merged

norrietaylor merged 6 commits into
mainfrom
agent/2525-seal-a-store-handle-per-accepted-store-rule-at-b

Conversation

@minimal-foundry

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

Copy link
Copy Markdown
Contributor

T98 — Seal a store handle per accepted store rule at box creation

slice: S13
kind: task
covers: BEP-063, BEP-032
size: M
est: 160 code, 200 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: min box spec and min box audit <box> show each store member the box carries, as T60 and T85 print them today, now with a caller
observability: none new: each redemption of the sealed member writes the BEP-039 audit record T85 writes, with the handle's jti
layers:
- mint:
- crates/minimal/src/mint.rs: mint_store_handle and store_claims gain their caller, and the dead_code expectations that name #2525 go, and so do the module doc's sentences that say mint_store_handle has no caller and that #2526 owns the min box spec store references
- crates/minimal/src/cmd/boxes/create.rs: box creation mints a store handle for each accepted store rule and seals it as a store member (#2525), in place of _accepted_store_rules
test: cargo nextest run -p minimal box_creation_seals_a_store_member_per_accepted_rule
- audit:
- crates/minimal/src/cmd/box_audit.rs: a test renders a refused store-handle record and pins store_handle_invalid, the item as <store>:<id> and jti=<jti> on its line, with the subject in the spelling the reader matches (moved here 2026-10-31, owner, from #2468)
test: cargo nextest run -p minimal box_audit_shows_a_refused_store_handle_with_its_item_and_jti
produces: none
consumes: none
proof: A box created with an accepted store rule carries its store handle sealed as a store member, and the proxy redeems it into the store value that the rule admits. Its tasks re-cover requirements whose origin tasks merged with an arch condition held on a filed residual; the owner accepted that double coverage on 2026-10-26 so the residuals dispatch as slices.
depends on:
- blocked by #2288
- blocked by #2540
- blocked by #2656
- blocked by #2257
- assumes OQ3 (the mint reads the root certificate's own expiry, and the root is generated with a fixed default validity in one constant that gominimal/arch#85's ruling replaces)


Generated by Claude Code

Proof

A box created with a store reference that a [secret-store-rules] rule accepts now gets one sealed value for each such reference, on the create request under the grant's variable. Each value is a store member that holds a store handle for the rule. The test opens each value with the proxy's key and reads its handle under the rule that admitted it. The handle is valid, carries the rule's injection form and has its own jti. That is the handle the proxy redeems into the store value. min box audit shows a refused store handle on one line, with store_handle_invalid, the item as keychain:openai-key and jti=.

Notes from the agent: Out of layers: crates/minimal/src/tests.rs got one line in the every_daemon_connection_is_classified inventory. The new create.rs test connects ControlClient to a proxy control socket that it serves itself. The inventory lists every such connect site, the same as the mint.rs tests, so the test failed without the line. Design: mint.rs gains StoreGrant and mint_store_members. mint_store_members calls mint_store_handle for each grant, then seals the handle as a MemberKind::Store member under the GITHUB module context, which is the one module bep serve opens values under. It also writes a mint audit record with the identifier :. In create.rs, mint_grants now also runs for a box that has store references and no GitHub grant. That box registers its egress and stance with the proxy directly, with no sign-in. A ProxyRegistration guard forgets the box if a store mint fails. The grant_box_facts refusal (unenrolled node) now names the store grants too. Printed text changed: (1) GrantNotDelivered::NotSealed said 'its GitHub grant '. A store grant can now hit it, so it says 'the secret '. Its test in create.rs is updated. (2) The two mint_grants bails ('no home directory', 'clock before 1970') say 'a secret from the host's secret store' for a store-only box. Not changed: no_root_certificate() still says 'it declares a…[truncated]

Tests

line exit tail
cargo nextest run -p minimal box_creation_seals_a_store_member_per_accepted_rule 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-e4d8... 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 minimal box_audit_shows_a_refused_store_handle_with_its_item_and_jti 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-f2dd... 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 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "7ae25ca279489b87",
                "span_id": "6c3a45ad5bfadfc1",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetNetSwitch",
                "parent_span_id": "7ae25ca279489b87",
                "span_id": "89828f0bc6a60830",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "7ae25ca279489b87",
                "span_id": "c4928746c6a3e9e5",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "7ae25ca279489b87",
                "span_id": "e0d7f9a8a2c6171a",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "7ae25ca279489b87",
                "queued_behind": "0",
                "span_id": "5ede8ccd7940bbcd",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "7ae25ca279489b87",
                "queued_behind": "0",
                "span_id": "233434056d221807",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "233434056d221807",
                "span_id": "5e08ec30d86c0b7c",
                "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 [  32.156s] 815 tests run: 814 passed, 1 failed, 1 skipped
        FAIL [   2.799s] (815/815) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Base

The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:

  • crates/minimal/src/cmd/boxes/create.rs
  • crates/minimal/src/tests.rs

Out of scope

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

  • crates/minimal/src/tests.rs

Residual: the live e2e of proof_bep_store_reference_end_to_end steps 3-5 (arch C1) is not run on this head. #2806 carries it, so #2525 can close on merge.

Closes #2525

Box creation mints a store handle for each store reference that a
[secret-store-rules] rule accepts, seals it as a store member, and puts
it on the create request under the grant's variable. A box with store
references only registers with the proxy with no GitHub sign-in.
The test seals store members over a proxy control socket it serves, so
the connect-site inventory lists it as ungated. The test now checks the
sealed deliveries without building a create request.
@coderabbitai

coderabbitai Bot commented Oct 31, 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: 5306063d-b89d-4877-a168-c486cd5e5719

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 Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 148818a96b47.

@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: PASS · the full ruling

The change conforms to Gatehouse §6.10 line 842 and architecture D6. Each accepted store reference gets one sealed value with one store member. The handle is signed under the registered client key and carries the rule's upstream set and injection form. Creation refuses a reference with no accepted rule, and a failed store mint forgets the box at the proxy. The mint_grants branch for a store-only box has no test of its own, but no design line requires one.

Ruled at 64165d1 against gominimal/arch@8640f85e193d 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: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

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

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

Requesting changes at 64165d1.

The mint, rollback and revoke logic are correct. The one defect is user-facing text.

Store-only boxes are told they declare a GitHub grant. With this PR, a box whose only secrets are source = "store" references reaches the mint for the first time. This PR changed only the two bail! sites in mint_grants. Every other refusal on this path still says "GitHub grant":

  • crates/boxes/src/core/bep.rs:733: UnenrolledNode prints "it declares the GitHub grant {grants}". create.rs:758 and :1594 now pass proxy_grant_names(&github_grants, &store_grants) into grant_box_facts. On a native Linux host, a box with only OPENAI_KEY = { source = "store", ... } is refused with "it declares the GitHub grant OPENAI_KEY".
  • crates/minimal/src/mint.rs:195, :202, :207, :231: the MintError texts say "it declares a GitHub grant". require_proxy checks only is_github() grants. So when the proxy is not running, the most common store-box failure reads "it declares a GitHub grant, and the Box Egress Proxy has not published its keys".
  • crates/minimal/src/cmd/boxes/create.rs:694: no_root_certificate() says "it declares a GitHub grant". create.rs:786 reaches it for store-only boxes too.

Carry the declares distinction from mint_grants into each of these messages, and pin the store-only wording in a test for at least the not-running case. AGENTS.md "User-facing text": say only what the code can prove, and use one name for one thing.

Minor: the doc comment on hand_grants (create.rs:714) says "A box with no GitHub grant gets neither". That is no longer true for store-only boxes.

Checked and correct:

  • One sealed Store member per accepted reference.
  • Store rules run before any mint. The legacy broker spelling is refused earlier.
  • ProxyRegistration forgets the box on a partial mint.
  • Destroy revokes.
  • No secret is logged.
  • The tests.rs "ungated" entry is test-only.

No test exercises the rollback through mint_grants, because the new test calls mint_store_members directly.

Arch (local build:arch-review at arch 8640f85e): PASS_WITH_CONDITIONS. BEP-063 and BEP-032 conform. C1: run proof_bep_store_reference_end_to_end steps 3-5 live before #2525 closes. This PR closes #2525 on merge, so that residual needs another home first.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings: the coder changed nothing. every commit this round put on the branch above 64165d1 is a merge of the base branch, so it carries no work of its own

Review threads the coder judged:

  • 👎 invalid — crates/minimal/src/cmd/boxes/create.rs:1598: The text is wrong for a store-only box, but the fix is outside this task's layers. The refusal text is BepRefusal::UnenrolledNode in crates/boxes/src/core/bep.rs, and create.rs cannot change it and keep exit 5. A follow-up must add a store wording there. Then create.rs:758 and :1594 can select it.

@norrietaylor

Copy link
Copy Markdown
Member

/revise

Fix the store-only refusal text. A box whose only secrets are source = "store" references is told it declares a GitHub grant. Carry the declares distinction that mint_grants already makes into each of these messages:

  1. crates/boxes/src/core/bep.rs:733, UnenrolledNode: "it declares the GitHub grant {grants}". create.rs:758 and :1594 pass proxy_grant_names(&github_grants, &store_grants), so store names land here. Name the grants without calling them GitHub grants when any is a store reference.
  2. crates/minimal/src/mint.rs:195, :202, :207, :231: the MintError::Identity, NotRunning and Random texts.
  3. crates/minimal/src/cmd/boxes/create.rs:694, no_root_certificate().
  4. The doc comment on hand_grants (create.rs:714), "A box with no GitHub grant gets neither".

Pin the store-only wording of the proxy-not-running refusal in a test. Keep the GitHub wording unchanged for GitHub-only boxes. If a GitHub-pinned test changes, say why in the PR body.

In the PR body, name #2806 as the residual for the live e2e of proof_bep_store_reference_end_to_end steps 3-5 (arch C1). #2525 can close on merge.

Do not change the mint, rollback or revoke logic. They are correct.

A box whose only proxy-served secrets are source = "store" references
was told it declares a GitHub grant. The unenrolled-node refusal, the
proxy mint errors and the missing root certificate refusal now carry the
distinction that mint_grants already made. GitHub boxes keep their text.

@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 ruling on 64165d14 stands. The merge of main is clean. The new commit changes only the refusal text for a box that has only store references. The refusal code stays gatehouse_unenrolled_node, as Gatehouse §6.2 line 580 requires. The store-member mint stays as §6.10 line 842 describes it.

Ruled at 148818a against gominimal/arch@8640f85e193d 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 — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/minimal/src/cmd/boxes/create.rs. No findings.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimal box_creation_seals_a_store_member_per_accepted_rule 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-9022... 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 minimal box_audit_shows_a_refused_store_handle_with_its_item_and_jti 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-8d14... 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 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

        closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "5e2fd9d5cddd6043",
                "span_id": "54a49e8a867da738",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetNetSwitch",
                "parent_span_id": "5e2fd9d5cddd6043",
                "span_id": "4412eee6d7a21300",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "5e2fd9d5cddd6043",
                "span_id": "8abdd535266e810e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "5e2fd9d5cddd6043",
                "span_id": "dc308d8c48247879",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "5e2fd9d5cddd6043",
                "queued_behind": "0",
                "span_id": "004aba35dcac4a2b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "5e2fd9d5cddd6043",
                "queued_behind": "0",
                "span_id": "5bc188c469902536",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "5bc188c469902536",
                "span_id": "bc34bf40652132ed",
                "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 [  36.206s] 1443 tests run: 1442 passed, 1 failed, 1 skipped
        FAIL [   2.955s] (1443/1443) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Outside the task's layers::

  • crates/boxes/src/core/bep.rs
  • crates/minimal/src/main.rs
  • crates/minimal/src/tests.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs: The verdict changed after the /revise note. UnenrolledNode now carries stored. When a store reference is present, the refusal says "it declares the secret " in place of "the GitHub grant". GitHub-only boxes keep the old text. The test a_store_only_box_is_refused_without_naming_a_github_gran

A box created with an accepted store rule carries its store handle sealed as a store member, and the proxy redeems it into the store value that the rule admits. A box whose only secrets are source = "store" references now gets refusals that name its secrets and do not call them a GitHub grant. These are the unenrolled-node refusal, the proxy-not-running and unpublished-keys refusals, the no-random-bytes refusal and the no-root-certificate refusal. GitHub-only boxes keep the same text as before.

Notes from the agent: Revise round 2. The /revise note required one change in crates/boxes/src/core/bep.rs, which the layers do not name: BepRefusal::UnenrolledNode gains a stored field, and unenrolled_node takes it. Because of the new field, crates/minimal/src/main.rs (test machine_mode_names_the_grant_refusal_code) gets stored: false on one line. Store-only wording: the unenrolled-node refusal says "it declares the secret ". The MintError texts for Identity and NotRunning say "it declares a secret from the host's secret store", which is the same phrase mint_grants already used. Random says "no random bytes for the store handle's key". To do this, mint.rs adds StoreOnlyMintError, and mint_grants wraps its MintErrors in it for a store-only box. no_root_certificate takes stored, and the hand_grants doc now says what grants holds. To keep tests.rs out of the diff, grant_box_facts, grant_root_certificate and hand_grants stay as #[cfg(test)] wrappers with GitHub wording. The production paths call proxy_box_facts, root_certificate_for and hand_minted. No GitHub-pinned test changed. The mint, rollback and revoke logic did not change: only error mapping was added around those calls. For the PR body: #2806 is the residual for the live e2e of proof_bep_store_reference_end_to_end steps 3-5 (arch C1), and #2525 can close on merge. I wrote no closing keyword in a commit.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft October 31, 2026 16:59

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

Approving at 148818a. The refusals on the store-only path now name store secrets instead of a GitHub grant:

  • UnenrolledNode
  • the MintError texts, through StoreOnlyMintError
  • no_root_certificate

GitHub-only boxes keep their text. a_store_only_box_is_refused_without_naming_a_github_grant pins it for the not-running, random and missing-root cases. The crates/minimal/src/main.rs change is the one new field in a struct literal. The mint, rollback and revoke code is unchanged from the head I reviewed earlier. One loose end from the /revise: the PR body does not yet name #2806 as the residual for the live e2e of steps 3-5.

@norrietaylor
norrietaylor marked this pull request as ready for review October 31, 2026 17:32

@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 148818a96b47 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 Oct 31, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 35074ab Oct 31, 2026
36 checks passed
@norrietaylor
norrietaylor deleted the agent/2525-seal-a-store-handle-per-accepted-store-rule-at-b branch October 31, 2026 18:06
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.

T98 — Seal a store handle per accepted store rule at box creation

1 participant