feat(extension): make WINDOW_IDLE_TIMEOUT configurable via OPENCLI_WINDOW_IDLE_TIMEOUT env var#1015
Open
xzygis wants to merge 1 commit intojackwener:mainfrom
Open
Conversation
…NDOW_IDLE_TIMEOUT env var - Add windowIdleTimeout field to Command protocol and DaemonCommand - CLI reads OPENCLI_WINDOW_IDLE_TIMEOUT (seconds, min 5) and passes it per-command - Extension uses received timeout, default raised from 30s to 10min - Follows existing OPENCLI_WINDOW_FOCUSED pattern (per-command relay) Closes jackwener#1014 Change-Id: I27135b861dd471d55bd15c0afa9cd92d91f7f8e1
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
Make the extension's automation window idle timeout configurable via the
OPENCLI_WINDOW_IDLE_TIMEOUTenvironment variable, following the same per-command relay pattern used byOPENCLI_WINDOW_FOCUSED(#915).Closes #1014
Problem
The extension's
WINDOW_IDLE_TIMEOUTis hardcoded to 30 seconds. Whenopencli browsersubcommands are used by AI agents, the automation window closes between commands because agents typically need 30-60+ seconds to analyze state and plan the next action.Unlike adapter commands (which explicitly call
closeWindow()per #915),opencli browsersubcommands rely entirely on the idle timer for window lifecycle — making the 30s default too aggressive.Changes
3 files, +15/-6 lines — minimal and focused:
extension/src/protocol.tswindowIdleTimeout?: numbertoCommandinterfacesrc/browser/daemon-client.tswindowIdleTimeout?: numbertoDaemonCommandinterfaceOPENCLI_WINDOW_IDLE_TIMEOUTenv var (seconds, min 5), convert to ms, attach per-commandextension/src/background.tsWINDOW_IDLE_TIMEOUT = 30000withDEFAULT_WINDOW_IDLE_TIMEOUT = 600_000(10 min)windowIdleTimeoutvariable updated from per-command payloadDesign Decisions
Per-command relay (not stored in
chrome.storage): Follows thewindowFocusedpattern from feat: auto-close adapter windows, add OPENCLI_WINDOW_FOCUSED, document config #915. Each command carries the timeout value, keeping the extension stateless.Default raised to 10 minutes: Adapter commands already close windows immediately (feat: auto-close adapter windows, add OPENCLI_WINDOW_FOCUSED, document config #915), so the idle timer only matters for
opencli browsersessions. 10 minutes gives AI agents ample time between steps.Minimum 5 seconds: Prevents misconfiguration from making windows uncloseable.
Fully backward-compatible: If
windowIdleTimeoutis absent from the command payload, the extension uses the new 10-minute default. Old CLI versions work unchanged.Usage
Testing
Tested locally on macOS with Chrome + Browser Bridge Extension v1.0.0:
OPENCLI_WINDOW_IDLE_TIMEOUT=10: window closes after ~10s idleopencli browser closestill works for explicit cleanup