Skip to content

perf(subagents): retained child 持续运行每 5 秒 Git polling #182

Closed

Description

@tt-a1i

问题

每个 Direct Subagent child 都会加载 git-info,创建自己的 Git 状态刷新链路,并每 5 秒持续执行 Git 探测。Subagent manager 又会保留 settled child Session 供后续 send/takeover 使用,因此已结束但未释放的 child 继续轮询。

证据

  • extensions/git-info/index.ts:72-139,167-203:每个 extension instance 建立刷新与 5 秒 polling;仓库内一次刷新可启动多条 Git 命令,仓库外仍有探测进程。
  • extensions/subagents/src/manager.ts:307-320:settled child 被保留而不是立即 dispose。

成本近似:O(retained child 数 × repository scan 成本 / 5s)。大量历史 child 会持续产生后台进程、CPU 与磁盘访问,即使没有任何 agent 在运行。

期望

  • child Session 不继承只服务父 TUI 的常驻 Git polling,或 settled 后可靠暂停;
  • 需要 Git 信息时按需读取或共享父级只读快照,不建立每-child watcher;
  • restart/send 时能恢复所需能力,不靠永久 polling 保活;
  • dispose、session shutdown 和异常路径全部清理 timer/process;
  • benchmark:1/8/64 个 settled children 静置 30 秒,记录 Git subprocess 数、CPU 和 wakeup;settled 数增长不应线性增加 polling。

Activity

  1. added
    bug
    on Aug 25, 2026
  2. self-assigned this
    on Aug 28, 2026
  3. tt-a1i commented on Aug 28, 2026

    @tt-a1i
    CollaboratorAuthor

    I’m taking this issue.

    I’ll keep the change scoped to Direct Subagent child sessions: prevent parent-TUI-only Git polling from remaining active in retained headless children, while preserving child tools, send/restart behavior, shutdown cleanup, and the parent session’s Git dashboard.

    I’ll add a regression that proves child resource loading no longer starts the polling extension, plus a 1/8/64-child idle benchmark or equivalent deterministic subprocess accounting. The implementation will go through compatibility-impact review, full repository validation, and independent review before a PR is opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions