Repository navigation
engine: opt-in idle reaper for subscription tmux sessions (#141) - #142
Merged
Merged
Conversation
The Configuration dialog kept a fixed 740px width and an 86vh cap, so on a large screen most of the window stayed empty while the form, its tabs and the search bar were squeezed together. It now uses min(1180px, 96vw) by 88dvh. Refs #136
A chat on the subscription engine keeps `ccs-<id>` — and every MCP server that pane spawned, ~1.2 GB on a typical set — alive after its turn ends. Nothing reaped it: CLAUDE_IDLE_TIMEOUT_MS only bounds a single turn, so memory grew with every chat opened since the last restart. CCS_ENGINE_IDLE_KILL_MS (unset or 0 = today's behaviour) kills a pane that has had no turn and no attached viewer for that long; the next message respawns it with `--resume <cid>`, the path the config-change respawn already uses, so no history is lost. Never reaped: a running turn (answered from server.js's activeTasks / activeChatSessions / in_progress-task registries, which also cover the autoSkill window), an attached viewer (and while attached it refreshes the clock, so a viewer that leaves does not leave an expired timer behind), a pending prompt or a spinner still animating (#20), and a pane of unknown age — its clock is started instead of trusted. test/engine-idle-reaper.test.js pins the decision table through injected seams and drives a real tmux pane, where a control-mode client must count as a viewer. Refs #141
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the reaper proposed in #141. A chat on the subscription engine keeps
ccs-<id>— and every MCP server that pane spawned, ~1.2 GB on a typical set — alive after its turn ends. Nothing reaped it:CLAUDE_IDLE_TIMEOUT_MSonly bounds a single turn, so memory grew with every chat opened since the last restart.CCS_ENGINE_IDLE_KILL_MS(unset or 0 = today's behaviour, opt-in) kills a pane that has had no turn and no attached viewer for that long. The next message respawns it with--resume <cid>— the path the config-change respawn already uses — so no history is lost.Never reaped (all deliberate)
server.js's own registries (activeTasks/activeChatSessions/ anin_progressKanban task), which also covers the autoSkill window before the subprocess exists.view=engine, or a human intmux attach) — and while attached it refreshes the clock, so a viewer that reads for an hour and then leaves does not leave an expired timer behind.The idle clock is stamped when a turn ends (not when the pane spawns), so a long first turn never counts as idle time.
CCS_SESSIONcarries the exact local session id, so the kill uses the same name the engine uses even whentmuxName()had to sanitize it.Verification
node test/engine-idle-reaper.test.js— 24 checks: the decision table through injected seams, plus a real tmux pane where a control-mode client must count as an attached viewer (this pins that#{client_session}and the comparison line up).an attached viewer survives — expected [], got ["watched"]), so the suite is not vacuous.npm testchain on Node 24: 94 of 95 suites pass; the one failure istest/task-backlog.test.js, which fails identically on a pristineorigin/mainworktree (21.0 s, rc=1) — pre-existing, unrelated.tmuxbinary, so the real-tmux block skipped locally;ci.ymlinstalls tmux and runs it there.Refs #141