Skip to content

Automate browser based workflows with AI

Teach script reviewer to handle blank page errors with wait calls (#5178)

pedrohsdbde572a0fde01
diff --git a/skyvern/forge/prompts/skyvern/script-failure-triage.j2 b/skyvern/forge/prompts/skyvern/script-failure-triage.j2
index 2b213c80b..c2b14196c 100644
--- a/skyvern/forge/prompts/skyvern/script-failure-triage.j2
+++ b/skyvern/forge/prompts/skyvern/script-failure-triage.j2
@@ -43,6 +43,7 @@ Respond with EXACTLY one line — either `CODE_FIXABLE` or `NOT_CODE_FIXABLE`
- Agent got stuck repeating the same action (value typed but didn't persist)
- Max steps reached because of a single problematic field
- Form validation errors that better input handling could avoid
+- Page not ready (blank page, loading spinner/overlay, transitional state) — add a wait
**NOT_CODE_FIXABLE** — no code change would help:
- Website is down, returning 404/500, or page content is an error page
diff --git a/skyvern/forge/prompts/skyvern/script-reviewer-extraction.j2 b/skyvern/forge/prompts/skyvern/script-reviewer-extraction.j2
index 44170ae7d..4f0d3382e 100644
--- a/skyvern/forge/prompts/skyvern/script-reviewer-extraction.j2
+++ b/skyvern/forge/prompts/skyvern/script-reviewer-extraction.j2
@@ -106,6 +106,9 @@ The user has provided the following instructions for fixing this script. Priorit
```
{% endif %}
+## Slow Page Load / Page Not Ready
+When the error or page text suggests the page wasn't ready for interaction, the script acted too soon. Signs include: blank page messages, "still on X page", loading spinners/overlays, progress indicators, or the page text showing a transitional state rather than the expected content. Fix this by adding `await page.wait(timeout_ms=5000)` **before the first action that failed**. If the existing code already has a `page.wait()` before that action and it still failed, increase the timeout (e.g., 5000→8000→10000→15000).
+
## What to do
1. Identify that the page was in a different state than what the extraction prompt expected.
diff --git a/skyvern/forge/prompts/skyvern/script-reviewer-form-filling.j2 b/skyvern/forge/prompts/skyvern/script-reviewer-form-filling.j2
index 128d14150..ab02c882f 100644
--- a/skyvern/forge/prompts/skyvern/script-reviewer-form-filling.j2
+++ b/skyvern/forge/prompts/skyvern/script-reviewer-form-filling.j2
@@ -123,6 +123,9 @@ Do NOT add FIELD_MAP entries for any of these standard categories — they are m
Only add FIELD_MAP entries for truly **custom/company-specific** fields that don't fit any standard category above.
+## Slow Page Load / Page Not Ready
+When the error or page text suggests the page wasn't ready for interaction, the script acted too soon. Signs include: blank page messages, "still on X page", loading spinners/overlays, progress indicators, or the page text showing a transitional state rather than the expected content. Fix this by adding `await page.wait(timeout_ms=5000)` **before the first action that failed**. If the existing code already has a `page.wait()` before that action and it still failed, increase the timeout (e.g., 5000→8000→10000→15000).
+
## What to do
1. Compare the episode's form fields to the existing FIELD_MAP.
2. For each field in the episode, first check if it matches a standard category listed above. If it does, do NOT add it to FIELD_MAP — canonical matching handles it automatically.
diff --git a/skyvern/forge/prompts/skyvern/script-reviewer.j2 b/skyvern/forge/prompts/skyvern/script-reviewer.j2
index 5554ab947..d626b6574 100644
--- a/skyvern/forge/prompts/skyvern/script-reviewer.j2
+++ b/skyvern/forge/prompts/skyvern/script-reviewer.j2
@@ -123,6 +123,9 @@ The user has provided the following instructions for fixing this script. Priorit
```
{% endif %}
+## Slow Page Load / Page Not Ready
+When the error or page text suggests the page wasn't ready for interaction, the script acted too soon. Signs include: blank page messages, "still on X page", loading spinners/overlays, progress indicators, or the page text showing a transitional state rather than the expected content. Fix this by adding `await page.wait(timeout_ms=5000)` **before the first action that failed**. If the existing code already has a `page.wait()` before that action and it still failed, increase the timeout (e.g., 5000→8000→10000→15000).
+
## What to do
{% for episode in episodes %}