Skip to content

feat(minimal): T41 — Box spec lists a box's hooks with their declarer - #3490

Draft
minimal-foundry[bot] wants to merge 8 commits into
mainfrom
agent/3283-box-spec-lists-a-box-s-hooks-with-their-declarer
Draft

minimal-foundry[bot] wants to merge 8 commits into
mainfrom
agent/3283-box-spec-lists-a-box-s-hooks-with-their-declarer

Conversation

@minimal-foundry

Copy link
Copy Markdown
Contributor

T41 — Box spec lists a box's hooks with their declarer

slice: S5
kind: task
covers: BCLI-022
size: S
est: 70 code, 80 tests
executor: agent
difficulty: routine
model: standard
diagnostics: none new
observability: none new
layers:
- client:
- crates/minimal/src/cmd/box_spec.rs: min box spec <box> lists the stored lifecycle hooks, with the event, the command, its description and who declared it (BOX-179's declared_by)
- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests
test: cargo nextest run -p minimal box_spec_box_lists_hooks
produces: none
consumes: none
proof: min box spec <box> lists each stored lifecycle hook with its event, command, description and declarer.
depends on:
- blocked by #2906
- blocked by #3409

Proof

min box spec <box> now opens its TOML render with a # Lifecycle hooks: comment list. It has one line for each event of each stored hook, with the event, the description, the command and its declarer, for example # on_attach: echo rust (from loadout rust). A box stored with an empty hook list shows # Lifecycle hooks: none.

Notes from the agent: The list is in the TOML render only, as comment lines, so the output stays valid TOML. The -o json and -o yaml renders already carry the stored lifecycle_hooks with declared_by unchanged, so this change does not touch them. An inline command with more than one line shows its first line and then .... An external script shows as script <path>. A spec stored before hooks were stored has no lifecycle_hooks key and shows no list. The existing test box_spec_box_renders_stored_copy still passes. cargo clippy -p minimal --all-targets is clean.

Tests

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot)

Verify

min task run agent-verify exited 100, so this PR is a draft.

54s] ( 700/1173) minimal tests::box_cp_reads_stopped_box_as_box_017
        PASS [   0.018s] ( 701/1173) minimal tests::box_exec_detach_prints_id_and_returns
        PASS [   3.049s] ( 702/1173) minimal tests::box_attach_reattaches_pty_box
        PASS [   2.737s] ( 703/1173) minimal tests::box_attach_without_address_picks_running_else_sole_retained
        PASS [   2.457s] ( 704/1173) minimal tests::box_attach_without_address_unreachable_host_exit7
        FAIL [   0.858s] ( 705/1173) minimal tests::box_exec_show_logs_wait_stop_end_to_end
  stdout ───

    running 1 test
    test tests::box_exec_show_logs_wait_stop_end_to_end ... FAILED

    failures:

    failures:
        tests::box_exec_show_logs_wait_stop_end_to_end

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1005 filtered out; finished in 0.84s

  stderr ───

    thread 'tests::box_exec_show_logs_wait_stop_end_to_end' (4065) panicked at crates/minimal/src/tests.rs:17532:36:
    the exec stop: web has no exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01. Run `min box show web` to see the commands that run in the box now.
    commands run so far:
    $ min box exec web -t -- sh -i
      stdout: "$ "
      stderr: "01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01\n"
      exit: 0
    $ min box exec web --detach -- sh -c 'echo building; sleep 600'
      stdout: "01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02\n"
      stderr: ""
      exit: 0
    $ min box show web
      stdout: "ID:         01a1e86c-ce67-7b84-a247-f81c2bada52d\nName:       web\nType:       task\nParent:     -\nProject:    /tmp/.tmpjCTbdT\nState:      running\nIdentity:   none\nProvider:   local-minvmd\nHost:       alpha.local-minvmd0\nLive execs:\n  01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01  tty       sh -i\n  01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02  detached  sh -c 'echo building; sleep 600'\n"
      stderr: ""
      exit: 0
    $ min box logs web --exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02
      stdout: "building\n"
      stderr: ""
      exit: Ok(0)
    $ min box stop web --exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01
      stdout: ""
      stderr: ""
      exit: Err("web has no exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01. Run `min box show web` to see the commands that run in the box now.")

    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   1.176s] ( 706/1173) minimal tests::box_exec_runs_command_and_exits_with_its_code
        PASS [   0.322s] ( 707/1173) minimal tests::box_exec_t_attach_sends_configured_session_keys
        PASS [   0.928s] ( 708/1173) minimal tests::box_exec_t_invalid_session_keys_starts_no_exec
────────────
     Summary [  23.745s] 708/1173 tests run: 707 passed, 1 failed, 2 skipped
        FAIL [   0.858s] ( 705/1173) minimal tests::box_exec_show_logs_wait_stop_end_to_end
warning: 465/1173 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Closes #3283

The TOML render of a box's stored spec now opens with a comment list of
its lifecycle hooks: one line for each event, with the command, the
description and who declared the hook (minimal.toml or a loadout).
The list is comments, so the render stays valid TOML (BCLI-022, BOX-179).
@coderabbitai

coderabbitai Bot commented Nov 17, 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: 62e06eb9-0117-4b14-8e27-9a8adc9fcc7e

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

@agent-137

Copy link
Copy Markdown
Member

Undrafting at 58005420, with the owner's approval (2026-11-17). The runtime drafted this PR because its agent-verify run failed box_exec_show_logs_wait_stop_end_to_end ("web has no exec"). That is an exec end-to-end test, and this diff does not touch the exec path: it adds the hook rows to crates/minimal/src/cmd/box_spec.rs and their tests. CI is green at this head, and its unit lane passes that test. So the failure is in the runner only.

@agent-137
agent-137 marked this pull request as ready for review November 17, 2026 18:46
@agent-137
agent-137 requested a review from a team as a code owner November 17, 2026 18:46
@minimal-foundry

minimal-foundry Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 11163f8b1a7d.

Address the comments on the diff.

Clobber: none seen.

@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: CONDITIONS · 3 conditions · the full ruling

The hook list is in the correct crate, and the TOML body stays the stored spec. The description goes into a comment line without escapes. A newline in it can write lines that the stored spec does not hold, or forge a declarer. Line 490 of the design says that min box spec shows exactly what the box gets. C1 quotes the description and the script path as TOML strings. C2 marks inline commands, and C3 gives the test the name that the spec runs.

Ruled at 984d5ef against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/minimal/src/cmd/box_spec.rs Outdated
};
let description = hook
.description()
.map(|d| format!(" \"{d}\""))

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 writes the description raw into a comment. A description with a newline ends the comment and writes text that the stored spec does not hold. Render it with toml::Value::String(d.to_owned()).to_string(). Line 490 of the design says that min box spec shows exactly what the box gets.

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 8bc803887c2f: The description now prints as a one-line TOML string with its line breaks escaped. I did not use toml's Display, because it can choose a multi-line string. The test covers a description with a newline.

Comment thread crates/minimal/src/cmd/box_spec.rs Outdated
first
}
}
HookScriptBody::External(path) => format!("script {}", path.as_str()),

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 · A path can hold a newline too. Quote it as a TOML string after script , as C1 does for the description.

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 8bc803887c2f: The script path now prints as a quoted one-line TOML string after script , for example script "./cleanup.sh".

for (event, script) in events {
let Some(script) = script else { continue };
let command = match script.body() {
HookScriptBody::Inline(body) => {

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 · Prefix the inline command with inline . The row must show inline or external, and an inline body that starts with script reads as an external script now.

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 8bc803887c2f: An inline command now prints as inline "<first line>", followed by ... when the body has more lines.

Comment thread crates/minimal/src/tests.rs Outdated
// BCLI-022, BOX-179: `min box spec <box>` lists each stored lifecycle
// hook with its event, its command, its description and its declarer.
#[tokio::test]
async fn box_spec_box_lists_hooks() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C3 · Rename this test to box_spec_box_lists_hooks_with_declarer. The spec 28 verify line for the hook rows runs that name. Add the C1 case with a newline in a description here.

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 8bc803887c2f: Renamed the test to box_spec_box_lists_hooks_with_declarer. It adds a loadout hook whose description holds a newline and a quote, and an external script hook.

@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 on lines +1131 to +1135
let description = hook
.description()
.map(|d| format!(" \"{d}\""))
.unwrap_or_default();
writeln!(out, "# {event}{description}: {command} ({declarer})")?;

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.

MEDIUM · correctness · confidence 0.60 · in write_hook_list

The hook description goes into the comment line as is. A description is free-form and can hold a newline, for example a TOML multi-line string. The second line then has no #, so the TOML render is no longer valid TOML or no longer parses to the stored spec. The inline command is cut to its first line for this reason, but the description is not. Collapse the description to its first line, or replace line breaks, before you print it. Add a test with a multi-line description.

What the reviewer checked

.map(|d| format!(" "{d}"")) then writeln!(out, "# {event}{description}: ...")

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

File:       crates/minimal/src/cmd/box_spec.rs
Lines:      1131-1135
Category:   correctness
Severity:   medium (reviewer confidence 0.60)

Finding:
The hook description goes into the comment line as is. A description is free-form and can hold a newline, for example a TOML multi-line string. The second line then has no `#`, so the TOML render is no longer valid TOML or no longer parses to the stored spec. The inline command is cut to its first line for this reason, but the description is not. Collapse the description to its first line, or replace line breaks, before you print it. Add a test with a multi-line description.

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 8bc803887c2f: Line breaks in the description are escaped as \n inside a quoted string, so the row stays one comment line. The test asserts the row and parses the render as TOML.

@agent-137

Copy link
Copy Markdown
Member

/revise

Head 984d5ef9. This round answers arch ruling 1357's three conditions. Change nothing else.

1. C1: a hook's description and script path print as quoted TOML strings.
In write_hook_list() (crates/minimal/src/cmd/box_spec.rs), render the description with toml::Value::String(d.to_owned()).to_string() in place of format!(" \"{d}\""). Render the external script path after script the same way. A newline, a quote or a control character then prints as an escape, and each hook stays on one comment line, so a description cannot end the comment or forge a row.
In box_spec_box_lists_hooks_with_declarer, add a project hook whose description is "x\n# on_attach: y (from minimal.toml)". Assert that the render has exactly one row for that hook and that the whole render still parses as TOML.

2. C2: an inline hook is marked inline.
In the HookScriptBody::Inline arm of write_hook_list(), put inline before the command, as the External arm puts script . A row reads # on_attach: inline echo rust (from loadout rust). Update the expected header in the test.

3. C3: the test name matches BCLI-022's verify line.
In crates/minimal/src/tests.rs, rename box_spec_box_lists_hooks to box_spec_box_lists_hooks_with_declarer. BCLI-022's hook-listing sub-requirement (docs/specs/28-spec-box-cli/28-spec-box-cli.md, line 242) runs that name, and the task's filter box_spec_box_lists_hooks still selects it.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3283. Your note is kept and goes into the next round here, which starts when that coder finishes.

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.

A description, an inline body or a script path with a line break ended the comment row and broke the TOML render. Each value now prints as a one-line TOML string, and an inline body says inline. The test takes the name the spec verify line runs.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as 8bc803887c2f.

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot)

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "2e200b92c3d12a3f",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "f44f82fd0ca501c1",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "f44f82fd0ca501c1",
                "queued_behind": "0",
                "span_id": "a318504b245b2b15",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "2e200b92c3d12a3f",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "9181fe20724daf8d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "9181fe20724daf8d",
                "queued_behind": "0",
                "span_id": "19883b768eda9a2a",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "9181fe20724daf8d",
                "queued_behind": "0",
                "span_id": "16962defc6be32e9",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "16962defc6be32e9",
                "span_id": "63861578b167a77b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "16962defc6be32e9",
                "queued_behind": "0",
                "span_id": "18f3c73457d2690b",
                "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 [  88.730s] 1177 tests run: 1176 passed, 1 failed, 2 skipped
        FAIL [  13.140s] (1177/1177) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/box_spec.rs:1133: The description now prints as a one-line TOML string with its line breaks escaped. I did not use toml's Display, because it can choose a multi-line string. The test covers a description with a newline.
  • 👍 valid — crates/minimal/src/cmd/box_spec.rs:1129: The script path now prints as a quoted one-line TOML string after script , for example script "./cleanup.sh".
  • 👍 valid — crates/minimal/src/cmd/box_spec.rs:1120: An inline command now prints as inline "<first line>", followed by ... when the body has more lines.
  • 👍 valid — crates/minimal/src/tests.rs:18264: Renamed the test to box_spec_box_lists_hooks_with_declarer. It adds a loadout hook whose description holds a newline and a quote, and an external script hook.
  • 👍 valid — crates/minimal/src/cmd/box_spec.rs:1135: Line breaks in the description are escaped as \n inside a quoted string, so the row stays one comment line. The test asserts the row and parses the render as TOML.

min box spec <box> prints a comment row for each stored lifecycle hook. Each row shows the event, the description, the command as inline "..." or script "...", and the declarer (from minimal.toml or from loadout <name>). A line break in a value prints as an escape, so the render stays valid TOML.

Notes from the agent: Revise round 1. Each description, inline first line and script path now prints as a one-line TOML basic string through the new one_line_string helper. The helper escapes quotes, backslashes and control characters. I did not use toml::Value::String(..).to_string(), because toml can render a string that holds a newline as a multi-line string, and that string also breaks the comment. The task test line filters by substring, so it still selects the renamed test. cargo clippy -p minimal --all-targets is clean.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 17, 2026 19:14

@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 the design. min box spec <box> lists each stored hook as a comment row before the stored render. Each row shows the event, the description, inline or script, and the declarer. The rows keep the stored order, so project hooks come first (architecture.md line 1253). The fix commit escapes each value onto one line, so the render stays valid TOML. The test name now matches the BCLI-022 verify line.

Ruled at 8bc8038 against gominimal/arch@327e1b57d16b 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).

An inline hook row now reads `inline echo rust`, unquoted, as the arch
ruling asks. The description and the script path stay one-line TOML
strings. toml::Value::String prints a string with a line break as a
multi-line string, which ends the comment, so the escaper stays.

The test adds a project hook whose description tries to forge a row,
and checks that it gives exactly one row and the render is TOML.
@agent-137

Copy link
Copy Markdown
Member

Undrafting at 8bc80388, with the owner's approval (2026-11-17). The runtime drafted this PR after round 1 because commitlint failed: one body line of its commit message is 245 characters, and the limit is 100. commitlint is not a required check, and the merge queue squashes, so that message does not reach main. arch-review is PASS at this head (ruling 1357's three conditions are met), and the rest of CI is green apart from e2e, which is still running.

@agent-137
agent-137 marked this pull request as ready for review November 17, 2026 19:30
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot)

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "88d3be3c913d8dab",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "567437b2c35a5931",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "567437b2c35a5931",
                "queued_behind": "0",
                "span_id": "f1f37927c312acbf",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "88d3be3c913d8dab",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "7c545a5a27080d98",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "7c545a5a27080d98",
                "queued_behind": "0",
                "span_id": "f95c63d1e5c11d9b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "7c545a5a27080d98",
                "queued_behind": "0",
                "span_id": "79c92056101ac4cf",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "79c92056101ac4cf",
                "span_id": "aaf3e878a47e9fda",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "79c92056101ac4cf",
                "queued_behind": "0",
                "span_id": "f4c52e19f1a4b8bb",
                "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 [  85.176s] 1177 tests run: 1176 passed, 1 failed, 2 skipped
        FAIL [  13.056s] (1177/1177) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

min box spec <box> lists each stored lifecycle hook on one comment row with its event, its description, its command (inline <command> or script "<path>") and its declarer (from minimal.toml or from loadout <name>). A description with a line break cannot forge a second row, and the render stays valid TOML.

Notes from the agent: C1: the note asks for toml::Value::String(d.to_owned()).to_string(). I tried it. With toml 1.1.6 it prints a string that holds a newline as a multi-line """ string. That splits the row across lines, and the new forged-row test failed with it. So the description and the script path keep the hand-written one-line TOML escaper (one_line_string) from the previous round. It gives the result that C1 asks for: each hook on one comment row, and the render parses as TOML. C2: the inline arm now prints inline <first line> unquoted, as the note's example row shows. The previous round quoted it. One residual risk: lines() removes line breaks, but a different control character in an inline body (a lone \r, for example) now goes into the comment unescaped and can make the render invalid TOML. I did not add a guard because the note says to change nothing else. C3: the test name box_spec_box_lists_hooks_with_declarer was already in place from the previous commit. The test now has the project hook with the description "x\n# on_attach: y (from minimal.toml)". It asserts exactly one row for that hook and that the render parses as TOML. just clippy-strict was not run.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 17, 2026 19:41
@agent-137

Copy link
Copy Markdown
Member

Undrafting at 475b3a9a, for the same reason as at 8bc80388 (owner's approval, 2026-11-17). The runtime re-drafted after round 2, which answered minimal-review's finding. The only red is still commitlint, on 8bc80388's 245-character body line. That check is not required, and the queue squashes. 475b3a9a's own message passes.

@agent-137
agent-137 marked this pull request as ready for review November 17, 2026 19:42

@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: CONDITIONS · 1 condition · the full ruling

The last commit prints the first line of an inline hook body without an escape. str::lines() removes only \n. A lone \r or another control character in a stored body goes into the comment row as a raw character. Then the terminal can show a different command from the one the box runs, and the TOML render is not valid TOML. Line 490 of the architecture says min box spec shows exactly what an entry will get. Make the change in C1: put one_line_string() back on that line, and add a test with a \r in an inline body.

Ruled at 475b3a9 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/minimal/src/cmd/box_spec.rs Outdated
let command = match script.body() {
HookScriptBody::Inline(body) => {
let mut lines = body.trim().lines();
let first = lines.next().unwrap_or_default();

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 prints the first line of the inline body raw. lines() splits only on \n, so a lone \r or an ESC sequence stays. A raw \r lets the row show a different command from the one that runs (architecture.md line 490). Use one_line_string(lines.next().unwrap_or_default()) here, as at 8bc8038.

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 11163f8b1a7d: The inline first line now goes through one_line_string, so a lone \r or an ESC prints escaped in the row.

Comment thread crates/minimal/src/tests.rs Outdated
let header = format!(
"# The spec box {id} was created with.\n\
# Lifecycle hooks:\n\
# on_activate \"Warm the cache\": inline echo project (from minimal.toml)\n\

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 · Put the quoted inline forms back in these expected rows. Add a project hook whose inline value contains a lone \r. Assert that the row shows it escaped, and that no line of the render contains a raw \r.

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 11163f8b1a7d: Restored the quoted inline rows, added a project hook with a lone \r in its inline value, and asserted it prints escaped with no raw \r in any line.

@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 on lines +1109 to +1117
}
};
let events: [(&str, Option<&HookScript>); 4] = [
("on_activate", hook.on_activate()),
("on_destroy", hook.on_destroy()),
("on_attach", hook.on_attach()),
("on_detach", hook.on_detach()),
];
for (event, script) in events {

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.55 · in write_hook_list

The first line of an inline command is printed raw into a # comment. str::lines splits only on \n, so a lone \r or another control character in the body stays in the comment line. A TOML parser rejects control characters in a comment, so the render stops being valid TOML. The description and script path use one_line_string for this reason. Apply the same escaping to the inline first line.

What the reviewer checked

format!("inline {first} ...") with first from body.trim().lines().next(), not passed through one_line_string

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

File:       crates/minimal/src/cmd/box_spec.rs
Lines:      1109-1117
Category:   correctness
Severity:   low (reviewer confidence 0.55)

Finding:
The first line of an inline command is printed raw into a `#` comment. `str::lines` splits only on `\n`, so a lone `\r` or another control character in the body stays in the comment line. A TOML parser rejects control characters in a comment, so the render stops being valid TOML. The description and script path use `one_line_string` for this reason. Apply the same escaping to the inline first line.

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 11163f8b1a7d: The inline first line is escaped with one_line_string, the same as the description and the script path, so the render stays valid TOML.

@agent-137

Copy link
Copy Markdown
Member

/revise

Head 475b3a9a. This round answers arch ruling 1361's C1 and minimal-review's LOW finding on the same line. Round 2 reopened the defect that ruling 1357 closed. Change nothing else.

1. C1 (PRRT_kwDOPdfcxM64nr_x, PRRT_kwDOPdfcxM64nsAA) and minimal-review LOW (PRRT_kwDOPdfcxM64nsgp): escape an inline body's first line again.
In the HookScriptBody::Inline arm of write_hook_list() (crates/minimal/src/cmd/box_spec.rs, about line 1122), write let first = one_line_string(lines.next().unwrap_or_default());, as at 8bc80388. str::lines() splits only on \n. A lone \r, an ESC sequence or another control character otherwise stays in the row. A terminal then shows a different command from the one that runs, and the render stops being valid TOML. Keep the inline prefix. Every value in a hook row is a quoted, escaped TOML string: the description, the inline first line and the script path.

  • Move the code comment that round 2 added above the External arm onto the arm it describes.
  • In box_spec_box_lists_hooks_with_declarer (crates/minimal/src/tests.rs), put the quoted inline forms back in the expected header: inline \"echo project\", inline \"echo bye\" ..., inline \"echo x\" and inline \"echo rust\".
  • Add a project hook whose inline value is "echo a\rforged". Assert that its row prints \r escaped, as \\r in the Rust literal, and that no line of the render contains a raw \r. Keep asserting that the whole render parses as TOML.

2. Threads. Reply with the commit on the three threads above. Ruling 1357's C1, C2 and C3 threads (PRRT_kwDOPdfcxM64mOlk, PRRT_kwDOPdfcxM64mOlo, PRRT_kwDOPdfcxM64mOls, PRRT_kwDOPdfcxM64mOl1) and minimal-review's MEDIUM thread (PRRT_kwDOPdfcxM64mPPQ) were fixed by 8bc80388. Reply on each with 8bc80388, plus this round's commit where it touches the same line.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3283. Your note is kept and goes into the next round here, which starts when that coder finishes.

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.

The first line of an inline hook body printed raw. str::lines splits
only on \n, so a lone \r or another control character stayed in the
comment row. The row now quotes it as a one-line TOML string, as it
does the description and the script path. The test adds a project hook
with a lone \r and checks that no line of the render holds a raw \r.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on the runtime's review findings, pushed as 11163f8b1a7d.

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot)

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "57b978233523b16e",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "a5c2aa4e4a8d1540",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "a5c2aa4e4a8d1540",
                "queued_behind": "0",
                "span_id": "35904747253ad9ad",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "57b978233523b16e",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "1af8ccde40cf97d3",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "1af8ccde40cf97d3",
                "queued_behind": "0",
                "span_id": "20f3caf068426fa4",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "1af8ccde40cf97d3",
                "queued_behind": "0",
                "span_id": "cbef4b50dbb53b07",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "cbef4b50dbb53b07",
                "span_id": "c47aacb293b149fb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "cbef4b50dbb53b07",
                "queued_behind": "0",
                "span_id": "7dbc2d8d683d89e1",
                "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 [  82.690s] 1177 tests run: 1176 passed, 1 failed, 2 skipped
        FAIL [  13.007s] (1177/1177) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/box_spec.rs: The inline first line now goes through one_line_string, so a lone \r or an ESC prints escaped in the row.
  • 👍 valid — crates/minimal/src/tests.rs: Restored the quoted inline rows, added a project hook with a lone \r in its inline value, and asserted it prints escaped with no raw \r in any line.
  • 👍 valid — crates/minimal/src/cmd/box_spec.rs:1117: The inline first line is escaped with one_line_string, the same as the description and the script path, so the render stays valid TOML.

min box spec <box> lists each stored lifecycle hook as a comment row with its event, its description, its command (inline "" or script "") and its declarer. Every value prints as a one-line TOML string, so a line break or a lone \r cannot forge a row or break the TOML render.

Notes from the agent: This round puts the one_line_string escaping back on the first line of an inline hook body. The previous round removed it. The expected rows in the test show the quoted inline forms again. A new project hook with an inline value that holds a lone \r checks that the row shows it escaped and that no line of the render holds a raw \r.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 17, 2026 20:02

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

@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 fix commit escapes the first line of an inline hook body. A lone carriage return or another control character can no longer end the comment row or forge a row. The render is the spec as stored, as architecture.md line 477 requires. The test proves this with a hook that holds a lone \r. The loadout name in the declarer still prints raw. That line is outside this compare, and you can escape it in a follow-up.

Ruled at 11163f8 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

The directive names this value for the lone carriage-return case.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a /revise note, pushed as f0db4dfa6a0e.

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "92f2fe65dfbab238",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "7eebb2650ec188a8",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "7eebb2650ec188a8",
                "queued_behind": "0",
                "span_id": "6ab04a513614b409",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "92f2fe65dfbab238",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "75b238d6196d8f9d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "75b238d6196d8f9d",
                "queued_behind": "0",
                "span_id": "b6d250c788b0805a",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "75b238d6196d8f9d",
                "queued_behind": "0",
                "span_id": "16c88dda1d5e8785",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "16c88dda1d5e8785",
                "span_id": "3557d87e4eab28bb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "16c88dda1d5e8785",
                "queued_behind": "0",
                "span_id": "84c2025450eaca79",
                "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 [  89.929s] 1182 tests run: 1181 passed, 1 failed, 2 skipped
        FAIL [  13.385s] (1182/1182) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

min box spec <box> lists each stored lifecycle hook with its event, its description, its command and its declarer. Each value prints as a quoted, escaped one-line TOML string. An inline command prints as inline "<first line>", and a script prints as script "<path>". A lone carriage return in an inline command prints as \r and cannot change the row that a terminal shows.

Notes from the agent: Commit 11163f8 (round 3) already made the code change for item 1. The Inline arm of write_hook_list uses one_line_string(lines.next().unwrap_or_default()) and keeps the inline prefix. The comment is on the Inline arm. The expected header has the quoted inline forms again. The test asserts that no line holds a raw \r and that the render parses as TOML. This round, commit f0db4df changes only the carriage-return test value from "echo a\recho b" to the "echo a\rforged" value that the directive names. The directive listed no unresolved threads. Every thread is under 'Threads already answered' with a valid verdict, so threads is empty. For the replies: 8bc8038 fixed PRRT_kwDOPdfcxM64mOlk, PRRT_kwDOPdfcxM64mOlo, PRRT_kwDOPdfcxM64mOls, PRRT_kwDOPdfcxM64mOl1 and PRRT_kwDOPdfcxM64mPPQ. 11163f8 fixed PRRT_kwDOPdfcxM64nr_x and PRRT_kwDOPdfcxM64nsgp. 11163f8 and f0db4df fixed PRRT_kwDOPdfcxM64nsAA.

This branch has not been deployed

No deployments
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.

T41 — Box spec lists a box's hooks with their declarer

2 participants