feat(sessions): make idle timeout configurable via PI_WEB_IDLE_TIMEOUT_MS - #665
Open
ly2601620664 wants to merge 1 commit into
Open
feat(sessions): make idle timeout configurable via PI_WEB_IDLE_TIMEOUT_MS#665ly2601620664 wants to merge 1 commit into
ly2601620664 wants to merge 1 commit into
Conversation
…T_MS Sessions are currently shut down after a hardcoded 10 minutes of inactivity. This breaks coordination scenarios where a session stays alive without active interaction and long-running extensions whose background tasks do not emit agent events. - Add resolveSessionIdleTimeoutMs() and a module-level SESSION_IDLE_TIMEOUT_MS in lib/rpc-manager.ts read from PI_WEB_IDLE_TIMEOUT_MS. Unset/blank keeps the 10-minute default, 0 disables idle shutdown, a positive number is used in milliseconds, and invalid/negative values fall back to the default with a console warning. - Have resetIdleTimer() use the resolved timeout and skip scheduling entirely when it is 0. - Add lib/rpc-manager-idle-timeout.test.mjs covering the parsing rules and verifying that PI_WEB_IDLE_TIMEOUT_MS=0 keeps an idle session alive. - Document PI_WEB_IDLE_TIMEOUT_MS in the README configuration table.
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.
Summary
Makes the session idle timeout configurable through the
PI_WEB_IDLE_TIMEOUT_MSenvironment variable, addressing #629. Sessions are currently killed after a hardcoded 10 minutes of inactivity, which breaks coordination scenarios (e.g. pi-intercom) where a session merely listens for other sessions' messages, and long-running extensions whose background tasks emit no agent events.Behavior
PI_WEB_IDLE_TIMEOUT_MS0Changes
lib/rpc-manager.ts: addresolveSessionIdleTimeoutMs()and a module-levelSESSION_IDLE_TIMEOUT_MSread fromPI_WEB_IDLE_TIMEOUT_MS.resetIdleTimer()now uses the resolved value and skips scheduling entirely when it is0.lib/rpc-manager-idle-timeout.test.mjs: cover the parsing rules and verify thatPI_WEB_IDLE_TIMEOUT_MS=0keeps an idle session alive far past the default window.README.md: documentPI_WEB_IDLE_TIMEOUT_MSin the configuration table.Verification
lib/rpc-manager-idle-timeout.test.mjs(5 pass, incl. env=0 keeps session alive)lib/rpc-manager.test.mjs(21 pass) andlib/rpc-manager-shutdown.test.mjs(19 pass) — the default 10-minute idle test still passesnode_modules/.bin/tsc --noEmit(exit 0)Note: 3 unrelated tests in
lib/fail on Windows in this checkout (symlinkEPERMand a PATH-separator comparison); they also fail on the clean baseline.