Repository navigation
fix(bep,minimal): un-enrolled, min box audit reads the audit records over the proxy's control socket - #3701
Conversation
The control socket takes read_audit, which streams the retained records for the named boxes through LogReader, and with follow tails the log until the client closes. bep serve gives the socket its audit directory.
ControlClient sends read_audit and gives back the record lines, once or as a follow stream. min box audit reads at mint::control_path in place of the log directory, so it opens no audit log file.
…d-min-box-audit-reads-the-audit-record
The audit read and its test connect to the proxy's control socket, not the daemon, so the connection inventory records them as ungated.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
/arch-review |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The read over the control socket conforms to the design. The proxy reads its own log, the client opens no log file, and the peer-uid check keeps the same-machine trust of Gatehouse §6.2. One gap is left. ControlClient::read_audit loops forever when the proxy accepts the connection and does not answer, so min box audit without --follow can hang. Architecture principle 3 (line 335) says "Agents never hang." Make the change in C1.
Ruled at a8a6a14 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
|
/revise |
…d-min-box-audit-reads-the-audit-record
ControlClient::read_audit looped on a timed-out read, so min box audit without --follow waited without end on a proxy that accepted and never answered. It now returns a TimedOut error, and min box audit refuses with a message that says the proxy did not answer within the control timeout and names the restart step. --follow stays unbounded.
|
Round 1 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: verify exited 100; outside the task's Review threads the coder judged:
On an un-enrolled host, min box audit shows the records that bep serve wrote for that box, a reaped box included, read over the control socket with no file opened under ~/.minimal/bep/audit. When the proxy accepts the read and never answers, min box audit without --follow now exits non-zero after 10 seconds with: "Cannot read the audit log: the Box Egress Proxy did not answer on within 10 seconds. Restart minvmd, which starts the proxy again." --follow stays unbounded. Notes from the agent: C1 addressed: ControlClient::read_audit returns MintError::Control(TimedOut) when next_batch gives None, in place of the loop. audit_error maps TimedOut to its own refusal. The text reuses the restart step that the existing not-running refusal and boxes::core::bep::write_restart_step give. CONTROL_TIMEOUT in mint.rs is now pub(crate) so the message states the bound, and mint::tests is pub(crate) so box_audit tests can share serve_silent. The end-to-end test waits the full 10 second CONTROL_TIMEOUT. The commitlint failure is on the existing commit cc3401c ("docs(specs): BEP-042 reads ...", subject-case on the leading identifier). I did not fix it, because this round must not rewrite commits already on the branch. A person can fix it with a squash-merge title, or by relaxing subject-case for that commit. The new commit passes subject-case. I did not run just clippy-strict. |
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
C1 is met. ControlClient::read_audit now returns a TimedOut control error when the proxy does not answer, and it does not loop. min box audit without --follow ends with a refusal. This agrees with architecture principle 3: agents never hang. Two new tests prove the timeout against a socket that never answers. The merge from main does not change the PR's own lines. No condition is open.
Ruled at 7acccbd against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
|
The maintainer accepts the one change outside the task's layers: |
|
/review |
|
Approved: no findings at Nothing to do. Clobber: not found in the hunks read. If that was not intentional, restore the earlier change. |
|
/review |
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of 7acccbd89b97 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.
There was a problem hiding this comment.
Gate passes at 7acccbd: minimal-review approved with no findings, arch-review PASS, every lane aggregator green, no open threads.
Follow-up
Fixes #2463
crates/bep/src/control.rscrates/bep/src/main.rscrates/bep/src/audit.rscrates/minimal/src/mint.rscrates/minimal/src/cmd/box_audit.rscrates/minimal/src/tests.rscrates/minimal/src/cmd/doctor.rsdocs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.mdTask marker
Proof
On an un-enrolled host, min box audit connects to ~/.minimal/bep/control.sock and shows the records that bep serve wrote for that box, a reaped box included. bep serve reads its own log segments and sends only that box's records. The client is given only the socket path and opens nothing under ~/.minimal/bep/audit. --follow tails over the same connection, across a log rotation.
Notes from the agent: Outside the layers: crates/minimal/src/cmd/mod.rs changes one line,
mod box_audit;topub(crate) mod box_audit;. Without it, the new test in crates/minimal/src/tests.rs cannot call box_audit::run.Protocol: {"op":"read_audit","subjects":[...],"follow":bool}. The proxy replies with one {"ok":true,"record":""} for each matching record. A {"ok":true,"caught_up":true,"skipped":N} line ends each read, and it carries no_log when the log directory does not exist. A follow ends when the client closes the connection or sends another line. A socket with no audit dir refuses the read. Wiring::control takes the audit dir as a new parameter, and the three main.rs tests pass a path next to their socket.
The box_audit.rs tests now run over a served Control (run_to_strings). Only box_audit_follow_replays_then_tails still reads files: it uses a test-only AuditSource impl for LogReader so it can step the writer between reads. Product code no longer reads the files.
Printed text changed. With no log directory, the command now says "The proxy has not written an audit log yet, so no records for box are shown." The skipped-line message no longer names a directory: "The audit log has N line(s) that ...". There are new errors for a proxy that does not answer,…[truncated]
Commit bodies re-wrapped by the runtime: a prose line over commitlint's 100 is split at a space where no piece is left over it, and code and lines that cannot split are left as written. Every word the coder wrote is kept, in order:
test(minimal): classify the box audit control socket connectionsTests
cargo nextest run -p bep control_socket_streams_audit_records_for_one_subjectcargo nextest run -p bep control_socket_follows_audit_records_across_a_rotationcargo nextest run -p minimal box_audit_reads_over_the_proxy_socketcargo nextest run -p minimal box_audit_filters_to_one_boxcargo nextest run -p minimal box_audit_reads_over_the_proxy_socketVerify
min task run agent-verifyexited 100, so this PR is a draft.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/mod.rscrates/minimal/src/tests.rsdocs/specs/24-spec-box-egress-proxy/24-spec-box-egress-proxy.mdOut of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/src/cmd/mod.rs