DEV Community

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

Trung Thanh Tran on November 17, 2026

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 an...
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 Sotware •

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 Sotware •

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