perf(pi): 缓存超限包结果并回收会话临时目录 - #3524
Conversation
Signed-off-by: lizzjin <lizzjin37@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 091b2cdda7
ℹ️ 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".
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/maker-host/pi-package-store.ts | 新增确定性超限负缓存和启动计时,但安装身份无法感知 package.json 之外的深层内容修复。 |
| packages/maker-core/src/agents/pi/index.ts | 新增本地 config-home owner marker、保守回收、清理重试及 Pi 启动阶段计时,未确认阻塞性缺陷。 |
| apps/desktop/src/main/process-monitor/agent-scan.ts | 新增无缓存的全系统进程快照及 Cindy 管理 Pi 进程识别,用于遗留目录回收决策。 |
| apps/desktop/src/main/maker-host/pi-host.ts | 将主进程的 fresh process scan 注入 Pi 本地遗留 config-home 回收判定。 |
| packages/maker-core/src/agents/pi/pi-subagent-runs.ts | 导出既有进程实例启动时间与存活检查,供 config-home owner 判定复用。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[列出 Pi 包] --> B[计算安装身份]
B --> C{命中持久化超限缓存?}
C -->|是| D[跳过遍历并禁用包]
C -->|否| E[检查与快照]
E -->|确定性超限| F[持久化 inspection-limit]
E -->|成功| G[加载受管资源]
F --> D
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/maker-host/pi-package-store.ts:401-437
**负缓存身份失效不完整**
当本地包因深层 skills、prompts 或 extensions 的条目数或元数据字节数超限后,仅修改或删除这些深层文件不会改变由根目录 stat 和 `package.json` 构成的 `installationIdentity`。后续会话会继续复用 `inspection-limit` 并跳过遍历,导致已经缩小或修复的包仍持续被禁用,直至执行包 mutation 或修改 `package.json`。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "perf(pi): cache package limits and recla..." | Re-trigger Greptile
Signed-off-by: lizzjin <lizzjin37@gmail.com>
Signed-off-by: lizzjin <lizzjin37@gmail.com>
|
补充本轮 review 修复与验证(commit
新增回归覆盖:
最新提交前验证:
maker-core 指标补充:未修改 system prompt、prompt 拼接顺序、tool / MCP schema、translator、模型路由、usage 计量或逐 token event loop;影响限于新会话启动资源装配与结构化 timing。未执行真实 |
|
@lizzjin 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/pi-package-store.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab5b6ac39d
ℹ️ 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".
|
这条 PR 被维护者确认门拦住,需要维护者在 PR 上 Approve 后才能继续合并流程。 当前在拦的是 插件基座: 请维护者在讨论 issue 里看范围后,直接在本 PR Approve;若要改,请 Request Changes。作者这边先不用反复请求 review——球不在你手里。 讨论 issue:#3527 |
Signed-off-by: lizzjin <lizzjin37@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40e62cba61
ℹ️ 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".
Signed-off-by: lizzjin <lizzjin37@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b65a38b3ef
ℹ️ 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".
| // expensive start-time sample within this sweep; each check still performs | ||
| // a fresh signal-0 liveness probe and deletion still re-reads the marker. | ||
| const ownerStartTimeMemo: ProcessStartTimeMemo = new Map(); | ||
| for (const entry of entries) { |
There was a problem hiding this comment.
当 run-tmp 因多次崩溃积累了大量带 marker 的目录时,这个无上限循环会在每次 startSession 前串行处理全部条目;最终版本新增的 PID memo 只复用同一 owner 的启动时间探测,无法限制不同 PID 的同步 ps/PowerShell 调用,也无法限制每个目录最多 125 ms 的删除重试及大型目录递归删除,因此恰好在残留最多的用户环境中会长时间冻结 Main 并阻塞所有新任务启动。请给单次 sweep 设置条目或时间预算,并把剩余回收延后执行。弱端性能应作为基线,尤其需要约束 Windows 上的文件系统密集路径。 docs/dev-rules/engineering-conventions.mdL128-L131
Useful? React with 👍 / 👎.
|
@lizzjin 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/pi/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
这次改了什么
摘要
修复新建 Pi 会话时反复检查、复制和指纹计算大型 Pi 包的问题,并加强会话临时目录的生命周期管理。
确定性的 package inspection / snapshot 限制结果现在会跨会话缓存;安装内容发生变化时自动失效。Pi 启动链路增加分阶段、可关联且脱敏的耗时日志,方便区分 package、MCP、进程启动、RPC ready 和首个模型请求的耗时。
会话仍保留私有、已校验的 ripgrep 副本作为安全边界,但通过带进程实例身份的 owner marker 和保守的遗留目录扫描,避免
run-tmp长期堆积。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
package.json哈希构建 installation identity;包原地升级或 manifest 变化后自动重新检查。startupTraceId下的启动耗时日志。UI 变化
不涉及:本 PR 仅修改 Desktop main 进程、maker-core 和测试,不改变界面、交互或 UI 文案。
怎么验证的
自动验证
手工验证
不涉及 UI 手工验证。本次在 Windows 11 x64 环境完成专项测试、Desktop 全量相关门禁及类型检查。
未执行的验证
npm:context-mode安装执行 Pi 冷启动耗时 benchmark。风险
风险分类
影响与回滚
.cindy插件、数据库 schema 或跨端协议。提交前检查
git commit -s,pnpm check:dco已通过)