Skip to content

fix(runners): cc-agents-discovery discoverCcAgents double-parses semver #4527

@OneStepAt4time

Description

@OneStepAt4time

Problem

In src/runners/cc-agents-discovery.ts, discoverCcAgents() calls parseSemver() + compareSemver() manually (lines 146-148) after already calling isCcAgentsJsonSupported() (line 115) which does the exact same check internally.

This means detectCcVersion() may be called up to 2x (once in isCcAgentsJsonSupported, once in discoverCcAgents), and parseSemver is applied 4x total (2 parses × 2 calls).

Fix

  • discoverCcAgents should call isCcAgentsJsonSupported() once, not duplicate the semver logic
  • Or extract a private checkVersionSupport() that returns the parsed version to avoid double work

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