Description
On Windows, is_opencode_available() always returns false because check_opencode_available() in src/services/opencode.rs has a #[cfg(windows)] { return false; } block before the COKAC_OPENCODE_PATH environment variable check and the where opencode fallback.
This means:
- The OpenCode provider always shows ✗ on Windows
- Setting
COKAC_OPENCODE_PATH has no effect
- The
where opencode detection code (line 76-83) is unreachable dead code
Steps to Reproduce
- Install OpenCode on Windows (
npm install -g opencode-ai)
- Optionally set
COKAC_OPENCODE_PATH environment variable
- Run
cokacdir --ccserver <token>
- Observe OpenCode shows ✗
Root Cause
// src/services/opencode.rs
fn check_opencode_available() -> bool {
#[cfg(windows)]
{
return false; // ← Runs BEFORE COKAC_OPENCODE_PATH check
}
if let Ok(val) = std::env::var("COKAC_OPENCODE_PATH") {
// Never reached on Windows
}
#[cfg(windows)]
{
// where opencode — also never reached (dead code)
}
}
Proposed Fix
Remove the early return false and move COKAC_OPENCODE_PATH check first, so the where opencode fallback can also execute on Windows.
Environment
- OS: Windows 11 Enterprise
- OpenCode: 1.3.12 (npm)
- cokacdir: latest main
Description
On Windows,
is_opencode_available()always returnsfalsebecausecheck_opencode_available()insrc/services/opencode.rshas a#[cfg(windows)] { return false; }block before theCOKAC_OPENCODE_PATHenvironment variable check and thewhere opencodefallback.This means:
COKAC_OPENCODE_PATHhas no effectwhere opencodedetection code (line 76-83) is unreachable dead codeSteps to Reproduce
npm install -g opencode-ai)COKAC_OPENCODE_PATHenvironment variablecokacdir --ccserver <token>Root Cause
Proposed Fix
Remove the early
return falseand moveCOKAC_OPENCODE_PATHcheck first, so thewhere opencodefallback can also execute on Windows.Environment