agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Cline ignores role-specific model config on launch

Open illegalcall opened this issue 4 months ago • 2 comments

Context (shared across all harnesses)

AO stores a per-role model in agentConfig.model (backend/internal/domain/agentconfig.go:27). session_manager.effectiveAgentConfig merges the project base config with the role override and Spawn/Restore forward the resolved value into every adapter as cfg.Config.Model (backend/internal/ports/agent.go). Each adapter must opt in to forwarding that value to its CLI. Today only the Claude (claudecode/claudecode.go:172), Codex (#2869), and Kiro (config-file model key) adapters do. Every other adapter silently drops it, so a configured worker/orchestrator falls back to the CLI's global default model.

  • Original report: #2769
  • Reference fix (the pattern to copy): #2869 (Codex) — adds an appendModelFlag helper called in both GetLaunchCommand and GetRestoreCommand, plus a GetConfigSpec model field and regression tests.

Problem

The Cline adapter (cline, binary cline) never forwards cfg.Config.Model to the cline CLI. A Cline worker/orchestrator configured with a specific model therefore silently uses cline's global default instead.

Reproduction

  1. Configure a project with a cline role and a specific model:
    { "worker": { "agent": "cline", "agentConfig": { "model": "<model-id>" } } }
    
  2. ao spawn --project <project> --name model-check
  3. Open the worker session and inspect the active model.

Actual result

The worker starts on cline's global default model.

Expected result

The worker starts on the configured <model-id>.

Suspected cause

GetLaunchCommand (backend/internal/adapters/agent/cline/cline.go:59-73) and GetRestoreCommand (backend/internal/adapters/agent/cline/cline.go:108-130) build argv without reading cfg.Config.Model. The adapter also inherits the empty agentbase.Base.GetConfigSpec (agentbase/agentbase.go:20-21), so it never advertises a model field.

CLI mechanism

cline supports a launch-time model override via --model. Source: Cline CLI reference — https://docs.cline.bot/cli/cli-reference (-m, --model <model-id>)

Suggested fix (mirror #2869)

  • Add an appendModelFlag-style helper that appends --model <trimmed model> when strings.TrimSpace(cfg.Config.Model) != "", and call it in both GetLaunchCommand and GetRestoreCommand.
  • Override GetConfigSpec to advertise the model field (ports.ConfigFieldString), matching codex/codex.go and claudecode/claudecode.go:172.
  • Add command-construction regression tests: trimmed value present, blank omitted, restore path.

Harness note: -m is an accepted alias. Model is used with the selected provider.

References

  • Reference fix: #2869 (Codex) · Original context: #2769
  • Relevant file: backend/internal/adapters/agent/cline/cline.go
  • Launch: backend/internal/adapters/agent/cline/cline.go:59-73
  • Restore: backend/internal/adapters/agent/cline/cline.go:108-130

illegalcall avatar Jul 21 '26 09:07 illegalcall

Thanks for contributing to Agent Orchestrator.

This issue is being picked up by the current external contributor on-call pair:

  • @illegalcall
  • @pulkit7070

If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @pulkit7070 here.

For faster context or live questions, you can also join the AO Discord.

Join the session here: https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

somewherelostt avatar Jul 21 '26 14:07 somewherelostt

I would like to work on this issue

Kaushik2003 avatar Jul 21 '26 18:07 Kaushik2003