Summary
Discovered by refactor/code-health during cycle on 2026-03-26.
delegateCloudCredentials() in packages/cli/src/shared/orchestrate.ts hand-constructs ~/.config/spawn/openrouter.json via string interpolation instead of using the centralized getSpawnCloudConfigPath("openrouter") helper from paths.ts.
The top of paths.ts documents this as a single-source-of-truth constraint — no other module should call homedir() or construct spawn-specific paths directly. If the config directory ever moves, orchestrate.ts would silently break while all other modules update correctly.
Additionally, the _cloudName parameter on delegateCloudCredentials is dead code — the function delegates ALL cloud credentials unconditionally, making the parameter unused.
Fix
- Replace hand-constructed
configDir path with getSpawnCloudConfigPath("openrouter")
- Remove the unused
_cloudName parameter
- Update the caller at line ~574 to not pass
cloud.cloudName
- Update 4 call sites in
recursive-spawn.test.ts
Affected files
packages/cli/src/shared/orchestrate.ts
packages/cli/src/__tests__/recursive-spawn.test.ts
packages/cli/package.json (patch version bump)
Summary
Discovered by refactor/code-health during cycle on 2026-03-26.
delegateCloudCredentials()inpackages/cli/src/shared/orchestrate.tshand-constructs~/.config/spawn/openrouter.jsonvia string interpolation instead of using the centralizedgetSpawnCloudConfigPath("openrouter")helper frompaths.ts.The top of
paths.tsdocuments this as a single-source-of-truth constraint — no other module should callhomedir()or construct spawn-specific paths directly. If the config directory ever moves,orchestrate.tswould silently break while all other modules update correctly.Additionally, the
_cloudNameparameter ondelegateCloudCredentialsis dead code — the function delegates ALL cloud credentials unconditionally, making the parameter unused.Fix
configDirpath withgetSpawnCloudConfigPath("openrouter")_cloudNameparametercloud.cloudNamerecursive-spawn.test.tsAffected files
packages/cli/src/shared/orchestrate.tspackages/cli/src/__tests__/recursive-spawn.test.tspackages/cli/package.json(patch version bump)