You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
bcode
committed
browser_execute: per-call console arg, drop global monkey-patch
Fixes cubic P2 finding on PR #41. Two overlapping execute() calls
clobbered each other's global console.log/error/warn/info patches
and corrupted the originals process-wide via a stale 'finally'
restore. Cases this hits: server-mode multi-session, sub-agent
sessions, parallel browser_execute tool calls in one assistant turn
(AI SDK runs those via Promise.all), TUI tabs sharing a daemon.
Fix: bind a per-call { log, error, warn, info } object as the second
AsyncFunction argument. JS scope chain resolves console.log() in the
snippet to the function parameter before reaching the global, so
existing snippets keep working byte-identically and the global
console is never mutated. Also concurrency-safe by construction --
no shared state between calls.
Test 'overlapping execute calls do not clobber each other's console
capture' is a regression guard: verified to fail on the old impl
(empty output captures + 'bye from B' leaking to stderr) and pass
on the new one.
description: "JavaScript source. Wrapped in an async function with `session` (CDP Session) bound.",
53
+
description:
54
+
"JavaScript source. Wrapped in an async function with `session` (CDP Session) and `console` (per-call capture; same `log/error/warn/info` API) bound.",
0 commit comments