Repository navigation
feat(dev): pnpm dev transcript shows a CLI change before and after - #804
Conversation
A CLI change has no screenshots: its output, flags, errors and exit codes are its interface. `pnpm dev transcript <script>` runs a script of shell lines on both evidence instances, as each one's signed-in CLI, and lays the lines out for the PR: after's output, a diff when before differs, and "no change" folded away when it doesn't. Lines run in their own `bash -c` in the runner's closed environment, from the side's agent workspace, with stdin closed and a timeout. Only each instance's origin and paths are normalized. A sanitizer, shared with `trial` (#793), collects secrets from both sides' CLI state before the run and after every line, plus machine-token shapes and secret-named variables, and redacts them from everything written. Closes #792 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sol round 1. A line like `patchy login && patchy logout` printed its code and cleared it before the after-line read, so the code could reach the section. The sanitizer now also matches the login-code shape, and reads the CLI state every 100ms while a line runs. Every non-empty collected value is redacted, however short. Also: the line's process group is force-killed on cleanup too, not only on a timeout; the workspace guard catches flags before `setup` and `--location=global`; the section says when outputs were compared on their first 1,000 lines only; and DEVELOPMENT says scenarios with sample data need Chromium. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
GPT 6.1 Sol review, round 1 (on
|
Sol round 2. Literal values were replaced one after another, so a short collected value could break up a machine token or login code before its shape was matched. Every match is now found in the original text, overlaps merge, and an existing `[redacted]` counts as one, so redacting twice changes nothing. The `--json` report is redacted string by string before it is encoded, so a short secret can't break the JSON. The `patchy setup` guard matches the subcommand after patchy's global flags, not any `setup` argument. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
GPT 6.1 Sol review, round 2 (on
The transcript above was republished at |
|
GPT 6.1 Sol review, round 3 (on |
…connection (#814) Release 15's What's new entry, written from `9e4b0df`. It covers everything merged since release 14's `through` (`7694bab`), and sets the `patchy` release to `0.15.0` (`packages/patchy/package.json` and `CURRENT_RELEASE`). | Change | PRs | | --- | --- | | New: Your agent can read a tool's log | #786 | | Fixed: Tools with server code keep one steady connection | #798 | | Behind the scenes: an unused open tool lets its server rest | #802 | #783 is release 14's own entry, so it's left out. #795, #796, #797, #799, #803, #804, #806 and #807 are agent docs, CI and dev tooling, with no line. None of the PRs in the range are `one-way`; #786 and #798 predate the rollback questions, and their diffs leave nothing an older release can't run with (a new read-only route and CLI command, and the load balancer's stickiness setting, which the older commit restores). If this release misbehaves, roll back to `03891e4` (release 14). Made by Claude Opus 5.5 via Claude Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
A CLI change has no screenshots to show. Its output, flags, errors and exit codes are its interface, and reviewing one meant running it. Now
pnpm dev transcript <script>runs a script of CLI lines on both evidence instances (#725), as each one's signed-in CLI, and puts the comparison in the PR body. Each line shows after's output, plus a diff when before differs; a line with no change folds away.Nothing secret should reach the PR. One sanitizer, shared with
trial(#793), redacts what it collected before anything is written.Closes #792
Look at
1. This PR's own transcript, published with
--pr. This branch changes no CLI command, so the run uses--base 6900c71~1, the commit before #786 addedpatchy logs. Before,patchy logsis an unknown command; after, it reads the patch's log. The login lines show no code, the credentials file no token, and the last line logs in and out within onebash -cwithout leaking its code.patchy login --jsonand the credentials file count as changed only through their timestamps. Normalizing replaces only origins and paths, so an id or time that changes stays visible.Transcript
logs-and-loginBefore is
03891e4(--base 6900c71~1) and after ise79c9a0(dev/792-transcript), both on thebrightlinescenario, frompnpm dev transcript.Each line ran in its own
bash -cfrom the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads<origin>, its environment folder<env>, its checkout<checkout>and the home folder~; nothing else is normalized. Redacted before writing: tokens and login codes from each side's CLI state; strings shaped like login codes.3 of 7 lines changed.
Reading a published patch's log
Changed. Before, exit 1 in 0.3 s; after, exit 0 in 0.4 s.
18 of 48 lines are cut from the middle.
--jsonhas it all.Signing in, then out
$ patchy login: no change, exit 0 in 0.3 sChanged. Before, exit 0 in 0.3 s; after, exit 0 in 0.3 s.
Changed. Before, exit 0 in 0.0 s; after, exit 0 in 0.0 s.
$ patchy logout: no change, exit 0 in 0.3 s$ patchy whoami: no change, exit 1 in 0.3 sBoth on one line
$ patchy login && patchy logout: no change, exit 0 in 0.7 s2. The login code a logout cleared.
patchy loginsaves a pending login holding its device code and user code, andpatchy logoutdeletes it with the stored token. The sanitizer reads both sides' CLI state before the run, every 100ms while a line runs, and after it. It keeps every value until the last write, so both are still known when the section is written. Anything shaped like a login code is redacted too, in case a line makes one and clears it between two reads. Above, every login line reads[redacted]where the code was, andcredentials.jsonshows"token":"[redacted]". The focused tests are:still redacts a login code after a logout cleared it from the CLI state(scripts/dev/src/sanitize.test.ts);redacts a secret a line wrote to the CLI state and cleared before it ended(scripts/dev/src/transcript.test.ts), which fails with the mid-line read turned off.How it was verified
Focused tests,
pnpm exec vitest run scripts/dev(12 files, 63 tests). The new ones cover:pp_…and login-code shapes anywhere, with anapp_…id left alone. Overlapping matches merge, so a one-letter secret can't break up a token, and redacting twice changes nothing;--jsonreport staying valid JSON when a secret is0;bash -cruns: exit code, both streams, stdin closed, only the given variables, a timeout killing the line, and a background process not holding the line open;Real runs, on
brightlinewith--base 6900c71~1, on a shared Linux machine:patchy logsexit 1 before and 0 after. Two bugs, fixed: an origin before a full stop wasn't normalized, and cutting from the top hid the base's error, so cuts now keep the first 20 and last 10 lines--json, checkouts reusedpp_…, the scenario token,/home/and the username matched nowhere. Only the JSON'sbefore.apiUrlandafter.apiUrlkeep the local origins, which the section replaces--pr 804patchy login && patchy logouton one line,--jsonthen--pr 804--jsonthen--pr 804(above)--jsonoutput parsed as valid JSON, and the same greps matched nothingFailure paths, run for real:
After each run, only the reusable checkouts and the lock folder remained: no environment folder, instance state or
sleepprocess.Ctrl-C mid-line. I sent SIGINT to the run's process group, as a terminal's Ctrl-C does, while the base side ran
sleep 300. Both instances were taken down and the line's process group ended. No runner process, environment folder, instance state or lock entry was left.pnpm verify --changedon8290de3:JSON.stringifyin a new test; that's fixed, andpnpm typecheckpasses.After Sol's fixes I reran the runner's tests, its typecheck, the test typecheck and lint.
CI is green on
e79c9a0.test (26)failed once there inpackages/runtime: workerd exited at startup, which this PR doesn't touch. The rerun of the failed job passed, and it's filed as flaky: supervised workerd diagnostics case fails when workerd exits at startup on Node 26 #805.Hit every surface:
docs/DEVELOPMENT.md(the command table and "Showing a change in a PR") and thepatchy-dev-loopskill, which now shows a script. The seed and the vitest template are unchanged.pr-evidencegains atranscriptentry in its Shows, Make, Costs and Gotchas shape. Command output loses the throwaway-checkout recipe dev: PRs show what changed, with before/after screenshots and recordings #725 parked there and keeps plain output for whattranscriptdoesn't run. "Not built yet" lists onlytrial.transcriptuses the same evidence checkouts thatpnpm dev downdeletes. A line's background processes end with its process group, and its files go when the environment is taken down.packages/patchy(no command changed), migrations, company resources, served pages, the repo layout and vocabulary.Reviewed by GPT 6.1 Sol over three rounds:
All are fixed; the summaries are in the comments.
Not checked:
pp_token in output (unit-tested only).Done means: both parts are shown above. A CLI change's lines appear before and after with nothing secret in them, using feat(patchy): agents read a published patch's log with
patchy logs#786's change through--base, since this branch changes no command. The login-then-logout script published no login code.Release impact
Tick exactly one.
Breaking — requires action from anyone already running this
Not breaking — dev tooling and docs; nothing ships to production
What does a revert leave behind? Transcript sections already in PR bodies. The evidence checkouts are dev: PRs show what changed, with before/after screenshots and recordings #725's, and the older
pnpm dev downstill deletes them.Does the release before it still work with that? Yes. Nothing here runs in production.
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.