Skip to content

fix(desktop-control): bound V8 inspector script cache for Renderer module catalog - #913

Merged
BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:pr/renderer-inspector-script-cache
Nov 18, 2026
Merged

BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:pr/renderer-inspector-script-cache

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

The Renderer loaded-module catalog enables the V8 inspector Debugger domain only to receive Debugger.scriptParsed URLs. With no maxScriptsCacheSize, the inspector keeps the source of every collected script for as long as the session is attached. That includes the source of each Runtime.evaluate the Controller sends, so native Renderer memory grows without bound over a long Desktop session.

installRendererLoadedModules now calls Debugger.enable with { maxScriptsCacheSize: 0 }. scriptParsed events, and therefore the catalog, are unchanged. Nothing in codexhost calls Debugger.getScriptSource.

Related issues

N/A

Test plan

  • Ran npx vitest run --config tests/vitest.config.js packages/desktop-control/test/renderer-loaded-modules.test.ts packages/desktop-control/test/renderer-cdp-control-session.test.ts on top of v0.21.0: 2 files, 21 tests passed. The tests now assert the Debugger.enable parameters.
  • This change has run in my fork's Desktop builds since v0.18. I have not measured memory again on v0.21.0.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 改进
    • 启用调试器时将脚本缓存大小设为 0,同时继续收集并发布已加载模块的信息。

启用 Debugger 时,代码现在将 maxScriptsCacheSize 设为 0。相关测试新增或更新了对此参数的断言。

Changes: Debugger 脚本缓存配置

Layer / File(s) Summary
配置并验证 Debugger 脚本缓存
packages/desktop-control/src/renderer-loaded-modules.ts, packages/desktop-control/test/renderer-cdp-control-session.test.ts, packages/desktop-control/test/renderer-loaded-modules.test.ts
启用 Debugger 时传入 { maxScriptsCacheSize: 0 }。两个测试文件验证启用命令包含该参数。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 50443

This change limits Renderer memory growth by disabling the debugger's script source cache. The module catalog still gets its script URLs from scriptParsed events. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了本次变更的主要内容:为 Renderer 模块目录所用的 V8 inspector 脚本缓存设置上限。raw_summary 显示 installRendererLoadedModules 启用 Debugger 时传入 maxScriptsCacheSize: 0,测试也随之更新,二者与标题一致。标题中的 fix 前缀和 desktop-control 范围也与变更相符。
Description check Passed 描述说明了变更动机:Renderer 模块目录只需要 Debugger.scriptParsed 的 URL,而默认配置会保留脚本源码,导致原生 Renderer 内存持续增长。描述还说明 installRendererLoadedModules 改为以 { maxScriptsCacheSize: 0 } 调用 Debugger.enable,并列出了测试命令与结果。这些内容与 raw_summ…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

描述说明了变更动机:Renderer 模块目录只需要 Debugger.scriptParsed 的 URL,而默认配置会保留脚本源码,导致原生 Renderer 内存持续增长。描述还说明 installRendererLoadedModules 改为以 { maxScriptsCacheSize: 0 } 调用 Debugger.enable,并列出了测试命令与结果。这些内容与 raw_summary 中的代码和测试变更一致。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b0f9c4d and 50443f1.

Files selected for processing: 3

  • packages/desktop-control/src/renderer-loaded-modules.ts
  • packages/desktop-control/test/renderer-cdp-control-session.test.ts
  • packages/desktop-control/test/renderer-loaded-modules.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check windows-latest
  • GitHub Check: Static checks
  • GitHub Check: Vitest
  • GitHub Check: Check macos-26
  • GitHub Check: Web Host tests
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check Linux ARM64

@BytePioneer-AI
BytePioneer-AI merged commit a96dcea into BytePioneer-AI:main Nov 18, 2026
8 checks passed
@BytePioneer-AI

Copy link
Copy Markdown
Owner

感谢贡献,实测与复核已通过并合入!🎉

ump45nose added a commit to ump45nose/codex-host that referenced this pull request Nov 20, 2026
Every manifest line is now a branch with only its own change, cut from v0.22.0 or from the one branch named in its comment. Drops lines upstream v0.22.0 already has (BytePioneer-AI#913-BytePioneer-AI#917), the covered replay-integration, shared-remote-threads-and-delegation (now thin BytePioneer-AI#970/BytePioneer-AI#971/BytePioneer-AI#972 lines), external-side-chat (now thin BytePioneer-AI#969), remote-ssh-share-local-data, the net-zero Claude Desktop entrypoint pair, and the user-instructions lines rejected upstream as BytePioneer-AI#741. rr-cache holds the recorded resolutions for merging the thin branches onto v0.22.0.

Signed-off-by: Vincent <[email protected]>
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