Sessions leak memory — OOM kills from zombie accumulation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 12
- Forks
- 1
- Avg merge
- 7h 13m
- Merged PRs (30d)
- 31
Description
Problem
Sessions that finish, crash, or get abandoned never have their finished_at set in the registry. They stay marked as "status": "running" forever. Over time, the orphaned tmux sessions and their child processes (node, claude) accumulate and eat memory until the OOM killer starts picking off active sessions.
Evidence from today:
- 19 sessions killed with exit code 137 (SIGKILL/OOM) across the registry's lifetime
- At time of the latest kill (
neowolt-dusty-branch-a8dc99), 11+ sessions had been spawned in the last 6 hours alone - Dozens of older sessions still marked
"running"withfinished_atnever set - Container has 7.7GB RAM, swap was nearly full (877M/1G used)
What needs to happen
1. Session reaper — periodic cleanup that:
- Checks if the tmux session still exists for each "running" registry entry
- If the tmux session is gone, marks it as
orphaned/finishedwith a timestamp - Optionally kills tmux sessions that have been idle too long (no claude process, no recent activity)
2. Lifecycle hooks — set finished_at and status when:
- Claude process exits (exit code capture already works —
exit_code: 137was recorded) - tmux session is destroyed
- Session is explicitly stopped
3. Memory budget — optional but useful:
- Cap max concurrent sessions (e.g., reject new spawns if N active)
- Or at minimum, warn when memory is above a threshold before spawning
Where to look
- Registry files:
.state/registry/*.json - Session spawn logic: wherever tmux sessions + claude are launched
- The
finished_atfield exists in the schema but is only set for some exit paths
Impact
Active sessions get randomly killed mid-conversation. Work is lost, user gets no warning. The killed session today was mid-conversation with the user doing iterative design work.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting .state/registry/*.json to understand the recorded status and finished_at fields, then locate the session spawn logic where tmux and Claude are launched. Trace the existing exit-code handling and explicit stop path. Done means orphaned and completed sessions are finalized, stale sessions are cleaned up safely, and new spawns have the requested memory protection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100