M5b plan: task 09, TurnDone.untrusted from the session's log

bxcore's TurnDone gains untrusted: bool, always written and required
when read (no serde default: a missing field would read as a clean
session, the wrong way to fail). loopd's new Session::untrusted is true
once any ToolResult in the log is labelled untrusted, and channel::handle
puts it in the TurnDone; the log is the one source, so it holds across
resumes and restarts. gatewayd, bxctl and brokerd sources are unchanged;
their tests that build a TurnDone get new versions. Task 01's broker.rs
is kept as broker.rs-task01, and task 01 now copies it.

Checks: the given tests fail at ref 08 as the task says (strict's
turn_done.json, and 13 test targets with E0560/E0609 only); the task's
edits applied from its text to a fresh ref 08 tree are byte-identical to
the reference; the gate passes with 1058 tests; 12 mutations caught;
/private/tmp and TMPDIR unchanged around the runs; no tag in plan or
given files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 06:37:03 -07:00
co-authored by Claude Opus 5.5
parent d4b7f42b56
commit 8658af58b7
11 changed files with 1907 additions and 3 deletions
@@ -52,7 +52,8 @@ This is the complete list. Each one is covered by an edit below or by a given fi
`crates/brokerd/tests/invalid_detail.rs`
- **new versions** of: `crates/bxcore/tests/wire.rs`, `crates/bxcore/tests/strict.rs`;
`crates/brokerd/tests/admin.rs`, `broker.rs`, `broker_pending.rs`, `courier.rs`, `ledger.rs`,
`serve.rs`; `crates/loopd/tests/broker_port.rs`, `tools.rs`, `turn_broker.rs`
`serve.rs`; `crates/loopd/tests/broker_port.rs`, `tools.rs`, `turn_broker.rs`. Your
`broker.rs` is the given `broker.rs-task01`: the given `broker.rs` is task 09's.
- Modify: `crates/bxcore/src/wire.rs`, `crates/brokerd/src/args.rs`,
`crates/brokerd/src/policy/mod.rs`, `crates/brokerd/src/ledger/mod.rs`,
`crates/brokerd/src/broker.rs`, `crates/loopd/src/tools.rs`, `crates/loopd/src/turn.rs`,
@@ -489,8 +490,8 @@ The event keeps only the reason: the owner's texts do not change.
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/admin.rs \
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/broker.rs \
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/broker.rs-task01 \
crates/brokerd/tests/broker.rs
cp docs/plans/M5b/files/crates/brokerd/tests/broker_pending.rs \
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/courier.rs \