Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): Test button rejects non-spawnable Windows .cmd/.bat provider shims
Adam Eivy1d6b65bd37ae
diff --git a/.changelog/v2.24.0.md b/.changelog/v2.24.0.mdindex febd901bfe..3d8e5f27a1 100644--- a/.changelog/v2.24.0.md+++ b/.changelog/v2.24.0.md@@ -24,7 +24,7 @@ Released: 2026-06-29## AI Providers-- **[issue-1801] "Test" now finds your CLI provider on Windows.** Testing a CLI/TUI provider (e.g. `claude`) on Windows always failed with `Command 'claude' not found in PATH` even when the command worked fine from a terminal. The test resolved the command with the Unix-only `which` tool, which doesn't exist on Windows — so the check itself errored and was misreported as a missing command. It now uses `where` on Windows (and `which` elsewhere), and runs the version probe against the exact resolved executable, so the test correctly succeeds when your provider is installed. (Closes #1801)+- **[issue-1801] "Test" now finds your CLI provider on Windows.** Testing a CLI/TUI provider (e.g. `claude`) on Windows always failed with `Command 'claude' not found in PATH` even when the command worked fine from a terminal. The test resolved the command with the Unix-only `which` tool, which doesn't exist on Windows — so the check itself errored and was misreported as a missing command. It now uses `where` on Windows (and `which` elsewhere), and runs the version probe against the exact resolved executable, so the test correctly succeeds when your provider is installed. The Test button also now reports **failure** (not a misleading "available") when `where` resolves the command to a Windows `.cmd`/`.bat` npm shim that the `shell:false` agent runner can't actually launch — distinguishing a binary that ran-but-has-no-version-flag (still "available") from one that couldn't be spawned at all. (Closes #1801)- **[issue-1802] Run local Ollama models that actually edit files with the new "OpenCode Ollama" provider.** Ollama models are trained against the OpenAI tool-calling format, so under the Claude harness they often *describe* a file edit as JSON without ever applying it — the model "responds" but nothing changes on disk. **OpenCode Ollama** drives the `opencode` agent against your local Ollama daemon instead, speaking the OpenAI-compatible protocol natively, so the same local models reliably read, write, and edit files in headless agent tasks. It's disabled by default; enable it, hit **Refresh Models** to pull your tool-use-capable Ollama models, pick a default model, and run. Tool approvals are auto-allowed for unattended execution, and the Ollama connection is configured for you (no `opencode.json` to hand-write). It arrives on the AI Providers page after `./update.sh` (migration `149-opencode-ollama-providers.js` adds it to existing installs) and appears under **Load Samples** on fresh installs. Requires the `opencode` CLI on your PATH. (Closes #1802)- **[issue-1776] Run CoS agent tasks on a local model with the new "Claude Ollama" provider (CLI + TUI).** If your only LLM is Ollama or LM Studio, you couldn't run file-writing agent tasks — those providers return plain text with no Read/Write/Edit harness. **Claude Ollama** runs the full Claude Code harness on top of your local model: it's a `claude` CLI/TUI pre-wired to your Ollama daemon, and its **Refresh Models** pulls the installed Ollama models filtered to the **tool-use-capable** ones the agent loop depends on. It now ships in **two variants** — **Claude Ollama (local model)** (`cli`, headless) and **Claude Ollama TUI (local model)** (`tui`, interactive) — and **both arrive on the AI Providers page after `./update.sh`** (migration `146-claude-ollama-providers.js` adds them to existing installs and renames the earlier "Clawed Ollama" sample, preserving your settings; previously it lived only in the toolkit sample and never reached the merge path). The task form offers **only coding providers** — raw Ollama / LM Studio / kimi are excluded (with an inline advisory pointing you to Claude Ollama when they're all you have), and a server-side guard rejects an API provider that slips into the spawn path instead of silently writing nothing. Includes a copy-ready global `~/.claude/settings.json` example and a setup guide with the tool-use model caveat. (`data.reference/providers.json`, `server/lib/aiToolkit/`, `scripts/migrations/146-claude-ollama-providers.js`, `docs/features/claude-ollama.md`, `docs/examples/`)diff --git a/server/lib/aiToolkit/providers.cliPathResolve.test.js b/server/lib/aiToolkit/providers.cliPathResolve.test.jsindex a8825322d5..d206b54fc3 100644--- a/server/lib/aiToolkit/providers.cliPathResolve.test.js+++ b/server/lib/aiToolkit/providers.cliPathResolve.test.js@@ -117,11 +117,14 @@ describe('testProvider — cli command resolution (cross-platform PATH)', () =>expect(result.error).toBe("Command 'claude' not found in PATH");});- it('falls back to "available" when no version flag yields output', async () => {+ it('falls back to "available" when the binary spawns but supports no version flag', async () => {setPlatform('linux');vi.mocked(execFile).mockImplementation((cmd, argv, cb) => {if (cmd === 'which' || cmd === 'where') return cb(null, { stdout: '/usr/local/bin/claude\n', stderr: '' });- return cb(new Error('unknown flag')); // every --version / -v probe fails+ // The binary ran (it's spawnable) but exited non-zero on the unknown flag —+ // a numeric exit code is how Node surfaces a non-zero exit from execFile.+ const e = new Error('Command failed: claude --version'); e.code = 1;+ return cb(e);});const p = await makeCliProvider();@@ -130,4 +133,22 @@ describe('testProvider — cli command resolution (cross-platform PATH)', () =>expect(result.success).toBe(true);expect(result.version).toBe('available');});++ it('reports failure when the resolved path cannot be spawned (Windows .cmd/.bat shim)', async () => {+ setPlatform('win32');+ vi.mocked(execFile).mockImplementation((cmd, argv, cb) => {+ if (cmd === 'which' || cmd === 'where') return cb(null, { stdout: 'C:\\Users\\Joe\\AppData\\npm\\claude.cmd\r\n', stderr: '' });+ // execFile (shell:false) cannot launch a .cmd shim — a spawn error carries a+ // string code (ENOENT), distinct from a non-zero exit's numeric code.+ const e = new Error('spawn claude.cmd ENOENT'); e.code = 'ENOENT';+ return cb(e);+ });+ const p = await makeCliProvider();++ const result = await providerService.testProvider(p.id);++ expect(result.success).toBe(false);+ expect(result.error).toContain('could not be executed');+ expect(result.path).toBeUndefined();+ });});diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.jsindex de4b3840a2..4303795e46 100644--- a/server/lib/aiToolkit/providers.js+++ b/server/lib/aiToolkit/providers.js@@ -456,18 +456,41 @@ export function createProviderService(config = {}) {return { success: false, error: `Command '${provider.command}' not found in PATH` };}+ // Track whether the resolved path could actually be spawned. A bare PATH+ // lookup (`where`) on Windows happily returns npm `.cmd`/`.bat` shims,+ // which execFile (shell:false) — and the agent runner, which also spawns+ // shell:false — cannot launch. Without this, a non-spawnable shim falls+ // through to `version: 'available'` and the Test button reports a provider+ // the runner can never actually invoke as usable.+ let everSpawned = false;const tryVersion = async (flag) => {// Invoke the resolved path so Windows runs the exact `.exe` we found —// execFile won't re-apply PATHEXT to a bare command name.- const out = await execFileAsync(commandPath, [flag]).catch(() => null);- return out?.stdout?.trim() || null;+ try {+ const out = await execFileAsync(commandPath, [flag]);+ everSpawned = true;+ return out?.stdout?.trim() || null;+ } catch (err) {+ // A numeric `code` is a non-zero EXIT — the process DID run (it just+ // doesn't support this flag), so the path is spawnable. A string code+ // (ENOENT/EACCES) or a spawn error means it could not be launched.+ if (typeof err?.code === 'number') everSpawned = true;+ return null;+ }};- const versionOut = (await tryVersion('--version')) || (await tryVersion('-v')) || 'available';+ const versionOut = (await tryVersion('--version')) || (await tryVersion('-v'));++ if (!everSpawned) {+ return {+ success: false,+ error: `Resolved '${provider.command}' to ${commandPath} but it could not be executed (a Windows .cmd/.bat npm shim is not directly spawnable by the agent runner)`,+ };+ }return {success: true,path: commandPath,- version: versionOut+ version: versionOut || 'available'};}