Skip to content

fix(browser): reject pending calls on invalidation - #155

Open
green3sf wants to merge 1 commit into
browser-use:mainfrom
green3sf:invalidate-pending-calls
Open

fix(browser): reject pending calls on invalidation#155
green3sf wants to merge 1 commit into
browser-use:mainfrom
green3sf:invalidate-pending-calls

Conversation

@green3sf

@green3sf green3sf commented Aug 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #154

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Session.invalidate() removed the active socket before its close handler ran, so the handler treated the socket as superseded and left in-flight CDP calls pending.

Rejecting and clearing the pending calls during invalidation makes them settle with the same retirement error.

How did you verify your code works?

  • Added a regression test with an unanswered CDP call.
  • Reproduced with a local loopback WebSocket: before the fix it remained pending; after the fix it rejected immediately.
  • git diff --check passes.
  • The Bun test suite was not run locally because Bun is unavailable; CI will run it.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Summary by cubic

Rejects in-flight CDP calls when a session is invalidated to prevent hangs. Previously, Session.invalidate() removed the socket before its close handler ran, leaving pending calls unresolved; now it rejects and clears all pending calls with the same retirement error.

  • Impact: In-flight CDP calls will now reject immediately on invalidation. If you relied on them remaining pending, handle the retirement error instead.

Written for commit 6fbf5db. Summary will update on new commits.

Review in cubic

@green3sf
green3sf marked this pull request as ready for review August 19, 2026 10:07

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

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.

Session.invalidate() leaves in-flight CDP calls pending

1 participant