feat: make the resume session cap configurable, and raise it to 200 - #343
Merged
Merged
Conversation
On daemon start, sessions are restored from disk newest-first under two guards: a count cap (RESUME_MAX_SESSIONS) and a 20s deadline. The cap was a hardcoded 50, which is the binding constraint long before the deadline is on a box that keeps many long-lived sessions — a daemon with 93 sessions on disk restored 50 and silently left 43 behind, recoverable only by editing the source and restarting. The deadline is the guard that actually protects startup: it is measured against real work done, where the count is a guess about how much work 50 sessions represent. So raise the default to 200 and let the deadline bind first, while making the value reachable without a source edit. - session.resumeMaxSessions in config.json (zod-validated, min 1) - CODEOID_RESUME_MAX_SESSIONS env override - surfaced in the settings manifest, so it is editable from the web UI - documented in docs/CONFIGURATION.md Sessions past the cap are unchanged in behaviour: they stay on disk and load on a later restart. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jalbrethsen-highflame
approved these changes
Sep 24, 2026
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
On daemon start, codeoid restores sessions from disk newest-first under two guards: a count cap and a 20-second deadline. The cap was a hardcoded
50.This makes the cap configurable and raises the default to
200.Why
On a daemon that keeps many long-lived sessions, the count cap binds long before the deadline does. A daemon with 93 sessions on disk restored 50 and left 43 behind:
Nothing was lost — those sessions stay on disk — but the only way to get them back was to edit the constant and restart. That is the kind of local edit that lives on as an uncommitted diff across machines and gets reverted by the next
git pull.Of the two guards, the deadline is the one that actually protects startup: it measures real work done, where the count is a guess about how much work 50 sessions represent. Letting the deadline bind first is the better default, so the cap becomes a backstop rather than the primary limit.
How
config.jsonsession.resumeMaxSessions— zod-validated,min(1), default200CODEOID_RESUME_MAX_SESSIONS(table-driven override,kind: "int")docs/CONFIGURATION.mdsession-managerreadsthis.#config?.session?.resumeMaxSessions ?? RESUME_MAX_SESSIONS_DEFAULT, matching the existingcollaboration.maxLiveChildrenidiom, so noprocess.envread leaks outsideconfig.tsand tests can still construct a manager without config.The startup log now reports the cap actually in use rather than a literal 50.
Behaviour change
Daemons that never set this go from restoring up to 50 sessions to up to 200. Startup cost stays bounded by the unchanged 20s deadline, so the practical effect on a machine with few sessions is nil, and on a busy one it trades a few seconds of startup for sessions that are actually there. Sessions past the cap behave as before: left on disk, loaded on a later restart.
Verification
bun run typecheckcleanbun run lintclean (372 files)bun test— 2593 pass, 12 skip, 0 fail🤖 Generated with Claude Code