Skip to content

fix(runners): discoverCcAgents fallback timeout has no default for execFile #4528

@OneStepAt4time

Description

@OneStepAt4time

Problem

In src/runners/cc-agents-discovery.ts, the discoverCcAgents() function uses options.timeoutMs ?? DEFAULT_TIMEOUT_MS (line 141) for the timeout option to execFileAsync, but DEFAULT_TIMEOUT_MS is defined as 10_000 (10s).

However, detectCcVersion() (line 102) has its own hardcoded timeout: 5000 (5s). If discoverCcAgents is called with timeoutMs: 3000, the version check still takes up to 5s, which exceeds the caller's intended timeout.

Additionally, there is no signal-based cancellation — if the claude agents --json command hangs beyond the timeout, the process is killed by Node but error handling assumes a clean message.

Fix

  • Pass timeoutMs through to detectCcVersion as well, or derive version-check timeout from the caller timeout
  • Consider using AbortController for cancellation propagation

Impact

Discovered during

Code quality sweep on src/runners/ (pre-#3180 audit).

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions