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

Kilo Code ignores role-specific model config on launch

Open illegalcall opened this issue 4 months ago • 3 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 Kilo Code adapter (kilocode, binary kilocode) never forwards cfg.Config.Model. AO already injects a per-agent config via the KILO_CONFIG_CONTENT env var and selects it with --agent, but that config only carries permission + agent.prompt — never a model — so a configured worker model is silently dropped.

Reproduction

  1. Configure a project with a kilocode role and a model:
    { "worker": { "agent": "kilocode", "agentConfig": { "model": "anthropic/claude-haiku-4-20250514" } } }
    
  2. ao spawn --project <project> --name model-check
  3. Inspect the worker's active model.

Actual result

Worker uses Kilo Code's global/default model.

Expected result

Worker uses anthropic/claude-haiku-4-20250514.

Suspected cause

GetLaunchCommand (backend/internal/adapters/agent/kilocode/kilocode.go:83-102) and GetRestoreCommand (:110-135) build the env-injected config via kilocodeConfigEnvPrefix (:200-224) and the structs kilocodeInlineConfig/kilocodeAgentSettings (:181-188), none of which carry a model. Inherits empty GetConfigSpec.

CLI mechanism

Kilo Code sets a per-agent model in its config under agent.<name>.model (e.g. "anthropic/claude-haiku-4-20250514"), precedence "session override > per-agent config > global > auto". A --model flag exists only on the non-interactive kilo run, so it is not reliable for the TUI launch AO uses — the config route is correct here. Source: https://kilo.ai/docs/code-with-ai/platforms/cli , https://kilo.ai/docs/code-with-ai/agents/model-selection

Suggested fix

  • Add a Model field (tag json:"model,omitempty") to kilocodeAgentSettings and set it from strings.TrimSpace(cfg.Config.Model) when non-blank. The generated agent is already selected via --agent, so the per-agent model applies.
  • Override GetConfigSpec to advertise the model field.
  • Add regression tests asserting the model lands in KILO_CONFIG_CONTENT (and is omitted when blank).
  • Model format is provider/model-id.

References

  • Reference fix: #2869 (Codex) · Original context: #2769
  • Relevant file: backend/internal/adapters/agent/kilocode/kilocode.go

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

@illegalcall can you please review the PR ?

Kaushik2003 avatar Jul 23 '26 18:07 Kaushik2003