Repository navigation
fix(sessions): bounded resumable lookup, connector-file retention, reap pane-less claude (v0.471.0) - #907
Merged
Conversation
…ap pane-less claude (v0.471.0) The console's 1.5s sessions poll read the whole connectors folder (61k files on a live tenant, ~50ms a call); with several tabs open on a CPU/swap-starved box the server stopped answering. The summary path now stats only its rows and the full list memoizes on the folder mtime. Ended sessions older than 30 days with no live pane now keep only their .log, pruning stale credential copies (.mcp.json, .env) in bounded passes. The process janitor reaps a claude whose session pane is gone (one ran 70 days at 23 GB after its pane was stopped), asking the owning tenant for liveness and never killing on unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
A live tenant stopped answering (
/healthtimed out, 460 queued connections). Three compounding causes:resumableIds()read the wholeconnectors/folder on every/api/sessions/summary, the console's 1.5s poll. The folder had 61k files (677 MB), so each read took ~50ms..mcp.json) and session secret (.env).claudewhose pane had been stopped 70 days earlier was still running at 23 GB RSS, with swap full. Six more pane-lessclaudeprocesses (8–50 days old) were on the box. No reaper could see them.What
resumableIds: the by-id (summary) path stats only the visible rows. The full list reads the folder once and reuses the result until the folder's mtime changes.pruneConnectorFiles(every 10 min off the reaper, ≤500 sessions/pass, auditedconnectors.pruned): an ended (done/stopped/crashed) session older than 30 days with no live pane keeps onlysession-<id>.log. Files left by deleted sessions are aged by their mtime. Nothing is pruned when liveness is unknown.claudekind: matches a session'sclaudeby--mcp-config <dir>/session-<id>.mcp.jsonand asks the tenant that owns<dir>viasessionPaneAlive. It reaps only on a definitefalse, seen on two sweeps past the 10-min grace, and never onnull.Tests
scripts/connectors-retention-test.cjs. It checks that the summary path does no readdir, that the memo is invalidated when a file is removed, which sessions retention prunes and which it keeps, the per-pass bound, and that nothing happens when liveness is unknown.scripts/process-janitor-test.cjs.npm run test:governancegreen.🤖 Generated with Claude Code