Skip to content

fix: clean up cancelled CDP commands - #235

Open
one241 wants to merge 1 commit into
AIPexStudio:mainfrom
one241:fix/cdp-command-cancellation-cleanup
Open

fix: clean up cancelled CDP commands#235
one241 wants to merge 1 commit into
AIPexStudio:mainfrom
one241:fix/cdp-command-cancellation-cleanup

Conversation

@one241

@one241 one241 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Pending CDP commands are rejected when the debugger detaches, but their timeout and abort resources are not consistently cleaned up. Late Chrome callbacks can also attempt to settle commands that have already timed out or been cancelled.

Root cause

The pending-command registry stores raw reject callbacks and each completion path performs only partial cleanup. There is no shared single-settlement guard or AbortSignal integration.

Changes

  • Add optional AbortSignal support at the commander and per-command levels.
  • Route timeout, signal cancellation, and debugger cleanup through one idempotent rejection path.
  • Remove timeout and abort listeners and delete empty pending-command sets.
  • Ignore late Chrome callbacks after a command has settled.
  • Capture chrome.runtime.lastError synchronously inside the callback.

Tests

  • Added regression coverage for signal cancellation, debugger cleanup, timeout cleanup, and harmless late callbacks.
  • Targeted Browser Runtime test: 3 passed.
  • Full npm run preflight passed: Core 215, DOM Snapshot 132, Browser Runtime 147, AIPex React 109 passed / 10 skipped, Browser Extension 36.

Note: the pre-push hook reports failure because the existing formatter rewrites unrelated mcp-bridge files. Those unrelated changes were discarded; all typechecks and tests completed successfully.

@buttercannfly

Copy link
Copy Markdown
Collaborator

need fix format issue, make ci pass @one241

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.

2 participants