Repository navigation
feat(cli): deliver pw action snapshots as a host file, secrets masked - #103
Merged
Merged
Conversation
This was referenced Sep 19, 2026
tenequm
added a commit
that referenced
this pull request
Sep 19, 2026
…age recovery finding (#107) Knowledge bundle update from the benchmark rerun on merged main (9ca9386 = #100 + #102 + #103): same 12-click flow on a signed-in site, humanize on, headless `claude -p` Opus orchestrator with a fresh context. ## What changed - `findings/orchestrator-effort-is-the-browse-time-lever.md`: adds the merged-main pw table (low effort 96/129/116/104s, high effort 148/161/153s), notes the one harness failure (non-JSON answer, excluded), records that #103's host snapshot did not measurably move pw timings, and states the #101 verdict (~250ms/call is ~5-8s of a ~100s run). - `findings/jev-browse-slowness-was-the-driver-path.md`: adds the merged-main jev-browse numbers (high effort 163/134s, 2/2; low effort 95/167s, 0/2 on the "people" step) with the diagnosis that the low-effort failures are the site's overlay plus the orchestrator giving up, not a #102/#103 regression. - `findings/spa-transition-hides-body-behind-overlay.md` (new): the stuck-page trap - a client-side app transition updates URL and title while the body sits behind a "Navigating to ..." overlay; the aria snapshot or a reload already holds the page. Names jev-browse's pre-existing URL+title done-check weakness. - `findings/pw-call-cost-breakdown.md`: one sentence making the #101 parking concrete; source title marked parked. - `index.md`: entries refreshed (hand-indexed bundle, descriptions verbatim). Verified: every concept's frontmatter parses with type/description/generated, index lines match descriptions verbatim, all bundle-relative links and footnote ids resolve. ## Release notes Knowledge base: merged-main browse benchmark numbers and the stuck-page recovery finding; nothing changes for users.
This was referenced Sep 19, 2026
tenequm
added a commit
that referenced
this pull request
Sep 19, 2026
## What `GET /snapshot` (#103) masked only the exact values the seed's secret store holds. A password an agent typed as a literal into an `<input type=password>` still reached the host copy in the clear: the driver renders the field as a plain `textbox` with its value, and the daemon had nothing to match it against. At `/snapshot` time the daemon now also reads the current value of every password field on the seed's open pages and masks those to `{{cuttle:password-field}}`, in the same longest-first exact-match pass as the held sentinels. ## How the daemon reaches the page The daemon is the multiplexer, so it already owns a direct route to the seed's Chrome that `cuttle grab` / `secret capture` use: `dialBrowser(inst.cdpPort)` straight to the browser's own port (bypassing the proxy and the humanizer), `Target.attachToTarget` with a flat session, `Page.createIsolatedWorld` + `Runtime.callFunctionOn`. `passwordFieldValues` lists page targets via the browser's `/json/list`, attaches to each one (the daemon cannot tell which page the driver snapshotted), and evaluates a constant, argument-free function in a fresh isolated world that walks `document` and every same-origin iframe for `input[type=password]` values. Cross-origin iframes are separate targets and are not walked. The function caps what it returns (32 values, each at most 4096 characters) before Chrome serializes the reply, since the daemon reads it with no frame-size limit and the page decides how many fields it has. The socket is closed at the end, which detaches every session it opened, so the driver's own session is untouched. The whole read runs under a 1.2s budget because `cuttle pw` fetches the route with `curl --max-time 2`; any failure (no browser, attach or evaluate error, timeout) yields no values and the snapshot is served masked by held values alone. Values never touch a log line. ## Placeholder `{{cuttle:password-field}}` - the hyphen fails `secretNamePattern`, so it can never name a held secret or be mistaken for a sentinel an agent could type. ## Tests - `TestSnapshotMasksPasswordFieldValues` drives the real read path against a fake browser (HTTP `/json/version` + `/json/list` and the CDP websocket harness): masks plain and YAML-quoted values, leaves a 4-digit value under the floor alone, and serves held-only masking when the evaluate fails or nothing listens on the port. - `TestMaskHeld` now goes through `maskExact(heldPairs)` directly; the `maskHeld` wrapper only tests called is gone. A `held value in a field` case with 21 fields checks that the held sentinel wins over `{{cuttle:password-field}}` for the same value once the longest-first sort is past insertion-sort size (it is stable now). ## Live check Own instance built from the branch, local page with a password input via `host.docker.internal`, `pw fill` a fake literal, `pw click`: the host snapshot shows `textbox "Pass" [ref=e7]: {{cuttle:password-field}}` (grep -c of the raw value = 0), the container's `.playwright-cli/page-*.yml` still holds the raw value (grep -c = 1), `cuttle logs` never mentions it, and the driver session kept working after the daemon's attach. ## Release notes The `[Snapshot]` file `cuttle pw` copies to the host now also masks the current value of every password field on the page as `{{cuttle:password-field}}`, so a password typed as a literal no longer lands on the host in the clear. Held secrets still show as `{{cuttle:NAME}}`. Nothing to configure.
tenequm
added a commit
that referenced
this pull request
Sep 19, 2026
…og line names its verb (#110) ## What Two `cuttle pw` output lines pointed at paths only the container can open, inconsistent with the host `[Snapshot](...)` link #103 introduced for action verbs. - **`cuttle pw snapshot`** printed the whole aria tree inline: 36 KB on a busy page, about 1 MB on a long encyclopedia article. It now gets a `--filename` under the driver's own snapshot dir, so the existing one-exec `snapshotArgv` wrapper fetches it through the daemon's masked `/snapshot` route and `hostSnapshot` saves it under `$XDG_STATE_HOME/cuttle/<name>/snapshots` (0700 dir, 0600 files, newest 50 kept). The output is the host path plus the first 40 lines under it, then `... N more lines in the file`. `--raw`, `--json` and an explicit `--filename` are left exactly as the driver prints them, so scripts keep an inline path. - **`- New console entries: .playwright-cli/console-<ts>.log#L1-L3`** is rewritten to ``- New console entries: in the container - `cuttle --name <n> pw console` prints them``. No second host-copy mechanism: the driver's `console` verb already reads the log. The `Console: N errors, M warnings` count line is untouched. - **SKILL.md**: the snapshot bullet now covers both cases, and one new bullet steers content-heavy pages to `find`, `snapshot <ref>` or `eval` instead of reading the file whole. 14.2 KB, under the 16 KB budget. - **Daemon `/snapshot` route** (second commit, found by the CI smoke run): it rooted at the requested seed's profile dir, but the driver's cwd is the reserved seed's download dir in every mode, so in pool mode (the smoke container) and under `--ephemeral` the fetch was a 404 - #103's action links stayed container-only there, and the file-backed `snapshot` printed nothing inline. It now reads where the driver writes; the instance still supplies the seed to mask for. - **Polish, after the rebase onto #109:** the route's dir is named once as `driverDownloadsDir` (serve startup, the route and both snapshot tests use it - #109's password-field test wrote into the seed's profile dir and 404'd under the new root). A file-backed `snapshot` whose file never reaches the host (a running container from an image without the `/snapshot` route, a pool with no default seed) would have printed nothing but a container link; it now adds a stderr hint naming `pw --raw snapshot` and `up --recreate`. ## Why this shape playwright-cli 0.1.20's `snapshot` prints inline unless `--filename` is given, and a `--filename=.playwright-cli/page-<ts>.yml` lands under the workdir and prints the same `[Snapshot](.playwright-cli/page-...yml)` link an action does - so it passes the daemon route's file pattern and the whole #103 path (fetch, mask, save, prune, rewrite) applies unchanged. The file name copies the driver's timestamp format so pruning by name order still sorts by age. ## Verified Live in a fresh container on a public test page and a long encyclopedia article: `snapshot` output went from 1,085,040 bytes inline to 2,032 bytes (path + 40-line head + `... 14996 more lines in the file`); files are `-rw-------` in a `drwx------` dir; `--raw snapshot` still prints the full tree; `snapshot <ref>` prints the subtree whole with no remainder note; `find` and per-verb `--help` pass through. `just check` green. The smoke harness (`test/smoke`, `CUTTLE_BIN` set) passes against a branch image run exactly as CI runs it (`--mode=pool --fingerprint=smoke-default`). ## Release notes `cuttle pw snapshot` now saves the masked snapshot to a host file like click/goto do and prints its path plus the first 40 lines; `--raw` keeps the whole tree inline. The console log line points at `cuttle pw console` instead of a container path, and snapshot links work in pool and ephemeral mode.
tenequm
added a commit
that referenced
this pull request
Sep 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.15.0](v0.14.2...v0.15.0) (2026-09-21) ### Features * bundle playwright-cli into the image with a cuttle pw passthrough ([#67](#67)) ([28d9846](28d9846)) * **cli:** center the skill and briefing on cuttle pw, drop host driver routing ([#75](#75)) ([33eca16](33eca16)) * **cli:** colored jev-browse output ([#70](#70)) ([cf6f109](cf6f109)) * **cli:** cuttle jev-browse - autonomous browsing loop on the bundled driver ([#66](#66)) ([0496957](0496957)) * **cli:** deliver pw action snapshots as a host file, secrets masked ([#103](#103)) ([78adbbb](78adbbb)) * **cli:** make --context/--name global so pw and jev-browse reach any instance ([#74](#74)) ([9df5c33](9df5c33)) * **cli:** zero-ceremony cuttle pw - auto-attach on demand, allow open ([a7e6491](a7e6491)) * **jev:** withhold write actions and halve jev-browse run time ([#102](#102)) ([9ca9386](9ca9386)) * **serve:** mask password field values in /snapshot ([#109](#109)) ([2a352b5](2a352b5)) * **serve:** session lease - one driver at a time, with takeover ([#69](#69)) ([87724c8](87724c8)) ### Bug Fixes * **backend:** keep profile cleanup and remote argv from reaching past their own ([#92](#92)) ([f52cfd3](f52cfd3)) * **cli:** close the gaps a review of the lifecycle fixes found ([#90](#90)) ([c46aa5e](c46aa5e)) * **cli:** close the lifecycle gaps a stress run left open ([#88](#88)) ([899a535](899a535)) * **cli:** discarding the profile removes the instance's host snapshot dir ([#113](#113)) ([57cd07a](57cd07a)) * **cli:** downloads --wait accepts a finished download, logs drops D-Bus spam ([#111](#111)) ([dcc2f46](dcc2f46)) * **cli:** name the in-page dialog behind a pw click timeout ([#99](#99)) ([11beeeb](11beeeb)) * **cli:** never fall back to another instance when the selected one is stopped ([#78](#78)) ([a1df361](a1df361)) * **cli:** re-attach the driver after a restart leaves a stale session ([#77](#77)) ([bbeb0f0](bbeb0f0)) * **cli:** run --extract on every ending, not only done ([#71](#71)) ([4954195](4954195)) * **jev:** judge done on the page that landed, and end done on a none above even odds ([#108](#108)) ([a9cb5a8](a9cb5a8)) * **jev:** offer filter-apply controls the write gate withheld ([#114](#114)) ([bdf440a](bdf440a)) * **jev:** read quoted snapshot lines and keep field values out of --extract ([#89](#89)) ([09111a2](09111a2)) * **pw:** compact find output, downloads into a directory, quieter logs ([#116](#116)) ([62f2ca8](62f2ca8)) * **pw:** snapshot links a host file like an action, and the console log line names its verb ([#110](#110)) ([c902c58](c902c58)) * **serve:** dismiss a native dialog the driver leaves open ([#87](#87)) ([14f24cb](14f24cb)) * **serve:** keep the default seed's downloads across browser relaunch ([aac8e40](aac8e40)) * **serve:** keep the dialog watch alive through a signal shutdown ([#94](#94)) ([4f4f1d0](4f4f1d0)) * **serve:** pool-mode reaping, capture tab, hung tabs and launch bursts ([#86](#86)) ([3b42ea2](3b42ea2)) * **serve:** skip an idle reap whose timer a launch has since re-armed ([#93](#93)) ([c667868](c667868)) * **smoke:** never exec into a container the run was not pointed at ([#79](#79)) ([9075244](9075244)) * **viewer:** keep websocket inside proxy prefix ([#62](#62)) ([3b10ba7](3b10ba7)) ### Performance Improvements * **cli:** run a pw verb in one docker exec, lease check included ([#100](#100)) ([a9c3c90](a9c3c90)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
playwright-cli 0.1.20 action verbs (
goto,click,press, ...) write the page snapshot to a file inside the container and print only- [Snapshot](.playwright-cli/page-<ts>.yml). That path does not exist on the host, so an agent had to spend anothercuttle pw snapshotcall (and a turn) after every action.Now, after a successful driving verb whose stdout carries that link, the same exec fetches the file through the daemon, and
cuttle pwwrites it to$XDG_STATE_HOME/cuttle/<instance>/snapshots/<same name>(dir 0700, file 0600, newest 50 kept) and rewrites the link to that absolute host path. Any failure (old daemon without the route, 2s curl timeout, write error) leaves the driver's output as it printed it.GET /snapshot?file=.playwright-cli/page-<ts>.yml, behind the same loopback Host/Origin guard as/downloads. The file must match^\.playwright-cli/page-[0-9TZ-]+\.yml$and is read throughos.Rooton the seed's download dir (the driver's workdir), so traversal, absolute paths and escaping symlinks are refused. Every live value the seed's secret store holds is replaced by its{{cuttle:NAME}}sentinel: exact substring only, longest first, values under the existing masking floors (4 chars, 6 if all digits) skipped.snapshotArgvwraps a driving verb (inside perf(cli): run a pw verb in one docker exec, lease check included #100's lease gate) in a shortshscript that runs the driver into a temp file, prints it, and on exit 0 with a snapshot link curls127.0.0.1:9222/snapshotand appends the masked body behind a marker line; the verb's exit status is kept and the temp file removed.hostSnapshotsplits the marker off, saves the file and rewrites the link. Read verbs are not wrapped. Called on the success path of the first attempt and of the post-attach retry; that retry now buffers stdout (stderr still streams) so the first verb after a restart gets the host link too.Out of scope, deliberately: provider-prefix patterns, auto-capture, masking the verb's stdout or
cuttle pw snapshot.Fact check: does the aria snapshot print a password field's value?
Yes. Filled a
type=passwordinput and a text input on a local test page, thencuttle pw snapshot:So a filled password is in cleartext in every snapshot. This PR masks only values the daemon holds (filled via
{{cuttle:NAME}}); a password typed literally stays visible, as SKILL.md already says.Live check (throwaway container, image built from this branch after merging #100)
pw goto, auto-attach retry path) printed- [Snapshot](<state>/cuttle/snap-test/snapshots/page-2026-09-19T10-40-21-790Z.yml); the file exists, dir700, file600.printf 'fake-secret-value' | cuttle secret set T --stdin,pw fill e4 '{{cuttle:T}}',pw fill e6 'fake-pw-value-123',pw click e7: the host copy showstextbox "User" [ref=e4]: {{cuttle:T}}(the literal password stays visible), the in-container original holds the raw value (grep -c= 1), and the host copy equalspw snapshot's YAML with the value swapped for the sentinel.docker eventsduring thatpw click: exactly 1exec_start. No temp files left in the container's/tmp.curl '127.0.0.1:9222/snapshot?file=../Cookies'inside the container: 400.Note:
fillprints no snapshot link in 0.1.20, so the masked copy first appears on the next action. Branch updated by merging main (not rebased) to avoid a force-push; squash-merge flattens it.Release notes
cuttle pwaction verbs now save their page snapshot on this host under~/.local/state/cuttle/<instance>/snapshots/and print that path, so it can be read directly without anothersnapshotcall. Values held bycuttle secretappear as{{cuttle:NAME}}in the saved file.