Skip to content

Commit e2e5b6f

Browse files
committed
docs(browser): leave timeout recovery to agent
1 parent 37e0bb2 commit e2e5b6f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/bcode-browser/skills/browser-execute/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ If a target-scoped command throws `CdpError` code `-32001` (`Session with given
110110
111111
Every explicit reconnect or browser switch retires the previous socket and clears its active target attachment. Re-list targets, call `session.use(...)`, and rediscover DOM nodes and Runtime objects before continuing.
112112
113-
New tabs and windows are separate targets with `type: "page"`; opening one does not move the current attachment, so `Page`/`Runtime` commands still go to the old tab and waiting for a page event does not switch to the new one. If the task continues in the new tab, re-list targets, identify the intended page by URL, title, or `targetId` rather than list position or an iframe/OOPIF target, then call `session.use(targetId)`.
113+
Opening a tab creates a new `page` target but does not switch the active attachment. Call `Target.getTargets` again and `session.use(targetId)` when continuing there.
114114
115115
## Driving a page
116116
Domain methods follow `session.<Domain>.<method>(params)` and return Promises.
@@ -202,7 +202,7 @@ console.log(JSON.stringify(titles))
202202
## Guardrails
203203
- Top-level `import` statements inside the snippet body are not allowed. Use `await import(...)` instead.
204204
- No CPU-bound infinite loops without `await` — they ignore the timeout. Insert `await new Promise(r => setTimeout(r, 0))` to yield.
205-
- `browser_execute` defaults to 60s (max 600s); inner CDP timeouts do not extend it. Keep calls small and do not increase the timeout after a page command stalls. A timeout preserves the connection and target, and the last command may still run: probe with browser-level `Target.getTargets`; if that works but page commands hang, attach a fresh page target. Reconnect only if the socket closed.
205+
- `browser_execute` defaults to 60s; longer timeouts delay your next turn. A timeout returns control without closing CDP, though the last command may still run. Use browser-level `Target.getTargets` to inspect the connection, then continue, switch targets, or reconnect as appropriate.
206206
207207
## Console
208208
- `console.log`, `console.error`, `console.warn`, `console.info`, `console.debug` are all captured and streamed to the user. Treat them as your stdout. Other `console.*` methods write to bcode's stderr without being captured into the tool result.

‎packages/bcode-browser/src/browser-execute.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export const make = Effect.fn("BrowserExecute.make")(function* (dataDir: string)
262262
const output = timeoutOutput(captured.output)
263263
const error = new Error(
264264
[
265-
`browser_execute timed out after ${timeout} ms; the browser session remains connected`,
265+
`browser_execute timed out after ${timeout} ms; the timeout did not close the CDP session`,
266266
output.trim() ? `Partial console output before timeout:\n${output.trimEnd()}` : "",
267267
]
268268
.filter(Boolean)

0 commit comments

Comments
 (0)