makecindy / makecindy/cindy

[Bug][目标模式] 长时间续跑时内存持续增长并多次超过 2.2 GB 阈值

Open
#355 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 现象

Windows 10、Cindy 0.1.10 的目标模式运行 31.22 分钟(1874 个采样点)后,总内存由 1682.41 MB 增至 2461.91 MB,Private Bytes 由 1257.65 MB 增至 1771.56 MB。总内存峰值 3574.23 MB、Private 峰值 2930.44 MB,并出现 4 次超过 2200 MB 阈值的记录。测试包精确 commit 未记录,源码关联基于 main@f3c7cfacef07b535c46e9adf89688ef98b8151c7。

## 复现步骤

1. 在 Windows 上启动 Cindy 并开始采集 Cindy Electron 进程树性能数据。
2. 新建会话,创建一条能够持续多轮执行的目标。
3. 让目标自动续跑约 30 分钟,不手动停止或关闭会话。
4. 记录每轮目标执行期间的总内存、Private Bytes、进程树和目标轮次。
5. 目标结束后继续静置 5–10 分钟,观察内存是否回落。
6. 对比起点、峰值、结束值和静置后的稳定值。

## 期望行为

目标长时间续跑时内存保持在可解释范围;目标完成、暂停或停止后,本轮产生的资源在稳定窗口内释放。预算和轮次保护能够阻止无边界续跑。

## 实际行为

31.22 分钟内总内存净增 779.50 MB、Private Bytes 净增 513.91 MB,总内存峰值达到 3574.23 MB,并发生 4 次阈值突破;结束时仍未回到起始水平。

## 源码分析

`apps/desktop/src/main/goal-host/controller.ts` 负责目标 continuation,预算和轮次限制仅在配置后生效;`goal-host/sessionRestore.ts` 会恢复原生 SDK session;`goal-host/storage.ts`、`goal-host/index.ts` 与 `localDb/ipc/messages.ts` 持续写入目标状态和消息。现有采样缺少每进程内存、context token、compaction、目标轮次和 Worker 数,尚不能把增长归因到长上下文、Goal 状态、Worker 或某个单独进程。

## 验收标准

- [ ] 固定目标执行至少 30 轮并完成 2 小时 soak,内存不随轮次单调增长。
- [ ] 记录 Main、Renderer、Agent、Worker 的 RSS/Private Bytes、目标轮次、context token 与 compaction。
- [ ] 目标完成、暂停、停止后静置 5–10 分钟,相关资源回到可解释稳定值。
- [ ] 未配置或达到预算/轮次边界时,continuation 行为明确且不会无边界运行。
- [ ] 覆盖恢复会话、无 Worker、固定 Worker、异常中止场景。
- [ ] 完成 Windows/macOS 回归并保留对照数据。

Contributor guide

Open the contributing guide

Research direction

Start by reading apps/desktop/src/main/goal-host/controller.ts, sessionRestore.ts, storage.ts, index.ts, and localDb/ipc/messages.ts to map continuation, session restoration, and state writes. Reproduce the Windows soak while recording per-process RSS/Private Bytes, context tokens, compaction, rounds, and Worker counts. Done means the listed completion, pause, stop, boundary, recovery, Worker, abort, and cross-platform checks have stable comparison data.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
desktop, observability, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.