Repository navigation
feat(session): let listed sessions skip the idle timeout - #16034
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] bf0cef8 Description read[DESCRIPTION-READ] 6ea6e7ddd00cb65a6f17a5fe87a7457e5391df5a25ab3dbf0843cf65932bddfb That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The idle exemption is justified by #16618, but the loader's two bounds and their warnings carry no harm a user would hit without them. Not justified as shipped
What this change shipsInventory (6 items) — 4 justifiedIntent: let an operator keep specific automation-woken chats warm without raising the global timeout or sending keep-alive turns. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] bf0cef8 Description read[DESCRIPTION-READ] 5d0e418e5478f7ef43d81b77bf8f7e7f0407a748e684a5f1e3d9f665de886243 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
c3670d4 to
a51487d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a51487d to
8d32502
Compare
This comment has been minimized.
This comment has been minimized.
8d32502 to
1407dc0
Compare
This comment has been minimized.
This comment has been minimized.
1407dc0 to
985d46c
Compare
This comment has been minimized.
This comment has been minimized.
|
Read-only review, holding for a maintainer to accept the new session.idle_exempt_keys setting (no issue linked). The logic is sound: exact match, list re-read every sweep, tab close and the RSS recycle still apply, and agents cannot add keys from the sandbox. Before merge: a listed key with no tab (cron:, or a deleted cron job's key) is never reaped until the RSS limit or a restart; please document that or reap keys matching no live owner, and add a test for a listed key that never had a tab. Consider a lower cap than 64, since each entry can keep a full kiro-cli plus MCP process tree alive. |
b12fd6f to
10e768b
Compare
|
@iamwhatever Both points are handled in
The same push rebases the patch onto main |
This comment has been minimized.
This comment has been minimized.
|
Re-checked at 10e768b: thanks, my earlier asks are addressed (a listed key that no tab ever claimed, such as cron:, is now reaped on the normal timeout and tested; the help text says so). I am still not approving from my side because session.idle_exempt_keys is a new setting with no linked, maintainer-accepted issue; once a maintainer accepts the design this looks ready. |
|
@iamwhatever A listed key no tab ever claimed is not reaped on the normal timeout. This PR took the "document that" option from your review: the help text and The design question is open on #16618, which this PR closes. Triage marked it |
session.idle_exempt_keys names sessions the idle sweep never expires on the clock, for a chat that automation wakes hours apart. The sweep reads the list at every pass, so a change needs no restart. A listed session whose tab closes is still reaped, and the RSS recycle still applies to it. A listed session that never had a tab, such as a cron job's, is reaped only by that recycle or a restart, and the docs say so. The loader keeps at most 10 keys, the warm pool's ceiling, of up to 512 characters each and logs once when it drops any.
10e768b to
bf0cef8
Compare
|
Reviewed again at the new head, still not approving (crew-pr-reviewer). Letting listed sessions skip the idle timeout is a new feature that changes resource lifetime. A maintainer should accept it. |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed on behalf of the maintainers (sweep 2026-10-08): readiness passed, required checks green on bf0cef8, no blocking review threads, security posture unchanged. Approving and merging.
Problem / Motivation
Goal: An operator can name chats the idle timeout never ends, so a chat that automation wakes stays warm without a keep-alive message.
A chat that only automation wakes, such as one a script cron notifies with
session="origin", can go hours between turns. Once it has been idle forsession.timeout_secs, the idle sweep ends its process, and the next wake waits for kiro-cli and every MCP server in its agent to start again. Today the ways around that are global or costly: raisingsession.timeout_secs, or setting it to 0, keeps every idle chat's process running, and messaging the chat before each timeout spends a model turn every time and grows its transcript.Why it matters
A dispatcher-style chat that should act within a minute of a new event loses that after every quiet stretch, because its next wake starts cold. Raising the global timeout to protect that one chat keeps every other idle chat's process tree resident as well. Keep-alive messages hold the process, but each one is a full model turn added to the chat's history.
Not a goal
session.watchdog_rss_max_mb) or from the closed-tab reap.What changed (motivation → approach → change)
A new setting,
session.idle_exempt_keys, names sessions the idle clock never expires, so a chat that automation wakes hours apart keeps its process instead of starting cold on each wake.session.idle_exempt_keys[]. A dashboard chat's key isdashboard:followed by thesidin its URL; a tab linked to a cron job or a channel thread uses that link's key, such ascron:<job id>.session.pool_sizealready has, and each listed key can keep the same kiro-cli process tree running. A longer key is dropped, not cut short, and the gateway log warns once per load when it drops any.The idle sweep in
SessionCleanup._expire_idle(session_cleanup.py) asks two questions of each session: has it been idle longer thansession.timeout_secs, and has the tab that owns it closed. A listed key now answers no to the first question only, so closing a dashboard or cron tab still ends it. The sweep reads the list on every pass, the same way it re-reads the timeout. The field is declared inconfig/sections.py, whereIDLE_EXEMPT_KEYS_MAXis set toPOOL_SIZE_MAX.config/loader.pykeeps the non-empty strings, stripped, at mostIDLE_EXEMPT_KEYS_MAX(10) of them and each at mostIDLE_EXEMPT_KEY_MAX_CHARS(512) characters. It drops a longer key rather than cutting it short, since a cut key could match a different session, and loads anything other than a list as no exemptions.The exemption lives in config rather than in a tool, so a chat cannot keep itself running. The session and config specs,
docs/configuration.mdandconfig-baseline.jsondescribe the new setting.Backwards compatibility
Compatible: the diff adds one optional key with an empty default, and a config that does not set it behaves exactly as before.
Tests
test/test_session_idle_exempt_keys.py:cron:key that no tab ever claimed survives the sweep while a live slot set is published, and an unlisted per-run key of the same job expires;[], and aconfig.jsonvalue reachessession.idle_exempt_keys;POOL_SIZE_MAX, and 512 characters: the help text states the 10, and the docs state both;Twenty-one mutations in a throwaway worktree each failed the tests that guard them: dropping the exemption from the idle check, matching listed keys by prefix or by substring, honouring only
dashboard:keys, reading the list once instead of per sweep, extending it to the closed-tab check, reaping a listed key no tab ever claimed, extending it to the RSS recycle, three loader changes (no strip, no list check, keeping empty strings), seven to the bounds (no count limit, no length limit, cutting a key short instead of dropping it, no warning, an over-long key taking a slot, measuring before stripping, warning on a clean list), and three that move a bound (raising the count limit, raising the warm pool ceiling it follows, raising the length limit).Manual verification
The same idle-check change, with one key hard-coded, ran on a host with
session.timeout_secsat 1800, where the sweep runs every 300 seconds. A cron-woken dashboard chat on the list was still running after 37 idle minutes, past the 35 minutes by which the sweep would have ended it. Four unlisted chats that went idle a few minutes earlier had been reaped by then.The dashboard has no Settings row for the key. Settings rows are hand-written in
website/src/pages/settings/*.tsx, andPATCH /api/config/kirocrewaccepts no list-typed path, so the key is set inconfig.json, the same asslack.open_channels.Related Issues
Closes #16618
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)