Skip to content

refactor: centralize exec approval timeout#16656

Merged
steipete merged 2 commits intomainfrom
refactor/exec-approval-timeout
Feb 15, 2026
Merged

refactor: centralize exec approval timeout#16656
steipete merged 2 commits intomainfrom
refactor/exec-approval-timeout

Conversation

@steipete
Copy link
Contributor

@steipete steipete commented Feb 15, 2026

Follow-up cleanup after #12188.

Changes:

  • Centralize default exec approval timeout (CLI + gateway).
  • Thread transport timeout separately (no opts mutation).
  • Improve missing node:sqlite runtime error message.

Gate:

  • fnm exec --using 22.21.1 -- pnpm check
  • fnm exec --using 22.21.1 -- pnpm test

Greptile Overview

Greptile Summary

Refactored exec approval timeout handling to improve code maintainability and clarity.

  • Centralized the 120-second default exec approval timeout as DEFAULT_EXEC_APPROVAL_TIMEOUT_MS constant, now shared between CLI and gateway
  • Replaced opts object mutation pattern with explicit transportTimeoutMs parameter to callGatewayCli, avoiding spread operator overhead and making intent clearer
  • Enhanced node:sqlite missing runtime error message to be more actionable for users
  • Updated all tests to reflect the new API signature with separate transport timeout parameter

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean refactoring with comprehensive test coverage. The changes eliminate object mutation, centralize magic numbers into well-named constants, and maintain functional equivalence with the previous implementation. All tests have been updated to match the new API signature. The SQLite error improvement is a pure developer experience enhancement with no logic changes.
  • No files require special attention

Last reviewed commit: 179ed55

@cursor
Copy link

cursor bot commented Feb 15, 2026

PR Summary

Medium Risk
Touches CLI↔gateway request timing and changes the callGatewayCli signature, so incorrect overrides or missed call sites could cause unexpected timeouts. The SQLite change is low risk and only affects error messaging when the module is unavailable.

Overview
Centralizes the exec-approval default timeout by introducing DEFAULT_EXEC_APPROVAL_TIMEOUT_MS and using it in both the CLI nodes run flow and the gateway exec.approval.request handler.

Refactors callGatewayCli to accept an optional per-call transportTimeoutMs override and updates nodes run to pass Math.max(userTimeout, approvalTimeout+10s) via this new parameter (instead of mutating opts.timeout), with regression tests updated accordingly.

Improves requireNodeSqlite() error handling by catching missing node:sqlite and throwing a clearer, actionable error message (preserving the original error as cause).

Written by Cursor Bugbot for commit 179ed55. This will update automatically on new commits. Configure here.

@steipete steipete merged commit ea0ef18 into main Feb 15, 2026
12 checks passed
@steipete steipete deleted the refactor/exec-approval-timeout branch February 15, 2026 00:18
@jheeanny
Copy link

Centralizing exec approval timeout improves consistency. We set per‑tool defaults (e.g., shell: 300s, browser: 60s) and allow overrides per agent. Do you plan to make these configurable via agents.defaults.approvalTimeout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants