fix(browser): cap managed tab count to prevent renderer buildup#29724
fix(browser): cap managed tab count to prevent renderer buildup#29724steipete merged 7 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51587f7ff9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR successfully addresses unbounded renderer growth by implementing a tab cap ( Confidence Score: 5/5
Last reviewed commit: 51587f7 |
|
Quick status ping on this PR. The scope remains unchanged: cap managed browser tab count to prevent renderer buildup, while keeping the behavior isolated to the managed profile path. If maintainers want any update now (rebase, extra validation, or adjustments), I can do it. |
|
Addressed the unresolved review note about cleanup failures making What changed in
Validation run:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16423d0368
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Addressed both remaining unresolved review threads in Changes:
Also kept prior fix in place:
Added coverage:
Validation run:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f2fd51a6b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Nice catch again. I agree and fixed this in What changed:
Why:
Added regression test:
Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28c60e7b37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Good point, I agree. I fixed this in What changed:
Added test updates:
Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3091175821
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Agreed, this was still on the return path. Fixed in What changed:
I also adjusted tests to assert cleanup behavior asynchronously. Validation:
|
eaba23d to
24022f6
Compare
|
Landed via temp rebase onto main.
Thanks @pandego! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24022f619e
ℹ️ 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".
| if ( | ||
| profile.driver !== "openclaw" || | ||
| !profile.cdpIsLoopback || | ||
| state().resolved.attachOnly || |
There was a problem hiding this comment.
Gate managed-tab cleanup by profile attachOnly setting
The cleanup guard uses state().resolved.attachOnly (global) instead of profile.attachOnly (per-profile), so attach-only overrides are ignored in this path. That creates inconsistent behavior with ensureBrowserAvailable (which already respects profile.attachOnly): in a mixed config like global attachOnly: true plus profiles.openclaw.attachOnly: false, OpenClaw can launch/manage the profile but tab-cap cleanup is silently disabled, and the inverse override can incorrectly permit cleanup for attach-only profiles. The guard should key off the resolved profile flag.
Useful? React with 👍 / 👎.
Summary
Prevent unbounded renderer growth in the managed
openclawbrowser profile by enforcing a page-tab cap whenever a new tab is opened.Root cause
Browser tool usage often opens new tabs (
/tabs/open) but there was no automatic cleanup path for stale managed tabs. Over time this leaves many renderer processes alive and memory usage grows without bound.Changes
MAX_MANAGED_BROWSER_PAGE_TABS = 8) inserver-context.driver: "openclaw"profile only (no auto-closing user tabs in Chrome extension relay profile).Validation
pnpm vitest src/browser/server-context.remote-tab-ops.test.tspnpm checkpnpm check:docspnpm protocol:checkFixes #29685