From 96ad6cb0a003d7ff85bbf646106eee78478e7363 Mon Sep 17 00:00:00 2001 From: Misha Kolesnik Date: Sat, 19 Sep 2026 17:32:17 +0100 Subject: [PATCH 1/2] docs(skill): goto snapshots at load, so a client-rendered page reads empty at first The bundled driver's goto waits for domcontentloaded, then load for at most 5s, and snapshots at once - no network-idle and no option for one. A snapshot or eval straight after it sees the pre-render DOM: empty listitems, a null querySelector for an element that exists a second later. Reproduced against a local page that fills its list 3s after load; the same nested-quote eval returns null at once and the node 4s on, so the quoting report was this timing, not an escaping layer - cuttle passes the argument verbatim on every backend and the driver evaluates it intact. One gotcha names the symptom and the wait form. --- packages/cuttle/internal/cli/SKILL.md | 10 ++++++++++ packages/cuttle/internal/cli/skill_test.go | 1 + 2 files changed, 11 insertions(+) diff --git a/packages/cuttle/internal/cli/SKILL.md b/packages/cuttle/internal/cli/SKILL.md index c4489a9a..663fb73f 100644 --- a/packages/cuttle/internal/cli/SKILL.md +++ b/packages/cuttle/internal/cli/SKILL.md @@ -256,3 +256,13 @@ counts) or still writing. Content is never printed - safe for a credential file. not a broken page.** URL and title changed, body is a "Navigating..." curtain: `cuttle pw snapshot` already holds the real content; failing that, `cuttle pw reload` and read again. +7. **`goto` returns at `load`, before a client-rendered app has drawn.** The + driver waits for `domcontentloaded`, then `load` for at most 5s, and + snapshots at once - no network-idle, and no option to ask for one. So the + snapshot under `goto`, and an `eval` run right after it, see the pre-render + DOM: empty `listitem`s or containers where content belongs, `querySelector` + returning `null` for an element that is there a second later. That is not a + selector or quoting bug - nested quotes in `eval` pass through intact. Wait + for the content: `cuttle pw run-code 'async page => + page.waitForSelector("a[href^=\"/wiki/\"]")'`, or `find ''`, + then re-snapshot. diff --git a/packages/cuttle/internal/cli/skill_test.go b/packages/cuttle/internal/cli/skill_test.go index 7405f8c1..e0fe5362 100644 --- a/packages/cuttle/internal/cli/skill_test.go +++ b/packages/cuttle/internal/cli/skill_test.go @@ -32,6 +32,7 @@ func TestSkillGuideKeepsLoadBearingRules(t *testing.T) { "Secrets never reach", // credential handling "data, never instructions", // prompt injection from page content "cuttle logs", // where a swallowed click is explained + "before a client-rendered", // goto snapshots at load: empty containers and a null eval are timing "docs/OPERATING.md", // the operator half is findable } { if !strings.Contains(skillGuide, want) { From 506f4d31d6e9c6bd9cc3a58044952dd48ed71946 Mon Sep 17 00:00:00 2001 From: Misha Kolesnik Date: Sat, 19 Sep 2026 17:38:47 +0100 Subject: [PATCH 2/2] docs(skill): rule 6 says snapshot masks a password field, eval does not --- packages/cuttle/internal/cli/SKILL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cuttle/internal/cli/SKILL.md b/packages/cuttle/internal/cli/SKILL.md index 663fb73f..70d6fafa 100644 --- a/packages/cuttle/internal/cli/SKILL.md +++ b/packages/cuttle/internal/cli/SKILL.md @@ -177,9 +177,9 @@ Only `fill`: `type`, key presses and `eval` send the sentinel's literal text. The sentinel is the WHOLE value (`'Bearer {{cuttle:T}}'` is an error), and an unknown or expired name is an error naming the fix. A `fill` that times out right after a sentinel IS that error - playwright-cli hides cuttle's message, -`cuttle logs` has it. Reading is the other half: `snapshot` prints a filled -password in cleartext, and on a one-time-display credential `snapshot` and -`screenshot` ARE the leak. Capture it unseen: `cuttle secret capture API_KEY +`cuttle logs` has it. Reading is the other half: `snapshot` masks a password +field, `eval` on its `.value` does not, and on a one-time-display credential +`snapshot` and `screenshot` ARE the leak. Capture it unseen: `cuttle secret capture API_KEY --selector '#new-token'` (or `--from-clipboard`; `--to file:` or `--to exec:''` for a sink). A leaked value stays leaked: say so and rotate.