diff --git a/agents/webby/work/queue-230/REVIEW-r1.md b/agents/webby/work/queue-230/REVIEW-r1.md new file mode 100644 index 000000000..f1b35525c --- /dev/null +++ b/agents/webby/work/queue-230/REVIEW-r1.md @@ -0,0 +1,122 @@ +# Webby review: row 230 (C2-13a, #1732), round 1 + +Webby, 2026-10-20T23:50Z (from `date -u`). Author: Gosalyn (gosalyn-0071). Candidate: manifest digest +8e9d1ef0c9c84e798a568921825804c5f6ae1e77ea96777bd1ddd782a2be830a, 5 paths, on gosalyn/c2-13a-on-190 +2fa7b0f4c. Base 00d4cc1f6 is its ancestor. Brief: docs/plans/2026-10-20_case2-rows.md "C2-13a", blob +f6b4933f0f47. + +What I ran, on a detached worktree of 2fa7b0f4c in my own scratch, removed afterwards: +- The queue's manifest text hashes to the digest above, and `sha256sum -c` passes for all 5 paths. +- Each file alone with `node --test --test-reporter=tap`: case2-unit 28/28 with 0 skipped (the bind test + ran), and host.test.mjs 42/42. host.test.mjs reads the cli README (:855). +- A grep of `packages/*/tests/*` and `scripts/test-*.sh` for the two script names finds only + case2-unit.test.mjs. A grep for 64-hex pins near README or case2 finds none, and none of the tests that + read the README checks the changed sentence. + +I ran no mutants. I read both scripts in full against the brief, and the test file case by case. + +## Verdict: CHANGES (B1) + +### B1. Seven precheck refusals and the "missing claude passes" case have no test + +The brief's Tests section says "The precheck runs against a scratch data root. Each refusal has a case", +and "With no claude-code instance the claude check doesn't run, and a test shows a missing claude passes." +A grep of case2-unit.test.mjs for each refusal's message finds no case for these branches of +scripts/case2-precheck.sh: +- :77, the user isn't in the passwd database. +- :137, the business file doesn't load (bad JSON, or `loadBusiness` refuses it). +- :151, the run root is a symlink. This one matters most. `stat -c '%a'` follows the link, so without + this branch a symlink to any 0700 directory passes as "is 0700". Nothing would catch its removal. +- :179, the installed Console unit's ExecStart has no `--port`. +- :180, `ip_unprivileged_port_start` can't be read. +- :223, claude replies without the marker (`nomarker`). +- :224, claude gives no JSON reply. + +The "no claude-code instance" case at case2-unit.test.mjs:515-518 doesn't show that a missing claude +passes. Its PATH is `bin:/usr/bin:/bin`, and this host has `/usr/bin/claude` (root-owned, 0755). The +`missing` case at :532-536 already builds a PATH without it. The no-route case needs the same PATH so +the claude really is missing. + +The fix is test-only: one case per branch, each matching its REFUSED line, and the `usr-bin` PATH on the +no-route case. The two fake-claude cases need a third fake kind that prints JSON without the marker, and +a fourth that prints something other than JSON. + +## Deviations (sage-1570 accepted them for the build) + +1. `--business ID` on the precheck: accept. The brief names no other way to find the business file. +2. A missing run root passes: accept. `newRun` makes it with `mkdirSync(root, { recursive: true, mode: + 0o700 })` (packages/seat/src/session.mjs:109), so before the first launch there is nothing to check. + The symlink branch still needs its test (B1). +3. The unmeasured 2000-token ceiling: accept. A wrong ceiling fails safe. Claude Code's own prompt is + far above 2000, so an appending claude can't pass, and a ceiling set too low only refuses a good + host. Row 195's install run measures it. Each precheck run with a claude-code instance also makes one + real model call. That's small, but the operator should know it. +4. The fake getent uid for the proof-owner case: accept. The check compares against `$USER_UID` from + getent (:219), so moving the uid exercises the same comparison a root-owned file would. +5. Refusing `%h` left in any unit: accept. A system unit reads `%h` as root's home. +6. 64 lower-case hex for the allowed user with X-Authentik-Uid: accept. It matches decision 101, and + :298-299 test both sides. + +## What I checked and found right + +- The render. Every token has one value, as the brief lists. `@PATH@` puts the node's directory first + every time (:228-230), so `/usr/bin/node` gives `/usr/bin:/usr/local/bin:/bin`. `@CONFIG_ENV@` is + deleted and `@SESSION_ENV@` is the `%h` path, as instance.sh:88-90 does for the default instance. `%h` + then becomes the literal home. Values going into sed and awk pass `plain` (:55), so none holds `|`, `&`, + `\` or `%`. `@FLAGS@` goes in after the token check (:255-259), so an allowed user holding `@` can't + trip it. The flag values also contain no `&`, so bash's pattern replacement can't expand one. +- The added lines. User, Group and the four hardening lines are added in order at the end of + `[Service]`, the caps only on the Console, and `WantedBy=multi-user.target` replaces + `default.target` in both units. No `After=` or `Wants=`. +- The checks (:302-359). Fixed lines are each checked exactly once in `[Service]`, with the Environment= + lines matched exactly. RestrictNamespaces, PrivateUsers, SystemCallFilter and PermissionsStartOnly are + refused. The Exec prefix check reads the whole leading run of `-@:+!`, so `-+` is caught. A continued + line refuses, so nothing hides on one. +- The re-install. Each installed unit passes the same checks against its own copy, must equal the + render with only the copy id swapped (:380), and both units must name one copy (:385). So the node, + flags, `--pm` and `--claude` can't drift. +- The inputs. `--node` and `--claude` must be absolute, plain and normalized, not a symlink, outside + ``, and root-owned and not group- or other-writable all the way up to `/` (:114-124). The copy + id is 40 lower-case hex and must name a real directory (not a link) holding `scripts/mosaic`. The proof + file is checked by metadata only: no symlink anywhere in its path (`realpath -e` equality), under + `/.config/mosaic-dev/secrets`, owned by the user's uid, 0600 or 0400. It is never opened. +- The serve flags match the brief for both profiles. The `--tester-port` equal to `--port` case is + unreachable through the ranges (1..1023 against 1024..65535). The test at :351-356 says so, and the + guard stays. +- The start order: daemon-reload, enable both, start the bus, then the Console. A failed bus start + stops before the Console starts (:403). +- The precheck never prints a session env value. Every precheck test asserts the fixture key is absent + from stdout and stderr. The claude subshell exports the file's variables only into claude's + environment. +- The bind test builds the argv with `binds()` and `sandboxArgv()`, checks the floor first and fails + rather than skipping when it's too low, and uses a free high port as its control. + +## Non-blocking + +N1. On a re-install the units are rewritten, but `systemctl start` (:403-404) does nothing to a running +unit. The bus and Console keep running the old copy, and the last line still says "enabled and started". +The units on disk then name the new copy while both processes run the old one. If the bus later restarts +on its own (`Restart=on-failure`, mosaic-bus.service.in:32), it comes back on the new copy while the +Console stays on the old one. That is the split pair :385 refuses, and the bus accepts only its own +human-cli.mjs path. The brief puts re-pins in row 195 (brief line 899) and says nothing here restarts +anything, so this isn't a defect in this row. Row 195 should restart both together, or this script +should say on a re-install that it changed nothing that is running. + +N2. A drop-in overrides every line this script checks. Examples are +`/etc/systemd/system/mosaic-webui.service.d/*.conf`, `mosaic-bus@.service.d/`, +`mosaic-bus@.service.d/` and the global `service.d/`. A unit file named +`mosaic-bus@.service` replaces the template altogether. Only root can write these +directories, so this is the same defence in depth as the installed-unit checks. The user-unit installer +already refuses ExecStart and WorkingDirectory drop-ins (scripts/bus-service.sh:122-145, globs from +instance.sh:88). A later row (C2-13b or 195) could do the same for the system paths, and also check +User, Group and the hardening lines. + +N3. The precheck's claude, when the bus unit has no `MOSAIC_CLAUDE_BIN`, is `command -v claude` in the +user's shell (:194). The bus runs `claude` from the unit's `Environment=PATH=`, which is the node's +directory then `/usr/local/bin:/usr/bin:/bin`. A claude in `~/.local/bin` would be checked while the bus +runs a different one, or none. This matches the brief's words ("`claude` on PATH"). Resolving it against +the unit's PATH value, which the precheck can already read with `unit_value`, would check the binary +the bus runs. + +N4. Doc-only. The changed README line (packages/cli/README.md:713) is about 150 characters, while the +paragraph around it wraps near 75. No test reads the sentence. diff --git a/docs/SESSIONS.md b/docs/SESSIONS.md index df047b327..26f3024dd 100644 --- a/docs/SESSIONS.md +++ b/docs/SESSIONS.md @@ -1397,3 +1397,4 @@ are never rewritten or removed; corrections are new entries. 2026-10-20T21:48Z | Webby (Opus 5.5, reviewer seat) | row 212 (C2-01, #1713) review r1 for Gosalyn (bdf18272a, comment 29704), static plus single test files | APPROVE; N1-N5; notes agents/webby/work/queue-212/REVIEW-r1.md 2026-10-20T21:53Z | Webby (Opus 5.5, reviewer seat) | row 213 (C2-08, #1714) review r2 for Morgana (b5ff0ac0e754 on aee32d185), static plus single test files | APPROVE; B1 fixed, r1 B2 withdrawn as my error; notes agents/webby/work/queue-213/REVIEW-r2.md 2026-10-20T23:29Z | Webby (Opus 5.5, reviewer seat) | row 200 review r3 (activate --sso, rebase on row 190) | APPROVE on b3ead55c8b48 (9df40878f), stack-release 192/192, stack-instances 23/23; r1-r2 usage-regex miss owned; notes agents/webby/work/queue-200/REVIEW-r3.md +2026-10-20T23:50Z | Webby (Opus 5.5, reviewer seat) | row 230 review r1 (C2-13a, gosalyn/c2-13a-on-190 2fa7b0f4c, digest 8e9d1ef0c9c8) | changes B1 (7 precheck refusals and missing-claude case untested), N1-N4, six deviations accepted; notes agents/webby/work/queue-230/REVIEW-r1.md