Skip to content

fix: recycle Browser Run sessions on HTTP 410#1981

Open
agent-think[bot] wants to merge 1 commit into
mainfrom
fix/issue-1980-1784883305
Open

fix: recycle Browser Run sessions on HTTP 410#1981
agent-think[bot] wants to merge 1 commit into
mainfrom
fix/issue-1980-1784883305

Conversation

@agent-think

@agent-think agent-think Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Closes #1980.

What changed

  • treat Browser Run HTTP 410 Gone as a missing/expired session, alongside 404
  • clear the stale shared-session record and transparently create a replacement
  • retain errors for unrelated statuses such as 500
  • add regression coverage for both the execution path and sessionInfo() cleanup
  • add a patch changeset

Browser Run status validation

I deployed a temporary Browser Run probe and called the binding directly. It confirmed:

  • GET /v1/devtools/browser/<expired-session>/json/list returns 410 with {"error":"Failed to list targets: 410"} after keep_alive expiry
  • DELETE /v1/devtools/browser/<expired-session> returns 404 with {"error":"Failed to delete browser session: 404"}
  • a never-created UUID returns 404 for both list and delete

This means connector liveness checks need to recognize both 404 (unknown/deleted) and 410 (expired), while continuing to surface all other errors.

Verification

  • regression proof: the new HTTP 410 recycling test fails against the old helper (after all 3 configured retries) with BrowserRenderingError ... status: 410
  • pnpm --filter agents exec vitest run --config src/tests/vitest.config.ts src/tests/browser-connector.test.ts34 passed
  • pnpm run checkpassed (all 117 TypeScript projects)
  • pnpm run buildpassed (25 projects)
  • packed the changed agents build and deployed a temporary full-stack Browser Run demo; its API returned passed: true with a new replacement session ID after the injected stale-session 410

Demo: https://issue-1980-browser-session-recycle.magnificent-supermarket.workers.dev


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f778708

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Patch
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1981

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1981

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1981

create-think

npm i https://pkg.pr.new/create-think@1981

hono-agents

npm i https://pkg.pr.new/hono-agents@1981

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1981

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1981

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1981

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1981

commit: f778708

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserConnector session recycle misses HTTP 410 (expired Browser Rendering session not replaced)

0 participants