Skip to content

fix(6.34): wire claude-code-ollama into HA + PA launchers#40

Merged
fstamatelopoulos merged 1 commit intomainfrom
iteration-6/ha-pa-ollama-launchers-6.34
May 9, 2026
Merged

fix(6.34): wire claude-code-ollama into HA + PA launchers#40
fstamatelopoulos merged 1 commit intomainfrom
iteration-6/ha-pa-ollama-launchers-6.34

Conversation

@fstamatelopoulos
Copy link
Copy Markdown
Owner

Summary

The agent picker in cfcf init and the web Settings page surfaces every detected adapter for every role — but the Help Assistant and Product Architect have their own launchers (separate from the standard spawnProcess path because they need true TUI takeover via Bun.spawn(... { stdio: "inherit" })) with hardcoded switch statements for argv composition. The new adapters from item 6.28 (opencode, claude-code-ollama, opencode-ollama) were never added to those switches.

Result for users who configured helpAssistantAgent.adapter = "claude-code-ollama" at cfcf init:

[ha] failed to launch: Help Assistant doesn't support adapter "claude-code-ollama" yet. Supported: claude-code, codex.

What's fixed

  • New case "claude-code-ollama" arm in both help-assistant/launcher.ts and product-architect/launcher.ts. Wraps the existing claude-code argv composition with ollama launch claude --model <ollama-model> --yes -- <claude-flags>.
  • The --model flag goes to ollama (pins the local model serving the API surface); claude itself doesn't get --model. So agent.model is the ollama-side model name (e.g. qwen3-coder:latest).
  • HA: no --dangerously-skip-permissions (HA is interactive — user reviews tool calls).
  • PA: --dangerously-skip-permissions flows through after -- in non-safe mode (matches the direct claude-code behaviour).
  • Error message for still-unsupported adapters (opencode, opencode-ollama) now lists claude-code-ollama as the supported ollama path so users on opencode-ollama see the alternative immediately.

Out of scope (deferred — round 2 of 6.34)

opencode + opencode-ollama interactive support. opencode's interactive default reads AGENTS.md from cwd, which doesn't fit cf²'s ephemeral-tempfile pattern (would either pollute the user's repo or sandbox opencode away from the user's working tree). Needs investigation into opencode's runtime system-prompt-injection mechanism (--prompt? -c instructions=...? config-file-only?) before we can wire it cleanly.

Test plan

  • bun run typecheck — clean
  • bun test packages/core packages/cli packages/web — 852/852 pass (7 new launcher tests)
  • Manual: cfcf help assistant with helpAssistantAgent.adapter = "claude-code-ollama" and model = "qwen3-coder:latest" → expected spawn ollama launch claude --model qwen3-coder:latest --yes -- --append-system-prompt "<HA-prompt>" "<initial-message>"
  • Manual: cfcf spec with productArchitectAgent.adapter = "claude-code-ollama" → same shape with --dangerously-skip-permissions after -- (and without it when passing --safe)

A user with `helpAssistantAgent.adapter = "claude-code-ollama"`
(configured at `cfcf init` since 6.28 surfaced the new adapters in
the picker) hit:

  [ha] failed to launch: Help Assistant doesn't support adapter
  "claude-code-ollama" yet. Supported: claude-code, codex.

The PA + HA launchers (in `packages/core/{help-assistant,product-architect}/
launcher.ts`) have their own argv-builder switch statements rather
than going through the standard `AgentAdapter.buildCommand()` path,
because they need true TUI takeover via `Bun.spawn(... { stdio:
"inherit" })` and the standard pipeline assumes headless `-p`. The
new adapters from item 6.28 were never added to those switches.

Added a `case "claude-code-ollama"` arm to both launchers that wraps
the existing claude-code argv with `ollama launch claude --model
<ollama-model> --yes -- <claude-flags>`. The `--model` flag is the
ollama-side model name; claude itself doesn't get `--model` because
ollama already pinned the model serving the API. For HA: no
`--dangerously-skip-permissions` (HA is interactive — user reviews
tool calls). For PA: `--dangerously-skip-permissions` flows through
in non-safe mode (matches the direct claude-code path).

Error message for the still-unsupported adapters (`opencode`,
`opencode-ollama`) now lists `claude-code-ollama` as the supported
ollama path so users on `opencode-ollama` see the alternative.

Tests: 7 new unit tests across `help-assistant/launcher.test.ts`
and `product-architect/launcher.test.ts` (argv shape, model
omission, PA safe-mode behaviour, helpful-error-message check).
852/852 core+cli+web tests pass.

Out of scope for this fix: `opencode` + `opencode-ollama`
interactive support. opencode's interactive default reads
`AGENTS.md` from cwd, which doesn't fit cf²'s ephemeral-tempfile
pattern (would pollute the user's repo or sandbox opencode away
from it). Needs investigation into opencode's runtime system-prompt-
injection mechanism. Tracked as the deferred half of item 6.34 in
docs/plan.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fstamatelopoulos fstamatelopoulos merged commit d3e1b9e into main May 9, 2026
2 checks passed
@fstamatelopoulos fstamatelopoulos deleted the iteration-6/ha-pa-ollama-launchers-6.34 branch May 9, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant