Repository navigation
fix: sync MCP download and extension profile handling - #136
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe PR adds Chrome profile discovery for extension launches and updates ChangesExtension profile selection
Download navigation handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MCPContext
participant CDPRelayServer
participant ChromeProfileFilesystem
participant PlaywrightChrome
MCPContext->>CDPRelayServer: ensureExtensionConnectionForMCPContext
CDPRelayServer->>CDPRelayServer: await _connectBrowser
CDPRelayServer->>ChromeProfileFilesystem: findPlaywrightExtensionProfile(userDataDir)
ChromeProfileFilesystem-->>CDPRelayServer: matching profile directory
CDPRelayServer->>PlaywrightChrome: launch with selected Chrome profile
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d02a5344b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/extension/cdpRelay.ts (1)
103-143: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winHonor cancellation before spawning Chrome.
If the signal aborts while awaiting profile discovery, Chrome is still spawned. The subsequent
abortlistener is registered after the event fired, so this call can then wait indefinitely. Pass the signal into_connectBrowserand recheck it immediately afterfindPlaywrightExtensionProfile()and beforespawn().Proposed fix
- await this._connectBrowser(clientInfo); + await this._connectBrowser(clientInfo, abortSignal); - private async _connectBrowser(clientInfo: ClientInfo) { + private async _connectBrowser(clientInfo: ClientInfo, abortSignal: AbortSignal) { // ... if (this._userDataDir) { args.push(`--user-data-dir=${this._userDataDir}`); const profileDirectory = await findPlaywrightExtensionProfile(this._userDataDir); + if (abortSignal.aborted) + throw abortSignal.reason; if (profileDirectory) args.push(`--profile-directory=${profileDirectory}`); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/extension/cdpRelay.ts` around lines 103 - 143, Pass the existing abort signal from the connection flow into _connectBrowser, then recheck it immediately after findPlaywrightExtensionProfile() and again before spawning Chrome. Ensure an already-aborted signal exits or rejects before spawn, preventing the subsequent connection wait from hanging.
🧹 Nitpick comments (1)
tests/extension-protocol.test.ts (1)
277-295: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the test prove last-used preference.
Profile 1is the only profile containing the extension, so the assertion passes even ifLocal State.profile.last_usedis never applied. Install the extension inDefaulttoo; without the preference logic, deterministic ordering would then chooseDefault.Proposed test adjustment
- await fs.mkdir(path.join(userDataDir, 'Default'), { recursive: true }); + await fs.mkdir(path.join(userDataDir, 'Default', 'Extensions', EXTENSION_ID), { recursive: true });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/extension-protocol.test.ts` around lines 277 - 295, The test setup around ensureExtensionConnectionForMCPContext must install the extension in both the Default and Profile 1 directories, while keeping Local State.profile.last_used set to Profile 1. This ensures the existing --profile-directory=Profile 1 assertion specifically verifies last-used profile selection rather than merely finding the only profile containing the extension.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tab.ts`:
- Around line 188-192: Bound the await of downloadEvent in the navigation
error-handling flow so it uses a finite timeout instead of waiting indefinitely.
When the timeout expires or no download is received, rethrow the original error
e, while preserving the existing handling for a valid download event.
---
Outside diff comments:
In `@src/extension/cdpRelay.ts`:
- Around line 103-143: Pass the existing abort signal from the connection flow
into _connectBrowser, then recheck it immediately after
findPlaywrightExtensionProfile() and again before spawning Chrome. Ensure an
already-aborted signal exits or rejects before spawn, preventing the subsequent
connection wait from hanging.
---
Nitpick comments:
In `@tests/extension-protocol.test.ts`:
- Around line 277-295: The test setup around
ensureExtensionConnectionForMCPContext must install the extension in both the
Default and Profile 1 directories, while keeping Local State.profile.last_used
set to Profile 1. This ensures the existing --profile-directory=Profile 1
assertion specifically verifies last-used profile selection rather than merely
finding the only profile containing the extension.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 10ffb944-abd7-408a-9a2d-73a4b3342988
📒 Files selected for processing (5)
README.mdsrc/extension/cdpRelay.tssrc/tab.tstests/extension-protocol.test.tstests/tab.test.ts
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5573f9dcec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Download is startingnavigation error is treated as a download, so unrelated Chromiumnet::ERR_ABORTEDfailures return immediately instead of waiting up to three seconds.--user-data-dircontains multiple profiles, preferring Chrome's last-used profile.Why this matters
The navigation path used a broad Chromium error heuristic that delayed genuine failures and could misclassify aborted navigations. Extension mode passed the user-data directory without a profile, so Chrome could open
Defaulteven when the extension had been validated or installed in another profile, leaving the connection waiting indefinitely.Validation
npm test -- tests/tab.test.ts tests/extension-protocol.test.ts(39 tests)npm run lintnpm run buildnpm test(34 files, 372 tests)git diff --checkSummary by CodeRabbit
New Features
Bug Fixes
Documentation
--user-data-dir.