Skip to content

app: each new chat keeps ~10 files open in the engine for the life of the app (macOS soak) #2471

Open

Description

@AbirAbbas

Measured on macOS 15.6 / Apple Silicon during a 58-minute soak (2026-11-06). Engine: app/v3 3a6aa31 + #2466. Desk: main 0f1974872.

What happens: each new chat leaves codeaf app holding about 10 more open files for as long as the app runs. The files are the project directory, .cell, transcript.jsonl, meta, lock, presence, card and told files. The seeded long chat holds 7.

  • During the steady phase, three tool turns each ran in a new chat. Engine fds went 59 → 74 → 85 → ~96, flat between turns.
  • Over the same phase, per 10 min: engine footprint +5.6 MB, threads +0.5, wakeups +1.7/s.
  • Desk processes (app, WebContent, WebKit GPU) stayed flat over the same phase.

Likely cause: a chat whose window is open is never released (app.go:79-82). Each chat also keeps its presence heartbeat (5 s / 7 s, session/taskpresence.go). On macOS, fsnotify's kqueue backend holds a handle per watched file in each session folder.

Why it matters: growth is bounded by the number of chats opened in a session, not by time. A long-lived app that opens many chats keeps accumulating fds and per-chat timers.

Possible direction: close an idle chat's files and watches when it isn't shown and has no live turn. Keep the presence heartbeat, which #2065 keeps on purpose; only the watch and the open files would go.

Raw data: soak-60s.jsonl and soak-turn-{1,2,3}.jsonl from the push (sampler: libproc rusage per pid).

🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    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