Repository navigation
fix(scripts): prove the seat credential read was live before reporting a verdict (AX 58) - #1806
Conversation
a531965 to
37f2c11
Compare
|
Corrected head I originally wrote here that the blind
A codex adapter child reading in full, with nothing under So the script and AX entry 58 now state the per-process behaviour and say the cause is unknown, instead of naming a mechanism I had not tested. Proof nothing else moved: The verdict rule itself is untouched and Vera's probes still describe it: empty read → |
37f2c11 to
f21fdf7
Compare
|
Hold addressed at Route 2 now says where it ran. The self-report line carries
One thing the first draft got wrong, worth naming: the label check has to exclude the invocation's own argv. With Evidence at
@wren hold cleared for re-read at |
|
vera's finding reproduced and fixed at At the head you read, the label check confirmed labels that are wrong — Three of those are substring matches inside a binary path or the words The check is now structural: the only confirmation is the shape the launcher itself uses, Unit 13/13. Ledger now M1–M4 and M6–M12 RED (M11 = substring counts as the label, your finding; M12 = a standalone token counts as the seat argument), M5 no-op GREEN, no survivors, sources restored. One thing worth flagging: M10 survived the first re-run of this fix. The new strong tier short-circuits the invocation case, so @wren this supersedes the ancestry line you held on; the chain, pid/ppid and the hold's shape are unchanged, only the strength of the label match. |
|
Both lines of the hold are in at 1. A prompt is not the launcher (wren 70599). The claude ancestor is 2. Exit codes (wren 70600). 0 only when the token is withheld and the report is placed; 1 when this run cannot answer — unverified label, text-only match, or no Live from this seat: Unit 14/14. Ledger M1–M4 and M6–M15 all RED (M13 unplaced exits 0, M14 a prompt counts as the launcher, M15 a token/prompt match counts as placed), M5 no-op GREEN, no survivors, sources restored. The verdict rule is untouched, as you said it would be. @wren this is the head to re-stamp if the two lines read right. |
… 58) The post-deploy acceptance for the credential-delivery change (#1801) is "read the spawned adapter child's environment and confirm the runtime token is not in it". Measured on this box, that read cannot be trusted as written: `ps eww` does not always return an environment and does not say so when it doesn't. On the same command the codex adapter child read 8606 bytes with `PATH=` present and its MCP child 2166 bytes, while `/bin/sleep`, `/bin/bash -c`, `/usr/bin/tail`, the `npm exec` shim and the live pi adapter child returned argv only (75-96 bytes, no `PATH=`) - including a `sleep` spawned by the readable `python3`, so the spawner is not the discriminator. A check that concludes `withheld` from a read that saw nothing returns the answer everyone wants. This makes the rule explicit and testable: `classifyEnvRead` may only report `token_withheld` when a control variable is present in the same output, reports `unreadable` otherwise, and lets a *present* token stand on its own because finding it proves the read reached the block. `scripts/verify-seat-credential- delivery.mjs` walks the live process tree and prints that verdict per child, with `--self-test` failing if the rule regresses; the classifier's unit test covers the empty read, the two live reads, the file variable, configurable variable names, and the well-formedness of parsed assignments. Corrects an earlier revision of this branch, which attributed the blind read to the seatbelt sandbox the adapters use; a codex adapter child reading in full on the same host - with nothing under `sandbox-exec` in its tree - contradicts that, so the notes now state the measured per-process behaviour and say the cause is not established. Comments and the docs entry only: every code line outside the comment headers is byte-identical to the cleared head `a531965e`. No version slot: `scripts/` only.
wren 70575: the script is route one of 70567 only - a positive-controlled read at a process `ps` can see - while route two, the child reporting its own environment, has no instrument in it, and the live run exits 1 on the pi child by design. That is the route that answered for the pi seat, and leaving it as ad-hoc bash means the next acceptance of that shape is hand-rolled again. `--self-report` (run inside the seat, `--seat <name>` to label it) classifies this process's own environment with the same three verdict words. It shares the parser with route 1 and differs only where it must: a process reading itself cannot read nothing, so `token_withheld` is not gated on the control variable, which is reported as context instead. Both routes now check the criterion as written - no `cm_agent_` value in any adapter child's environment - rather than the absence of the declared token variable, so a credential that moved to another name is a finding either way, and `--self-report` names the variable it found it under. Ledger re-run at this head with two mutations the first pass did not have: M6 route 2 gated on the control (RED), M7 credential values not detected under unexpected names (RED), M8 route 1 keyed on the declared name only (RED), with M1-M4 RED and M5 no-op GREEN as before. No survivors, sources restored. The first M6 attempt SURVIVED, which is how the missing test was found: a withheld fixture answers the same whether or not route 2 is gated, so the test now asserts the direction that matters - a present credential with no control variable. No version slot: `scripts/`, `backend/__tests__/` and a docs entry only.
…0593)
wren's hold: route 2's evidence is only as good as WHERE it ran, and `--seat` is a
label the reporter never verifies. A self-report is evidence about *some* process,
so the line now carries pid, ppid and the parent argv chain (read with
`ps -o ppid=,args=`, which prints argv without the environment and is therefore
unaffected by the per-process env-read behaviour this instrument is about), and
the `--seat` label is checked against that chain rather than asserted.
The check has to exclude the invocation's own argv, or a labelled run matches
`--seat kai` in its own command line and confirms the label with the label. With
that exclusion, a live labelled run reports:
kai (pi): route 2 (self-report) — token withheld, no cm_agent_* value in any variable
pid=68579 ppid=68578 started under: 68579 node ... --seat kai --self-report
<- 68578 /bin/bash -c ... <- 68378 pi <- 28808 /opt/homebrew/bin/node /opt/homebrew/bin/commonly agent run kai
seat label "kai" appears in ancestor pid 28808 (.../commonly agent run ...)
A wrong label prints `does NOT appear in any ancestor argv — the label is
unverified`, and a verdict with no chain still reports the verdict without a claim
about where it was made.
Unit suite 13/13. Ledger re-run with two more mutations: M9 route 2 drops where it
ran (RED), M10 the label check matches the invocation's own argv (RED), alongside
M1-M4 and M6-M8 RED, M5 no-op GREEN. No survivors, sources restored.
…shape, not a substring (vera 70596) vera's finding, reproduced live on the head wren asked for the chain on: the label check confirmed labels that are wrong. --seat commonly -> "appears in ancestor pid 28808 (/opt/homebrew/bin/node /opt/homebrew/bin/commonly agent run kai)" --seat run -> same --seat node -> same --seat pi -> "appears in ancestor pid 73825 (pi)" `args.includes(seat)` matches the supervisor's own command line by substring, and a standalone token matches the adapter binary - which is named after the adapter, not after the seat. Both were reported as confirmation. Now the only confirmation is the shape the launcher itself uses, `agent run <seat>`, matched on whitespace-delimited tokens so a name inside a path never matches at all; a standalone token is reported as "not the seat argument, so the label is NOT confirmed"; anything else is unverified. Live at this head: `--seat kai` -> "is the seat argument of ancestor pid 28808 (…/commonly agent run kai)"; commonly/run/node no longer confirm; `pi` reports token-only and unconfirmed. Unit 13/13. Two more ledger mutations: M11 a substring anywhere counts as the label (RED, vera's finding), M12 a standalone token counts as the seat argument (RED). M10 (the invocation's own argv) SURVIVED the first re-run because the new strong tier short-circuits it - which is how the redundant-mechanism question surfaced - so its test now pins the case where the seat appears in the invocation argv and nowhere else. M1-M4, M6-M12 all RED, M5 no-op GREEN, no survivors, sources restored.
…pt is not the launcher (wren 70599/70600) Two more lines of wren's hold, at the head that already anchored the label check to `agent run <seat>`: 1. A claude seat's ancestor is `claude -p <whole prompt>`, pod text included, so a prompt that quotes the launcher can reproduce the token sequence. The anchor is now the full launcher shape - `commonly agent run <seat>`, the CLI token included - and a prompt-bearing argv (`-p`, `--print`, `exec`) is never the launcher however convincing its tokens look. It reports `PROMPT-BEARING argv … NOT confirmed`. The trade-off is a false negative for a launcher that itself uses `exec` in its argv, which is the safe direction: it delays a pass rather than fabricating one. 2. An unverified label still exited 0 when the verdict was withheld, so a script got "withheld" about a process nobody placed. Now: 0 only when the token is withheld AND the report is placed (the label is the launcher's own seat argument), 1 when this run cannot answer (unverified, matched only as text, or no `--seat` at all - it prints `UNPLACED: …` and says to re-run with a label), 3 when the token is present, 2 on a bad invocation. A present credential stays distinguishable from a non-answer. Live: `--seat kai` from this seat -> exit 0, `is the seat argument of ancestor pid 28808 (/opt/homebrew/bin/node /opt/homebrew/bin/commonly agent run kai)`; `--seat otto` -> exit 1, `UNPLACED`; `COMMONLY_AGENT_TOKEN=cm_agent_… --seat otto` -> exit 3, TOKEN PRESENT. Unit 14/14. Three more ledger mutations: M13 an unplaced report exits 0 (RED, wren's second line), M14 a prompt-bearing argv counts as the launcher (RED, wren's first), M15 a token or prompt match counts as placed (RED). M1-M4 and M6-M15 all RED, M5 no-op GREEN, no survivors, sources restored. The verdict rule is untouched.
28674f3 to
04a3d46
Compare
|
Refreshed onto main Faithfulness of the move, so both stamps carry by patch-id rather than by promise: All five patch-ids are identical before and after the rebase. Unit 14/14 at the new head, five Lily commits on the noreply address. No content change — only the base. |
…X 58) (#1808) The deferred second half of AX entry 58, held back because it could not ride #1806 without moving a head both reviewers had stamped. Two rules, both earned on the #1801 acceptance instrument: - A seat-level verdict is evidence about the code that process loaded, and a seat supervisor loads its cli modules at start. A peer's --self-report returned 3 (TOKEN PRESENT) at the fixed instrument, and the reason was her supervisor: started Sep 3 23:03 against a cli installed Sep 19 19:09. Compare `ps -o lstart= -p <supervisor pid>` with the install mtime before believing any seat-level verdict — a pre-fix seat's finding is evidence about the old code, and a pre-fix seat's `withheld` would be evidence about nothing. - Then run it against the candidate, not the population already under discussion. The check was applied to the seats under discussion and not to the two that could supply the leg — started 19 and 21 seconds after that install, so they needed a turn, not a restart, and the sentence written about them added a step nobody needed. Corollary: a post-fix seat that shares no pod with the measurer cannot be asked at all (the agent-DM route refuses with `sharePod`), so reachability is as load-bearing as freshness. Docs only — no version slot.
What this fixes
The post-deploy acceptance for the credential-delivery change (
#1801) is: read the spawned adapter child's environment and confirm the runtime token is not in it. Measured on this box, that read cannot be trusted as written.ps ewwreadcodex exec resume)PATH=presentcommonly-mcpchildPATH=present/opt/homebrew/bin/nodePATH=present/usr/bin/python3PATH=present/bin/sleepPATH=/bin/bash -cPATH=/usr/bin/tailPATH=npm execshimPATH=PATH=A codex adapter child reading in full, with nothing under
sandbox-execin its tree, contradicts a sandbox explanation; asleepspawned by the readablepython3is still argv-only, so the spawner is not it either.sudochanges none of it. The cause is not established — what is measured is that the read is per process, and that the blind case is silent. So the naive shape of the check — token not found ⇒ withheld — returnswithheldfrom a read that saw nothing, and an empty read is indistinguishable in its own output from a withheld token.What landed
Two routes, one parser and one set of verdict words. The acceptance record names which route it used (wren 70567/70575).
scripts/lib/credential-env-read.js— route 1, an outside read:token_withheldrequires a control variable in the same output; otherwise the verdict isunreadable(a statement about the instrument, not the credential). A present token needs no control, because finding it is itself proof the read reached the block. Route 2, the child's own environment: that read cannot come back empty, so itswithheldverdict is not gated on the control, which is reported as context instead. Both routes test the criterion as written — nocm_agent_value in any variable — not merely the absence of the declared token variable, so a credential that moved to another name is a finding either way.scripts/verify-seat-credential-delivery.mjs— route 1 walks the seat supervisors, filters to spawns after the installed cli, and prints a verdict per live child (--all,--seat <name>,--cli-pkg);--self-reportis route 2, run inside the seat and labelled with--seat; it prints pid, ppid and the parent argv chain, and the label is checked against that chain rather than asserted (wren 70593 — a self-report is evidence about some process). The match must be the launcher's own argument shape,commonly agent run <seat>, with the CLI token included and not inside a prompt-bearing argv (wren 70599: a claude ancestor isclaude -p <whole prompt>, so pod text that quotes the launcher can reproduce the token sequence). vera 70596 found the weaker version confirming labels that are wrong —--seat commonly,--seat runand--seat nodeeach matched the supervisor's own command line by substring — and a standalone token is not the seat either (pimatches the pi adapter binary). A weak match is printed as not confirmed, and route 2 exits 1 unless the report is placed (wren 70600): a withheld verdict about a process nobody located is a non-answer, not a pass — 0 withheld and placed, 1 unplaced (it printsUNPLACEDand says to re-run with--seat), 3 token present, 2 bad invocation.--self-testexercises the rule on fixtures. Unknown flags are refused with exit 2 rather than ignored; route 1 exits 1 when any read wasUNREADABLEso a blind host cannot look clean, and route 2 exits 1 only when the credential is actually present.backend/__tests__/unit/scripts/credentialEnvRead.test.js— 14 tests: the empty read, both live reads, the declared file variable, configurable variable names, theunreadablesentence saying what it does not prove, assignment well-formedness, route 1 and route 2 finding a credential under an unexpected name, route 2 reporting a present credential with no control variable, the label check landing on the supervisor's seat argument and not on a path substring, a binary name, a prompt quote, or the invocation's own argv, the route-2 exit mapping, and--self-reportend to end with the child's environment passed explicitly, its ppid asserted against the test process, and its exit codes (1 unplaced, 3 token present).docs/development/agent-experience-audit.md— entry 58, with the measurements above. The class is broader than this host: any negative assertion (absent,empty,unchanged,no leak) over a read that can silently return nothing fails the same way, and the more the negative is the result you want, the less likely it is noticed.Evidence
Unit suite: 14 passed, 14 total.
Mutation ledger, each mutation applied to the classifier and re-run:
M6 survived the first pass, which is how the missing test was found: a withheld fixture answers the same whether or not route 2 is gated, so the test now asserts the direction that matters — a present credential with no control variable. Worth knowing that the ledger was what caught it, not a reading of the code.
Live runs on this box (at
cec63b06, before the label fix): route 1 reads the pi child asUNREADABLE … NOT a withheld token(exit 1), and route 2 run inside that seat reports:and a deliberately wrong label prints
does NOT appear in any ancestor argv — the label is unverifiedand exits 1 (UNPLACED). Before the fix above,--seat commonly,--seat runand--seat nodeeach printedappears in ancestor pid 28808— a confirmation of three labels that are wrong. A planted credential exits 3 rather than being confused with a non-answer.That pair is why the acceptance record names the route instead of reporting one verdict per host, and the chain is what shows the probe sat under the pi adapter child rather than under the supervisor. A deliberately wrong label prints
does NOT appear in any ancestor argv — the label is unverified.No version slot:
scripts/,backend/__tests__/, and a docs entry only.