Skip to content

usage-bar: template file cache grows unbounded with live fs.watch watchers #98960

Description

@zhangLei99586

Summary

In src/auto-reply/usage-bar/template.ts, the module-level fileCache Map holds a live fs.watch watcher for each cached template file path. The cache grows without bound — entries are never evicted, and watchers are only closed in clearUsageBarTemplateCacheForTest().

Reproduction

Source inspection: cacheTemplateFile() at line 146 inserts without checking cache size. Each new file path creates a persistent watcher.

Expected

Add a max size limit and evict the oldest entry (closing its watcher) before inserting new ones.

Scope

src/auto-reply/usage-bar/template.ts — 1 file, ~8 LoC change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions