feat: add --idle-timeout CLI flag for daemon auto-shutdown (#856)
* feat: add --idle-timeout CLI flag for daemon auto-shutdown Add user-friendly --idle-timeout flag that converts time strings to milliseconds. Supports formats like '10s', '3m', '1h', or raw ms. This addresses a common need for ephemeral/CI environments where daemon processes can be orphaned if not explicitly closed, leading to resource consumption from zombie chrome-headless-shell processes. Co-authored-by: Hermes (via claude-sonnet-4-20250520) <agent@hermes.ai> * fix: address idle-timeout review feedback * fix: normalize idle-timeout parsing --------- Co-authored-by: Merlin <merlin@rbeckner.com> Co-authored-by: Hermes (via claude-sonnet-4-20250520) <agent@hermes.ai>
This commit is contained in:
@@ -234,6 +234,7 @@ pub struct DaemonOptions<'a> {
|
||||
pub action_policy: Option<&'a str>,
|
||||
pub confirm_actions: Option<&'a str>,
|
||||
pub engine: Option<&'a str>,
|
||||
pub idle_timeout: Option<&'a str>,
|
||||
}
|
||||
|
||||
fn apply_daemon_env(cmd: &mut Command, session: &str, opts: &DaemonOptions) {
|
||||
@@ -300,6 +301,9 @@ fn apply_daemon_env(cmd: &mut Command, session: &str, opts: &DaemonOptions) {
|
||||
if let Some(engine) = opts.engine {
|
||||
cmd.env("AGENT_BROWSER_ENGINE", engine);
|
||||
}
|
||||
if let Some(idle) = opts.idle_timeout {
|
||||
cmd.env("AGENT_BROWSER_IDLE_TIMEOUT_MS", idle);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ensure_daemon(session: &str, opts: &DaemonOptions) -> Result<DaemonResult, String> {
|
||||
|
||||
Reference in New Issue
Block a user