Skip to content

interaction-skills: verifying speculation-rules prerender under CDP#485

Open
clawdloblaw wants to merge 1 commit into
browser-use:mainfrom
clawdloblaw:add-prerendering-skill
Open

interaction-skills: verifying speculation-rules prerender under CDP#485
clawdloblaw wants to merge 1 commit into
browser-use:mainfrom
clawdloblaw:add-prerendering-skill

Conversation

@clawdloblaw

@clawdloblaw clawdloblaw commented Jul 4, 2026

Copy link
Copy Markdown

Field-tested: speculation-rules prerendering can never be observed activating while the harness (any CDP debugger) is attached — Chrome reports PrerenderingDisabledByDevTools for every candidate and activationStart stays 0. Easy to misread as broken rules on the page.

This skill documents the observer effect and the Preload CDP domain recipe (Preload.enable + drain_events()) to verify that rules parsed and candidates registered, plus which failure reasons are real vs. harness-induced.

🤖 Generated with Claude Code


Summary by cubic

Adds a concise guide to verify speculation‑rules prefetch/prerender under CDP. Explains that DevTools disables prerendering and shows how to validate rules via the Preload domain instead.

  • New Features
    • Added interaction-skills/prerendering.md with steps to use Preload.enable and drain CDP events to confirm rule parsing and candidate registration.
    • Clarifies reading Preload.ruleSetUpdated / Preload.prerenderStatusUpdated, and that PrerenderingDisabledByDevTools is harness-induced, not a site bug.
    • Notes Chrome prerender limits and conditions that disable prerendering (Data Saver, battery saver, low memory).

Written for commit ee40411. Summary will update on new commits.

Review in cubic

Chrome disables prerendering while a debugger is attached (PrerenderingDisabledByDevTools),
so activation can never be observed from the harness. Document the Preload-domain recipe to
verify rules registered instead, and when a failure reason is real.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017J8nADRf3KW9G9A1QTdAh8
@browser-harness-review

Copy link
Copy Markdown

✅ Skill review passed

Reviewed 1 file(s) — no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="interaction-skills/prerendering.md">

<violation number="1" location="interaction-skills/prerendering.md:24">
P2: The documentation states that `Preload.ruleSetUpdated` firing means the `<script type=speculationrules>` "parsed correctly," but the CDP `RuleSet` object in that event includes optional `errorType`/`errorMessage` fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. `SourceIsNotJsonObject`, `InvalidRulesSkipped`). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect `e["params"]["ruleSet"].get("errorType")` and clarifying that the event firing indicates the rule set was *registered*, not necessarily that it parsed without errors.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

print(p["key"]["url"], p.get("status"), p.get("prerenderStatus"))
```

- `Preload.ruleSetUpdated` fires → the `<script type=speculationrules>` parsed correctly.

@cubic-dev-ai cubic-dev-ai Bot Jul 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The documentation states that Preload.ruleSetUpdated firing means the <script type=speculationrules> "parsed correctly," but the CDP RuleSet object in that event includes optional errorType/errorMessage fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. SourceIsNotJsonObject, InvalidRulesSkipped). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect e["params"]["ruleSet"].get("errorType") and clarifying that the event firing indicates the rule set was registered, not necessarily that it parsed without errors.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At interaction-skills/prerendering.md, line 24:

<comment>The documentation states that `Preload.ruleSetUpdated` firing means the `<script type=speculationrules>` "parsed correctly," but the CDP `RuleSet` object in that event includes optional `errorType`/`errorMessage` fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. `SourceIsNotJsonObject`, `InvalidRulesSkipped`). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect `e["params"]["ruleSet"].get("errorType")` and clarifying that the event firing indicates the rule set was *registered*, not necessarily that it parsed without errors.</comment>

<file context>
@@ -0,0 +1,32 @@
+        print(p["key"]["url"], p.get("status"), p.get("prerenderStatus"))
+```
+
+- `Preload.ruleSetUpdated` fires → the `<script type=speculationrules>` parsed correctly.
+- `Preload.prerenderStatusUpdated` with your target URLs → Chrome accepted the candidates.
+- Status `Failure` + `PrerenderingDisabledByDevTools` → rules are fine; they will prerender
</file context>
Fix with cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant