8000 feat(bep): T131 — Choose each key's store on Linux and start the proxy there by minimal-foundry[bot] · Pull Request #3418 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

feat(bep): T131 — Choose each key's store on Linux and start the proxy there - #3418

Merged
mitodrummer merged 6 commits into
mainfrom
agent/3327-choose-each-key-s-store-on-linux-and-start-the-p
Nov 14, 2026
Merged

mitodrummer merged 6 commits into
mainfrom
agent/3327-choose-each-key-s-store-on-linux-and-start-the-p

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

T131 — Choose each key's store on Linux and start the proxy there

slice: S18
kind: task
covers: BEP-088, BEP-089
size: L
est: 360 code, 360 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the refusals print to the person who started bep, pinned by their tests: "The proxy did not start: this host has no usable TPM and no unlocked Secret Service keyring, so the proxy has nowhere to keep its keys." when neither store can generate a key; "The proxy did not start: no key store it can read holds the proxy's key, and <Secret Service is locked|Secret Service cannot be reached|the TPM cannot be reached>. The key may be there, so it is kept." when a store cannot be read; and "No key store on this host holds the proxy's key. Run bep --replace-key <role> to make a new one. Boxes created before then must be re-created." when every store is readable; bep no longer prints "bep runs only on macOS" on Linux
observability: bep logs, at each start on Linux, one line per role with the store that holds its key or store=none, and one line when a first start chooses a store, with the reason the TPM was not usable when it was not
layers:
- store:
- crates/bep/src/linux_store.rs (new): a key store over the TPM store and the Secret Service store that looks up each role in every store, generates a missing key in the TPM where the TPM creates and loads it and otherwise in Secret Service, never generates a role that another store holds, and reports a store it cannot read
- crates/bep/src/lib.rs: declares the linux_store module for Linux targets
- crates/bep/src/keys.rs: load_with refuses a missing role without naming the replacement while a store cannot be read; custody is unchanged, because SecretServiceKey::exportable() returns false and a release build holds a Secret Service key (arch ruling 1238)
test: cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service
test: cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start
test: cargo nextest run -p bep a_held_key_is_never_moved_to_another_store
test: cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement
test: cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key
- binary:
- crates/bep/src/main.rs: on Linux, run takes the Linux key store in place of the "bep runs only on macOS" refusal, for bep, bep serve and bep --replace-key
test: cargo nextest run -p bep linux_start_runs_on_the_linux_key_store
produces:
- crates/bep/src/linux_store.rs
consumes:
- crates/bep/src/tpm.rs
- crates/bep/src/secret_service.rs
proof: On Linux, bep starts, keeps each key in the store it was generated in, and refuses with the role and the next step when a key is missing or its store cannot be read.
depends on:
- blocked by #3324
- blocked by #3326
- blocked by #3325

Proof

On Linux, bep, bep serve and bep --replace-key now run on a key store over the TPM and Secret Service. The bep runs only on macOS refusal is gone. A first start makes each key in the TPM when the TPM makes and loads it, and otherwise in Secret Service. A later start loads each key from the store that holds it and never makes it in the other store. When a role's key is missing and every store answers, bep refuses with the role and bep --replace-key <role>. When a store is locked or cannot be reached, bep refuses 8000 with the role and that store, and names no replacement. When neither store can make a key, bep refuses with the no usable TPM and no unlocked Secret Service keyring message.

Notes from the agent: Design: keys.rs gains a KeyStore::reach() hook (default StoreReach::One, so the macOS keychain path and its texts are unchanged), a KeyError::NoStore variant, and the StartError::NoStore, Kept and Lost refusals. Their texts are the task's diagnostics text, as written. load_with uses reach() only when a role is missing. A first start (no key in any store that answered, and no published role) still makes keys while Secret Service is locked or cannot be reached, because a headless host with a TPM must start. A locked keyring with keys in it and no identity file therefore looks like a first start. The spec defines a first start through the identity file, so this follows it, but a reviewer can disagree. The TPM store reads only files to find a key, so the TPM cannot be reached comes only from a TPM store Store error during a lookup (for example an I/O error on the key directory). Any Secret Service lookup error that is not Locked counts as Secret Service cannot be reached, including a missing secret-tool and a malformed item. That wording is imprecise for a malformed item. When a store refuses a key at lookup (KeyError::Refused) and another role is missing, the old keychain wording (The keychain refused ...) still prints …[truncated]

Tests

line exit tail
cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_held_key_is_never_moved_to_another_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep linux_start_runs_on_the_linux_key_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify

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

Closes #3327

The Linux key store looks up each role in the TPM and in Secret
Service. It makes a missing key in the TPM where the TPM creates and
loads it, and otherwise in Secret Service. It never makes a key that a
store holds. A store that does not answer keeps a missing key, so the
start refuses without naming a replacement (BEP-088, BEP-089).
bep, bep serve and bep --replace-key now run on Linux over the Linux
key store, in place of the refusal that said bep runs only on macOS
(BEP-088, BEP-089).
@coderabbitai
coderabbitai Bot commented Nov 14, 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: e05e3d61-632f-466e-992e-da8ec745c6ee

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

Reviewed: no findings; approval withheld, 6 threads unresolved at e2a9f4402a48.

APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/bep/src/linux_store.rs:295, minimal-arch[bot] crates/bep/src/linux_store.rs, minimal-arch[bot] crates/bep/src/linux_store.rs, minimal-arch[bot] crates/bep/src/keys.rs:213, minimal-arch[bot] crates/bep/src/linux_store.rs:463, …. Resolving the last thread releases the approval on this head.

Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required.

Clobber: not checked in depth. If that was not intentional, restore the earlier change.

@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/bep/src/linux_store.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_WITH_CONDITIONS · 1 condition · the full ruling

The Linux key store conforms to Gatehouse §6.10. It uses the TPM where the TPM makes the key, and Secret Service otherwise. It never moves a held key to the other store. One edge remains. relabel and remove_in treat a Secret Service that does not answer as empty. So a replacement can leave the old key in Secret Service, and a later start can load it. Section 6.10 line 839 says a replaced key is dead. A local refusal blocks bep --replace-key on headless hosts, so file the gap as an issue and name it in the PR body (C1).

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

{
return self.secret_service.relabel(role, from, to);
}
if from == Slot::Held {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · When Secret Service does not answer, this branch returns Ok(()) for the move of Held aside. The old key then stays under Held in Secret Service after a replacement. start() does not compare its kid with the identity, so a later start can load it. Section 6.10 line 839 says a replaced key is dead. File an issue for this gap and name it in the PR body (C1).

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.

Addressed in 8ad2f6282e39: The gap holds: relabel returns Ok(()) for Held when Secret Service does not answer, so a replaced key can stay under Held. No code change this round, because the unreachable-as-empty read is what lets a headless host replace a key. The coder cannot file issues. The C1 issue is described in the round notes for a person to file and link.

Comment thread crates/bep/src/linux_store.rs Outdated
self.tpm.remove_in(role, slot)?;
if self
.secret_service_answer(role, self.secret_service.holds_in(role, slot))
.unwrap_or(false)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This line reads an unanswered Secret Service as false, and the removal skips it. Put this case in the C1 issue together with the relabel branch at line 260.

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.

Addressed in 8ad2f6282e39: The gap holds: secret_service_holds reads an unreachable Secret Service as false, so remove_in skips it. It belongs in the same C1 issue as the relabel branch. No code change this round. The coder cannot file issues, so a person must file it.

A locked Secret Service read as a keyring with no key. A first start with
no identity file then made TPM keys that hid the keys in the keyring.
The start now refuses and keeps the keys while a store that can hold
them did not answer. generate_in, remove_in and relabel in the Linux key
store stop on a locked keyring, so bep --replace-key does not skip an
old key there (BEP-089).
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service 0 warning: unknown fields in task r 10000 untime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_held_key_is_never_moved_to_another_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep linux_start_runs_on_the_linux_key_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/linux_store.rs:314: A first start now refuses and keeps the keys while Secret Service is locked or the TPM store did not answer. generate_in, remove_in and relabel stop on a locked keyring, so --replace-key cannot skip an old key there. A Secret Service that this session cannot reach still lets a headless host start on

On Linux, bep starts, keeps each key in the store it was generated in, and refuses with the role and the next step when a key is missing or its store cannot be read. A locked Secret Service is no longer read as empty, so a start with no identity file does not make TPM keys over the keys in the keyring.

Notes from the agent: Revise round 1. load_with now refuses with the 'The key may be there, so it is kept.' message before it generates any key, while a store that can hold keys did not answer: a locked Secret Service or a TPM store that did not answer. A Secret Service that this session cannot reach does not stop a first start, because a headless host with a TPM must start on its TPM (BEP-088, pinned in linux_key_store_is_the_tpm_where_usable_else_secret_service). So a host whose keys are in a Secret Service that this session cannot reach, and that has no identity file, still makes new TPM keys. Behaviour change: with no usable TPM and a locked keyring, a first start now prints the 'kept' refusal for each role in place of the NoStore message ('no usable TPM and no unlocked Secret Service keyring'). The NoStore message still prints when Secret Service cannot be reached or does not make the key. The test no_tpm_and_no_secret_service_refuses_start now pins both cases. The directive said 2 findings but listed one thread. The second was not in the directive. Ran cargo nextest run -p bep once at the end: 316 passed. Did not run just clippy-strict.

@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/bep/src/keys.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_WITH_CONDITIONS · 2 conditions · the full ruling

The compare fixes the locked-keyring case correctly. A first start now refuses while a locked keyring can hold the keys, as §6.10 line 839 requires. One gap is left. secret_service_answer sorts every Secret Service error that is not Locked as "cannot be reached". Then can_hide_a_key() lets a first start make TPM keys over a keyring that answered with an error. C1 makes that path refuse. C2 amends spec line 308 and BEP-089 to match the new locked refusal, because the test for line 308 no longer proves its locked case.

Ruled at 6f7019b against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

Comment thread crates/bep/src/linux_store.rs Outdated
Err(err) => {
let unread = match err {
KeyError::Locked { .. } => UnreadStore::SecretServiceLocked,
_ => UnreadStore::SecretServiceUnreachable,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · Every Secret Service error that is not Locked comes here, and can_hide_a_key() then lets a first start make TPM keys. A KeyError::Store from a failed secret-tool run means a keyring answered, and it can hold the key. Mark SecretServiceUnreachable only for KeyError::Unreachable and a missing secret-tool. Return every other error, so the start refuses (§6.10 line 839).

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.

Addressed in f0b14a30616d: secret_service_answer now marks SecretServiceUnreachable only for KeyError::Unreachable and a missing secret-tool, and returns every other error so the start refuses. Tests cover both cases.

Comment thread crates/bep/src/keys.rs
/// Service that this session cannot reach is the headless host that
/// BEP-088 starts on its TPM, so a first start does not wait for it.
#[must_use]
pub fn can_hide_a_key(self) -> bool {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This test of the error kind is correct only when the SecretServiceUnreachable bucket holds a real absence of Secret Service. C1 narrows that bucket in linux_store.rs. Do not change this function.

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.

Addressed in f0b14a30616d: can_hide_a_key is unchanged. The narrowed bucket in linux_store.rs (thread C1) makes it hold only a real absence of Secret Service.


// A locked keyring can hold the keys, so the start makes none and
// says which store it cannot read.
let locked = self::store();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C2 · This case now asserts StartError::Kept for a locked keyring. Spec line 308 still requires the no-usable-TPM refusal for it. The design (§6.10 line 839) supports Kept. Amend line 308 and add the locked first-start requirement under BEP-089, with this case as its verify test.

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.

Disputed — not addressed: The code agrees with design section 6.10, as the finding says. The fix is a change to the spec text at line 308 and a new BEP-089 requirement. The spec document is outside this task's layers (crates/bep only), so the spec owner must amend it.

When a key store did not answer, load_with returned only the kept keys
and dropped the roles that the store refused. The refusal now names each
refused role with its bep --replace-key step, then the kept keys.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on the runtime's review findings, pushed as 8ad2f6282e39.

line exit tail
cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_held_key_is_never_moved_to_another_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep linux_start_runs_on_the_linux_key_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/linux_store.rs:270: The gap holds: relabel returns Ok(()) for Held when Secret Service does not answer, so a replaced key can stay under Held. No code change this round, because the unreachable-as-empty read is what lets a headless host replace a key. The coder cannot file issues. The C1 issue is described in the round
  • 👍 valid — crates/bep/src/linux_store.rs: The gap holds: secret_service_holds reads an unreachable Secret Service as false, so remove_in skips it. It belongs in the same C1 issue as the relabel branch. No code change this round. The coder cannot file issues, so a person must file it.
  • 👍 valid — crates/bep/src/keys.rs:908: StartError::Kept now carries the refused roles. Its text prints each refused role with its bep --replace-key step, then the kept keys. A test pins both lines.

On Linux, bep starts, keeps each key in the store that generated it, and refuses with the role and the next step when a key is missing or its store cannot be read. When a store cannot be read and another key is refused, the refusal now names the refused role with its bep --replace-key step and also names the kept key.

Notes from the agent: Revise round 2. keys.rs: StartError::Kept now carries refused, and its text prints a refusal line for each refused role before the kept lines. The new case is in a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key. C1 (both arch threads): the reviewer asks for an issue and a PR body link. This session has no credential to file an issue, so a person must file it. The gap: when Secret Service does not answer, LinuxStore::relabel returns Ok(()) for a move of Held, and LinuxStore::remove_in skips Secret Service. This happens because secret_service_holds reads an unreachable Secret Service as holding nothing. That is deliberate for headless replacement (BEP-088). The old key can then stay under Held in Secret Service after a replacement. start() does not compare its kid with the published identity, so a later start can load it if the TPM no longer has the new key. Section 6.10 says a replaced key is dead. I made no code change for C1. clippy -p bep --all-targets is clean, and cargo fmt --check is clean.

@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 conforms to Gatehouse §6.10. A key that the TPM refuses beside a kept key now prints with bep --replace-key <role>. Before, the Kept refusal dropped it. Line 839 requires a regenerated key to be a named replacement, and this change names it. A missing key in a store that did not answer still names no replacement, so the key is kept. The "keychain" wording on Linux is outside the design. Fix it in the product-text pass.

Ruled at 8ad2f62 against gominimal/arch@15b603e6afb8 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).

Only an unreachable Secret Service or a missing secret-tool reads as a
host with no Secret Service. Any other failure means a keyring answered
and can hold the key, so the start now refuses and the TPM makes none.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a failed check suite, pushed as f0b14a30616d.

line exit tail
cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_held_key_is_never_moved_to_another_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep linux_start_runs_on_the_linux_key_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/linux_store.rs: secret_service_answer now marks SecretServiceUnreachable only for KeyError::Unreachable and a missing secret-tool, and returns every other error so the start refuses. Tests cover both cases.
  • 👍 valid — crates/bep/src/keys.rs:213: can_hide_a_key is unchanged. The narrowed bucket in linux_store.rs (thread C1) makes it hold only a real absence of Secret Service.
  • 👎 invalid — crates/bep/src/linux_store.rs:460: The code agrees with design section 6.10, as the finding says. The fix is a change to the spec text at line 308 and a new BEP-089 requirement. The spec document is outside this task's layers (crates/bep only), so the spec owner must amend it.

On Linux, bep starts on the TPM or Secret Service and keeps each key in the store that made it. It refuses with the role and the next step when a key is missing or its store cannot be read. A Secret Service that answers with a failure now stops the start, and the TPM makes no key to hide the one it can hold.

Notes from the agent: The failed checks are native-daemon-e2e and its aggregator ci-linux-native-success. The e2e failed on min session activate --network own_ip with 'Failed to connect to minimald: ssh connect: Connection reset by peer'. This PR changes only crates/bep, and the minimald session path does not use bep. So I made no change for it, and a re-run is the next step. The check for a missing secret-tool matches the detail text that secret_service.rs writes ("secret-tool is not installed"). A KeyError variant for it needs a change in secret_service.rs, which is outside this task's layers. Thread C2 asks for a spec change (line 308 and a new BEP-089 requirement). The spec is not in the layers, so that change is for the spec owner.

@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 new commit closes a silent-regeneration path. Before it, a Secret Service lookup that failed for any reason other than a lock let a first start make the keys in the TPM. Now only an absent Secret Service lets the TPM start. Any other failure refuses the start, which §6.10 line 839 requires. The baseline ruling stands for the files that the compare does not touch. The PR body still describes the old handling of a malformed item. Update it to match this head.

Ruled at f0b14a3 against gominimal/arch@15b603e6afb8 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 on lines +263 to +269
fn remove_in(&self, role: Role, slot: Slot) -> Result<(), KeyError> {
self.tpm.remove_in(role, slot)?;
if self.secret_service_holds(role, slot)? {
self.secret_service.remove_in(role, slot)?;
}
Ok(())
}
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.

LOW · correctness · confidence 0.50 · in LinuxStore::remove_in

remove_in removes the TPM key first, and only then asks Secret Service whether it holds the key. If the keyring is locked, secret_service_holds returns an error after the TPM key is gone. The caller then sees a failed removal, but part of the removal has already happened. Check Secret Service first, or accept the locked error before the TPM removal.

What the reviewer checked

self.tpm.remove_in(role, slot)?; if self.secret_service_holds(role, slot)? { ... }

Hand this to an agent
Act on a code-review finding.

File:       crates/bep/src/linux_store.rs
Lines:      263-269
Category:   correctness
Severity:   low (reviewer confidence 0.50)

Finding:
`remove_in` removes the TPM key first, and only then asks Secret Service whether it holds the key. If the keyring is locked, `secret_service_holds` returns an error after the TPM key is gone. The caller then sees a failed removal, but part of the removal has already happened. Check Secret Service first, or accept the locked error before the TPM removal.

First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.

👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.

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.

Addressed in e2a9f4402a48: remove_in now asks Secret Service before it removes the TPM key, so a locked keyring stops the removal with the TPM key still in place. A test pins this.

A locked keyring now stops the removal before the TPM loses its key,
so a failed removal changes nothing.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on the runtime's review findings, pushed as e2a9f4402a48.

line exit tail
cargo nextest run -p bep linux_key_store_is_the_tpm_where_usable_else_secret_service 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep no_tpm_and_no_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_held_key_is_never_moved_to_another_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_key_refuses_start_and_names_replacement 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep a_missing_role_with_an_unreadable_store_refuses_start_and_keeps_the_key 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p bep linux_start_runs_on_the_linux_key_store 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/linux_store.rs:272: remove_in now asks Secret Service before it removes the TPM key, so a locked keyring stops the removal with the TPM key still in place. A test pins this.

On Linux, bep starts, keeps each key in the store it was generated in, and refuses with the role and the next step when a key is missing or its store cannot be read. A removal that meets a locked keyring now leaves the TPM key in place.

Notes from the agent: Round 4 changes only LinuxStore::remove_in. It now asks Secret Service whether it holds the key before it removes the TPM key. a_held_key_is_never_moved_to_another_store now checks that a locked keyring leaves the TPM key in place. I did not run just clippy-strict. cargo clippy -p bep --all-targets and cargo fmt --check are clean.

@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 moves the Secret Service lookup in LinuxStore::remove_in before the TPM removal. A locked keyring now stops the removal before the TPM key is removed. This is fail-closed, and it keeps the §6.10 line 839 rule that a held key does not go silently. An absent Secret Service still holds none, so BEP-088 does not change. The new test asserts that the TPM key stays. The PASS on f0b14a3 holds for the rest of the change.

Ruled at e2a9f44 against gominimal/arch@15b603e6afb8 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.

APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/bep/src/linux_store.rs:295, minimal-arch[bot] crates/bep/src/linux_store.rs, minimal-arch[bot] crates/bep/src/linux_store.rs, minimal-arch[bot] crates/bep/src/keys.rs:213, minimal-arch[bot] crates/bep/src/linux_store.rs:463, ….

minimal-review — advisory review

Verdict COMMENT — No findings.

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

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

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit ac675b3 Nov 14, 2026
39 checks passed
@mitodrummer
mitodrummer deleted the agent/3327-choose-each-key-s-store-on-linux-and-start-the-p branch November 14, 2026 06:48
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.

T131 — Choose each key's store on Linux and start the proxy there

1 participant

0