Skip to content

Git status spawns one process per untracked file #1489

Closed

Description

@budah1987

Summary

Workspace.getStatus() runs git diff --no-index --numstat once for every untracked file. Large generated directories can therefore create thousands of Git child processes during automatic status refreshes.

Measured impact

A workspace with 43,832 untracked .pnpm-store files produced:

  • 3,866 Git children during an 8-second trace
  • 909 Git children during a 3-second trace
  • roughly 300–480 Git launches per second
  • repeated host-daemon event-loop stalls between 500 ms and 1,885 ms

The caller can time out while the daemon continues the scan. A queued trailing refresh can then start another scan.

Affected paths

  • packages/host-workspace/src/workspace.ts: readUntrackedNumstatEntries() from getStatus()
  • readUntrackedDiffFileStats() repeats one Git process per untracked file
  • readUntrackedDiffArtifacts() can run three Git commands per untracked file
  • server file-count limits run after the daemon completes this work

The status behavior came from d4127a0a1 (#113). The paginated diff behavior came from 27c4e371c (#91).

Suggested change

For automatic status, keep untracked file paths but omit exact line counts. Compute exact untracked patches only on demand, with limits applied before child processes start.

Also propagate request cancellation to the daemon and active Git children. Coalesce replacement refreshes without running an expired scan again.

T3 Code uses this simpler status shape: one porcelain status command plus tracked numstat commands. It records untracked paths without one Git command per path.

Activity

  1. budah1987 commented on Aug 13, 2026

    @budah1987
    Author

    I implemented the focused fix in BBamir PR budah1987#47.

    The patch keeps untracked paths in automatic status, but leaves their line counts unknown. It also moves the 5,000-file guard before per-file diff work and adds server-to-daemon cancellation.

    A 2,000-untracked-file benchmark fell from 2,009 expected Git processes to 9 measured processes. Patched status runs completed in 110–128 ms.

  2. self-assigned this
    on Aug 13, 2026
  3. added a commit that references this issue on Aug 13, 2026
    2292db1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions