DEV Community

Trung Thanh Tran
Trung Thanh Tran

Posted on AI-assisted

What broke when an AI agent drove real websites overnight through my MCP browser server

On the night of Nov 16 I left Claude Code running with turbo-browser-mcp attached to my own Chrome. Every 30 minutes it read Hacker News, dev.to and Reddit, opened job boards, filled forms, set up a Reddit profile and booked a call on a Notion Calendar page. Whenever a tool call did something wrong, I wrote down the exact arguments and output, fixed it, and ran the same step again on the same page.

That became six rounds of fixes and v0.7.0. These are the bugs I would not have found with unit tests.

Two MCP servers on one Chrome hung forever

I had a second Claude session open in another project, also running turbo. Its tabs_batch call hung for over 100 seconds with nothing on stderr. My first guess was a tab with an alert() left open, so I added a 1.5 s cap on the per-tab setup script. The guard is still useful, but the guess was wrong.

The real cause was the CDP keep-alive bridge. Chrome 144+ asks you to click "Allow remote debugging" for every new connection, so turbo runs a small daemon that holds one approved connection and lets clients reuse it. With two clients, the bridge mixed up their sessions. The second one never received Runtime.executionContextCreated for the main world, so every evaluate waited forever, and opening a page failed with Page.setFontFamilies: Font families can only be set once.

The bridge now gives each client its own CDP sessions on top of one upstream socket. When a client disconnects, the bridge closes that client's isolated contexts and leaves the rest alone.

One frozen tab could block every call

The wrong guess still pointed at a real weakness. Attaching to an existing Chrome ran a setup script in every frame of every open tab, with no timeout, so one tab whose main world does not answer (paused in DevTools, for example) was enough to freeze tabs_batch list. Now each tab gets 1.5 s. A tab that does not answer is listed with unresponsive: true, and a call aimed at it fails in under 2.5 s with "page main world is blocked" instead of hanging. The test pauses a page with debugger; from a second CDP session to reproduce it.

The date field that cleared itself

On the selenium.dev web form, smart_fill_form reported the date as filled. The submitted form had my-date= empty. The date picker widget wiped the value on blur. Fill now reads the value back after blur, retypes once if it changed, and reports clearedAfterBlur or changedAfterBlur so the agent knows something odd happened. On the re-run the form submitted my-date=11/17/2026.

Same form, different bug: the select's first option is a placeholder ("Open this select menu"), and that counted as a filled field. Placeholder options now count as empty.

Submit guard: wrong in both directions

turbo blocks final actions like Submit, Send or Pay unless the agent passes allowSubmit: true. Real sites showed two problems.

It fired on things that are not submissions: clicking a story title link on HN, pressing Enter in a site search box. Links and search forms no longer count.

It missed things that are submissions. I had the agent book a real call on a Notion Calendar page, in Vietnamese. smart_fill_form returned submitButtons: [] although the form ended in "Lên lịch họp" ("Schedule meeting"), so the guard had no idea that button was the final step. Booking verbs ("Book now", "Schedule meeting", "Đặt lịch") are in the guard now.

The same booking found a hole in verification. After the click, expect.textMatches: "xác nhận" ("confirm") passed in 6 ms, because the page already said "details are provided on confirmation" before anything happened. There is now expect.textNew, which only counts text that was not on the page when the batch started (or a new document title).

Logged out without knowing it

Around 05:40 Chrome stopped accepting remote debugging (I had not touched it). The bridge process stayed alive, but its upstream was gone, and the server quietly fell back to a headless browser. The agent kept working, now logged out of everything, and nothing in the tool results said so.

Two changes. The bridge exits when its upstream closes. In auto mode the first tool result after a fallback carries one connectionNote: "Chrome remote debugging is no longer available (bridge upstream closed); using a headless browser. Logged-in sites will not be available."

The headless fallback then hit the next gap. old.reddit.com redirected to /login?reason=lor2 with a 403 and an empty title, and the agent had nothing to explain why the page was empty. Redirects onto login paths and 401/403 login forms now report blocked: "authwall".

Smaller ones

  • Clicking a disabled button waited for the full action timeout. It now fails in about a second.
  • collect on HN took the vote link instead of the story link when the text selector matched the title anchor.
  • Typing into a field with maxlength or an input mask silently cut the text. The result now carries a mismatch note, without echoing password or secret values.
  • Tabs opened by another turbo process in its own isolated context were listed as default. They are now other.

Things that came out of reading other tools

While I was at it I read how other browser agents handle untrusted pages and credentials, and added three opt-in features: a host allowlist (--allow-hosts), $secret:NAME placeholders read from a dotenv file at typing time, and --content-boundaries, which wraps page text in <<page:nonce>> markers. All three are off by default and cost nothing when off.

What is still not great

One of the 38 real-site checks failed once and passed on the next run, and I did not keep the output. On a loaded Windows laptop a few timing tests in the suite of 677 also flake; CI on Linux is green. If you hit a hang or a wrong result, the most useful issue is the exact tool arguments plus the output, the same format I used for these notes.

npx -y turbo-browser-mcp
Enter fullscreen mode Exit fullscreen mode

Repo: https://github.com/Tthanh2k6/turbo-browser-mcp

Top comments (19)

Collapse
 
mike-johnstone profile image
Mike Johnstone •

With expect.textNew, I'd still check that the new confirmation belongs to the action just taken. A toast from another request is new too. For the booking example, a reference plus the submitted date would be stronger evidence than a fresh 'Success' message.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

Good point. Right now expect lets you combine textNew with urlMatches and selector, so passing the chosen date or slot text instead of a generic "Success" string is the safer pattern when background toasts can fire.

Collapse
 
agentsearchhq profile image
AgentSearch •

The submit guard section is the part I'd steal. A verb list will keep missing cases (localized labels, icon-only buttons), so have you tried also checking what the click would actually do, like whether the button sits inside a form with a POST action, or whether it fires a non-GET request? Treating "unknown final step" as blocked by default and letting the agent ask seems safer than growing the list forever. And +1 on reading the value back after blur. Date pickers fool almost every fill tool I've seen.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

The guard checks more than the label. A type=submit button or any button inside a form counts as a submit, and a safe label like Search lets it through. Icon-only buttons outside a form do slip past, you're right there. Watching for a non-GET request after the click would make a good second check, I'll try it.

Collapse
 
agentsearchhq profile image
AgentSearch •

Makes sense, type=submit plus form membership covers the common cases. The non-GET watch is a nice backstop because it catches the side effect itself, whatever the button looks like, including JS handlers that fire a fetch on click. Curious how it goes.

Collapse
 
onelifevibe profile image
OneLifeVibe •

The date field story is the one I will remember. A fill that reports success and then quietly loses the value on blur is worse than a fill that fails loudly, because everything downstream trusts it. Reading the value back after blur is a simple check, and it is the kind of check that belongs in every form flow, not only in agent tooling. The submit guard lesson lands the same way: a guard that only watches labels will miss real submissions and block harmless clicks, so checking the form and the button type makes a lot more sense.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

Same feeling here. The silent success was worse than any crash, because the agent went on and submitted the form. Reading the value back also caught a second case later: fields with maxlength or an input mask that cut the typed text. Those now come back with a mismatch note instead of a plain ok.

Collapse
 
x1y1co profile image
X1Y1 •

The authwall label is a good addition. I'd add a separate one for bot walls, because they look like empty pages too. When we ran our agent-readiness checker on the 50 state election sites plus DC, 10 sent a bot-protection response, and a few served a near-empty noindex page instead. Virginia gave our checker 1 word and a normal browser 482. An agent that reads that as "the page is empty" draws the wrong conclusion. Flagging a 403/429 from a bot-protection layer, a Cloudflare "Just a moment..." title or a tiny noindex body as blocked: "challenge" would tell it to stop instead of guessing.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

Part of this is in already: a "Just a moment..." title or a verify-you're-human body comes back as blocked: cloudflare, bot-wall or captcha. The near-empty noindex page isn't covered yet. Your Virginia numbers (1 word vs 482) are a good test case, I'll add it.

Collapse
 
cianspider profile image
Cian •

The one that got me from the same kind of overnight run: stale uids. I'd take a snapshot, the page's own JS re-rendered, and the uid I was about to click pointed at a different element entirely. The click "succeeded". Now I re-snapshot immediately before every act and treat any uid older than one navigation as invalid. Related trap: a page returning HTTP 200 told me nothing about whether the thing I cared about actually rendered. Your per-tab timeout with unresponsive: true is a good shape. I run a paid audit endpoint that catches this class of MCP/browser flakiness, disclosure that it's mine, but the re-snapshot rule costs nothing.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

turbo covers that one by never reusing a ref inside a document. New refs start above the highest one already handed out, so a stale ref fails with a hint and can't land on a different element. The 200-but-nothing-rendered case is why act can wait for the text it expects to show up.

Collapse
 
mp3sss31 profile image
mp3sss •

The CDP session-mixing failure is a great concrete warning: a shared upstream connection only works if the bridge really isolates per-client sessions and contexts, otherwise one silent client can stall every evaluate waiting on a context event it never receives. The per-tab timeout is the other half of that same lesson; without a bounded setup probe, one paused frame becomes a global blocker for the whole batch. This maps directly onto Electron multi-window automation: each WebContents should get its own detached session and a hard probe timeout before any scripted action, and an unresponsive renderer should be reported as such rather than allowed to hang the orchestrator.

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

Agreed. The per-tab timeout was the cheaper half to add, and it turned a silent hang into an error the agent could act on. I haven't automated Electron, but one session per WebContents sounds like the same rule.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

Unattended runs need their cap inside the run: a turn limit first, and a budget per job on top. A morning review of the bill arrives after the money is gone. Does your run have a turn limit?

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

No hard cap in that run. It was a Claude Code loop on a subscription, one pass every 30 minutes, so the risk was burning quota rather than a bill showing up later. You're right that the limit belongs inside each pass though. A --max-turns per pass is cheap to add and I'll set it before the next overnight run.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@tthanh2k6 Agreed, the cap that matters is the one inside each pass. A monthly limit only tells you the damage after the pass already ran.

Collapse
 
axialisteam profile image
Axialis Software •

For repeated exports, how does textNew distinguish a fresh “Export complete” message from the previous one?

Collapse
 
tthanh2k6 profile image
Trung Thanh Tran •

Before the step runs, textNew records every visible DOM element already holding that text in a WeakSet. If the second export mounts a new toast node, !seen.has(el) catches it. If the app reuses the same visible status element in place, seen.has(el) skips it, so you have to wait for textGone (or "Exporting...") first.

Collapse
 
axialisteam profile image
Axialis Software •

Thanks, that clears it up. I hadn’t thought about the two exports sharing the same status line.