Repository navigation
feat(min): read one box's audit trail with min box audit - #2457
norrietaylor merged 13 commits into
Conversation
min box audit <box|self> | --parent <box|self> [-o jsonl] [--follow] reads the local proxy's audit log across every segment. A box id reads that box's records, a removed box included. A name reads the live box of that name, else the newest creation, and names the id it read. --follow replays and then tails, and --parent merges the children's records. self is refused on a host that is not enrolled. bep::audit gains LogReader, a read-only reader over the segments audit-<n>.jsonl in ~/.minimal/bep/audit.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. The earlier |
norrietaylor
left a comment
There was a problem hiding this comment.
Own review of 7c3c46a against the T17 plan block (BEP-042).
- BEP-042, one id:
run()with an id reads every segment throughLogReaderandrender()keeps only records whosesubjectis that id;box_audit_filters_to_one_boxcovers two segments, a box in no listing (reaped),-o jsonlas the on-disk lines, and the empty case on stderr. - name:
resolve()takes the live box of the name, else the newest creation by UUIDv7 order, andrun()printsShowing <name> (box <id>).on stderr; the unknown-name error points atmin box audit <box-id>. Covered bybox_audit_name_reads_live_else_latest_creation. - --follow:
follow()replays then tails;LogReaderkeys offsets by segment path, so a rotation to a new segment is read from its start. Covered bybox_audit_follow_replays_then_tailswith an append and a rotation. - --parent:
children()from the listing'sparentfield, records merged on one stream with the subject first; a box with no children says so. Covered bybox_audit_parent_merges_children. The listing carries no parent today, so the real command always reports no children: an honest interim the agent note records. - self un-enrolled: inside a box (
MINIMAL_SESSION_NAME) the defined erroraudit_self_unsupported_unenrolledwith the pinned message namingmin box audit <box>; on the host, a separate "not inside a box" error. Covered bybox_audit_self_unenrolled_refused_with_error. The code is a const on the error type; the machine-output error object inmain.rs(outside the layers) does not read it yet, which the agent note records. - Layers:
crates/bep/src/audit.rs(reader only, no writer change),cli.rs,cmd/box_audit.rs,cmd/mod.rs, as planned. The grammar testbox_audit_grammar_takes_a_box_or_parentis an addition in the same file. - One stray edit:
DestroyArgs' argument group is renamed fromtargettobox_or_parent, a name that describesmin box audit, not destroy. Nothing references the old group name, so it is harmless; it reads as a leftover of the clap group-name fix. A later round can give it its own name; not blocking. - Verify: the agent's verify ran under rustc 1.98.1, not the pinned 1.97.0; CI is the gate and the lanes are running.
Approval follows the arch ruling, the runtime review and the lanes.
Generated by Claude Code
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
The command grammar conforms to architecture.md line 501. The read path does not conform. Line 501 and Gatehouse §6.10 line 836 say that un-enrolled, the client reads the helper's log over the local UDS. This change opens the log files directly. C1 declares the direct read as an interim with an issue, and an escalation asks the design owner to rule on it. --parent always says a box has no children, because the listing carries no parent. C2 makes it refuse. C3 files the work the PR body leaves undone.
Ruled at 7c3c46a against gominimal/arch@109541a48c31 by claude-opus-5-5.
Text mode escapes control characters in the fields a box controls, and in the name. Lines of the log that are not records are counted on stderr. --parent refuses while the daemon's listing carries no parent, in place of the false claim that the box has no children.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 7 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/box_audit.rs:331, minimal-foundry[bot] crates/minimal/src/cmd/box_audit.rs, minimal-foundry[bot] crates/bep/src/audit.rs:606, minimal-arch[bot] crates/minimal/src/cmd/box_audit.rs:371, minimal-arch[bot] crates/bep/src/audit.rs:500, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
The read on the host conforms to the Audit paragraph in architecture.md, line 501. The compare fixes the earlier text-output and --parent gaps. Three items stay open. Inside a box, a box id reads the box's own home and tells the user that the proxy has no records. Line 501 says that the source is the host-side helper's log, so refuse there (C1). Link an issue to the --parent interim (C2). Make -o jsonl failures emit the min/v1/error object that line 379 requires (C3). One escalation asks if the client can read the log files directly, or if the read must go over the helper's UDS.
Ruled at f6e315d against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
Notes from the agent: Revise round 1. The real |
|
/revise arch-review ruled CONDITIONS on f6e315d (review 5587669151, run 118727269787), after CONDITIONS on 7c3c46a (5587474962). Carry each in substance. The issues the rulings ask for are filed; name them rather than filing again. The epic owner accepted a layer exception for C1 (f6e315d) — inside a box, refuse every target. C1 (7c3c46a) — declare the direct read an interim. (b) In C2 — C3 — Red lane. PR body. Add Reply on each thread with what the push changes. Generated by Claude Code |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
…tory Inside a box every min box audit target is refused, because the log is the host proxy's. The listing connects through connect_daemon_unchecked and stays gated on its ListSessions call, so the connection inventory test passes. Mark the direct log read and the missing listing parent as interims with their flip conditions, and restore the destroy arg group.
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
The reader conforms to the audit paragraph for ids, names, --follow, -o jsonl and self. Three interims have no issue, and an interim without an issue is work that nobody owns. The client reads the log files directly, but line 501 and Gatehouse §6.10 put the un-enrolled read on the local UDS. Do C1. --parent refuses until the daemon listing carries the parent. Do C2. A failure under -o jsonl is not the min/v1/error object that line 379 requires. Do C3.
Ruled at 19fd98f against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 2 of 10 on a failed check suite, pushed as
Verify Review threads the coder judged:
On the host, Notes from the agent: CI failure: the earlier head added a Client::connect site in known_boxes, and minimal tests::every_daemon_connection_is_classified does not list it. That test is in crates/minimal/src/tests.rs, outside the layers. known_boxes now connects through the existing cmd/mod.rs::connect_daemon_unchecked and stays gated through list_sessions_version_gated, so the inventory does not change. One full |
…ox-s-audit-trail-with-min-box-audit
Under -o jsonl, a failure of min box audit now emits one min/v1/error object, and the self refusal carries its own code. The direct log read, the in-box refusal and the --parent refusal name #2459, #2463 and #2386. A missing log directory is named instead of read as no activity, and the reader reads a truncated segment again from its start.
…ox-s-audit-trail-with-min-box-audit
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
Round 4 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Notes from the agent: Revise round 4. Both findings are valid and fixed. printable now escapes Cf characters and U+2028/U+2029 from a fixed range table, because the workspace has no Unicode category crate. The U+202E case is in box_audit_filters_to_one_box, and it also asserts that -o jsonl keeps the raw character. LogReader stores (dev, ino) on Unix beside the offset. On every platform it also resets when the byte before the saved offset is not a newline. cargo clippy -p bep -p minimal --all-targets shows no warnings in the changed files. just clippy-strict was not run. |
|
/revise one review finding stays open on fabbbaa, LOW thread 4328255882 ( The HIGH thread 4328255856 is resolved on the epic owner's ruling (residual of the interim, #2463); change nothing for it. Reply on the LOW thread with what the push changes. Generated by Claude Code |
…ox-s-audit-trail-with-min-box-audit
The listing carries no parent, so run() always refused --parent. The check now runs before known_boxes, so the refusal starts no daemon.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This re-review covers commit 46185cf. The commit moves the --parent refusal ahead of the daemon listing, so a refusal opens no daemon connection. The refusal is still fail-closed while the listing carries no parent (architecture.md line 499), and #2386 tracks the flip. The in-box refusal still runs first, so the pinned BEP-042 error for self is unchanged. The merge of main does not touch the PR files. The PASS on fabbbaa stands, and this head conforms.
Ruled at 46185cf against gominimal/arch@109541a48c31 by claude-opus-5-5.
norrietaylor
left a comment
There was a problem hiding this comment.
Own review of 46185cf (round 5 commit plus a base merge) against the LOW it answers.
refuse_parent_before_listingruns incmd_box_auditbeforeknown_boxes, keyed onLISTING_RECORDS_PARENTS, so the--parentrefusal starts no daemon. It names the target as given (an id throughresolvewith an empty listing, a name escaped byprintable,selfwith the on-host refusal).run()keeps its own refusal through the sharedparents_unrecorded, so the merge-over-a-supplied-parent test is unchanged. Tests cover a name, an id,self, and the two pass-through cases. Sound.- Nothing else changed. The earlier reviews of e8928e9 and fabbbaa stand.
- Open: the runtime's new LOW on
follow(a closed stdout is only noticed on the next matching write, so--follow | head -1can poll forever). Put to the epic owner.
The squash subject stays the PR title.
Generated by Claude Code
|
Round 5 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Notes from the agent: This round changes one thing. cmd_box_audit calls the new refuse_parent_before_listing before known_boxes. The run() refusal and its test did not change, and the two refusals share one message function (parents_unrecorded). Before the listing, the refusal names the --parent value as the user typed it, because no listing exists to resolve a name to an id. |
…ox-s-audit-trail-with-min-box-audit # Conflicts: # crates/minimal/src/cmd/mod.rs
Rust ignores SIGPIPE and --follow writes only on a matching record, so a closed pipe went unnoticed. Probe stdout for POLLERR or POLLHUP after each wait.
norrietaylor
left a comment
There was a problem hiding this comment.
Own review of 174dd48 (round 6 commit plus the base merge 05589a6) against the LOW it answers.
reader_gonepolls stdout with no requested events and a zero timeout, sopollreports only POLLERR and POLLHUP; the--followwait closure returns false when the reader is gone, andfollowreturns. A poll error is read as "still there", which errs on the side of continuing. Testbox_audit_follow_stops_when_the_reader_closesproves it withstd::io::pipe. Sound.nix::pollrides thepollfeature thatminimal-clientenables on the workspacenix, as the comment says; a crate-local feature line would be more honest, but clippy and the build pass and it is not worth a round.- Nothing else changed. The earlier reviews stand. The squash subject stays the PR title.
Generated by Claude Code
|
A merge of main before round 6, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Notes from the agent: The merge conflict in crates/minimal/src/cmd/mod.rs kept both exports: |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The new commit ends min box audit --follow when the reader of stdout closes. The Audit paragraph of architecture.md (line 501) requires only that --follow replays and then tails, on the events model. This change keeps that behaviour. The merge of main keeps the box_audit module and its exports. The PASS on 46185cf7 stands for the rest of the change.
Ruled at 174dd48 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 6 of 10 on the runtime's review findings: the coder changed nothing. Round 6 changes no code. The one thread does not hold, see its verdict. I ran no test line this round because the tree did not change from 174dd48. The runner re-runs every test: line at the branch head. Review threads the coder judged:
|
|
The red A gvproxy from an earlier run is still alive on the self-hosted runner (the "Leaked VMMs hold the bridge socket" footgun in AGENTS.md), so every macOS e2e run there fails the same way until the runner is reaped. This diff touches Generated by Claude Code |
|
Round 7 of 10 on a failed check suite: the coder changed nothing. No code change this round. The e2e job failed in its 'Install nextest' step (taiki-e/install-action in .github/workflows/ci-macos.yml), with exit code 100 on the self-hosted macOS runner. That step runs before any code from this branch runs, so the failure is a runner tool-install failure and not a defect in the change. ci-macos-success only aggregates that job and runs 'exit 1' when a lane job fails. The fix is a re-run of the e2e job. .github/ is frozen and an agent may not touch it. All five test lines pass at head 174dd48. |
norrietaylor
left a comment
There was a problem hiding this comment.
Babysit gate for T17 #2457 passed on 174dd48: every lane green, arch PASS, review threads resolved and bot resolutions re-verified, no needs-human. Squash subject checked against commitlint. Approving and enqueueing under the epic owner's merge-on-green delegation.
Generated by Claude Code
T17 — Read one box's audit trail with min box audit
slice: S0
kind: task
covers: BEP-042
size: L
est: 300 code, 300 tests
executor: agent
difficulty: routine
model: standard
diagnostics: inside a box,
min box audit selfprints "Reading your own audit trail from inside a box needs a Gatehouse. On the host, runmin box audit <box>." on stderr and exits non-zero, pinned by box_audit_self_unenrolled_refused_with_error; a name prints "Showing (box )." before the recordsobservability: one debug log line per read naming the box id and the segments read
layers:
- cli:
- crates/minimal/src/cli.rs:
min box audit <box|self> | --parent <box|self> [-o jsonl] [--follow]- crates/minimal/src/cmd/mod.rs: dispatch and module line
- crates/minimal/src/cmd/box_audit.rs (new): the BEP-042 grammar: one box id, a name,
--follow,--parent,selfrefused- crates/bep/src/audit.rs: a reader over the log for the client
test: cargo nextest run -p minimal box_audit_filters_to_one_box
test: cargo nextest run -p minimal box_audit_name_reads_live_else_latest_creation
test: cargo nextest run -p minimal box_audit_follow_replays_then_tails
test: cargo nextest run -p minimal box_audit_parent_merges_children
test: cargo nextest run -p minimal box_audit_self_unenrolled_refused_with_error
produces:
- crates/minimal/src/cmd/box_audit.rs (entry point)
consumes:
- crates/bep/src/audit.rs
proof:
min box audit weblists only that box's decisions and names the id it read.depends on:
- blocked by #2262
- blocked by #2267
Proof
min box audit webprints "Showing web (box )." on stderr and lists only the records whose subject is that box id. The command reads every segment of the proxy's audit log.min box audit <id>also reads a removed box, and-o jsonlwrites the proxy's lines as they are on disk.Notes from the agent: Nothing in the tree writes the audit log yet. This change sets the layout that the reader expects: segments
audit-<n>.jsonlin~/.minimal/bep/audit(bep::audit::segment_name,default_dir), read in order of n. The highest n is the active segment, and a segment is never renamed. The BEP-068 rotation writer and the proxy must use this layout. The audit subject is taken as the hyphenated session UUID (SessionIdDisplay). BEP-070 mints the UUIDv7 box id, so its task must keep that spelling or change the reader. Name resolution uses the daemon's ListSessions: live means status Active. A removed box's name is in no record on this host, so after a reap a name finds nothing, and the error tells the person to use the box id. Nothing in the tree records a box's parent, so in the real command--parentalways prints "Box has no child boxes." The merge is implemented and tested over a supplied parent field (KnownBox.parent), and the listing must supply that field later. Host enrollment does not exist, soselfinside a box (detected by MINIMAL_SESSION_NAME) is always refused with the pinned message. On the host,selfgets a separate error, because it names no box there. The pinned message uses "Gatehouse", which is a design term and not a product noun. I shipped it as the task wrote it. The defined codeaudit_self_unsupported_unenrolledis a const on the error type. The machine-output error object in main.rs does not read it, because main.rs is outside the layers. I also addedbox_audit_grammar_takes_a_box_or_parent, a test in the same file. It found a clap debug-assert panic (the group name matched the argument name), and I fixed it. `cli…[truncated]Tests
cargo nextest run -p minimal box_audit_filters_to_one_boxcargo nextest run -p minimal box_audit_name_reads_live_else_latest_creationcargo nextest run -p minimal box_audit_follow_replays_then_tailscargo nextest run -p minimal box_audit_parent_merges_childrencargo nextest run -p minimal box_audit_self_unenrolled_refused_with_errorVerify
min task run agent-verifyexited 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.Closes #2269
Layer exception
Accepted by the epic owner on 2026-10-20 (babysit interview, epic #1501):
crates/minimal/src/main.rs:machine_output_mode()andmachine_mode_answer()treatmin box audit -o jsonlas a machine mode and mapAuditSelfUnsupportedUnenrolledto its code (audit_self_unsupported_unenrolled), per arch-review condition C3 on 19fd98f and architecture.md line 379. Closes min box audit self: put audit_self_unsupported_unenrolled in the machine-output error object in main.rs #2461.crates/minimal/src/cmd/mod.rs: re-exportsAuditSelfUnsupportedUnenrolledfor main.rs.crates/minimal/src/tests.rs: the daemon-connection inventory (every_daemon_connection_is_classified) carries theknown_boxeslisting call, which goes throughconnect_daemon_unchecked.Residuals
min box auditreads the log files directly as an interim; the design reads over the helper's local UDS (architecture line 501, Gatehouse §6.10 line 836), ruled on gominimal/arch#137.audit-<n>.jsonlunderbep::audit::default_dir(); nothing writes the log today.SessionIdDisplay spelling and UUIDv7 ordering thatresolve()andrender()match on.parent(T1 of spec 29); flipsLISTING_RECORDS_PARENTSand ends the--parentrefusal.Generated by Claude Code