Skip to content

fix(agent-manager): inherit model and variant in tool sessions - #12073

Merged
marius-kilocode merged 1 commit into
mainfrom
research-agent-manager-default-model
Jul 9, 2026
Merged

fix(agent-manager): inherit model and variant in tool sessions#12073
marius-kilocode merged 1 commit into
mainfrom
research-agent-manager-default-model

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Tool-started Agent Manager sessions currently omit model and reasoning state unless the agent supplies explicit overrides. A new session then resolves fresh defaults independently, which can send fan-out work to a recent or provider fallback model instead of the model selected for the invoking chat turn.

Prompted tasks now inherit the exact provider, model, and reasoning variant from the chronology-resolved invoking turn. The tool guidance tells agents to omit these fields by default and only provide overrides when explicitly requested. Variant-only overrides retain the inherited model, while explicit model resolution prefers the invoking provider and uses deterministic fallback ordering.

Prepared sessions without an initial prompt continue to use normal defaults.

@marius-kilocode
marius-kilocode enabled auto-merge July 9, 2026 13:53
const resolved = tasks.flatMap((task) => {
if (!task.model) return []
const resolved = tasks.flatMap((task, index) => {
if (!params.tasks[index]?.model?.trim() || !task.model) return []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Variant-only overrides aren't echoed in the "Resolved models" summary

This filter (!params.tasks[index]?.model?.trim() || !task.model) only echoes a resolution when the agent passed an explicit model override, matching the pre-existing behavior for named-model resolution. But with this PR, a task can also carry an explicit variant-only override that changes the effective reasoning variant while inheriting the model from the invoking turn (see the select() branch a few lines above returning { ...base, model: source.model, variant }). Since params.tasks[index]?.model is empty for that case, the variant override is silently applied without appearing in the "Resolved models:" output, so the agent/user has no confirmation that the variant was actually changed (as opposed to falling back to the inherited default).

Consider also echoing when params.tasks[index]?.variant?.trim() is set, not just model.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge (non-blocking)

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/tool/agent-manager.ts 251 Variant-only overrides aren't echoed in the "Resolved models:" output summary, unlike explicit model overrides
Files Reviewed (7 files)
  • .changeset/agent-manager-inherit-model.md - user-facing, well-scoped changeset present
  • packages/kilo-docs/pages/automate/agent-manager.md - prose updated consistently with new inheritance behavior
  • packages/opencode/src/kilocode/tool/agent-manager-models.ts - hint text updated, no logic change
  • packages/opencode/src/kilocode/tool/agent-manager-models.txt - description text updated, no logic change
  • packages/opencode/src/kilocode/tool/agent-manager.ts - 1 suggestion
  • packages/opencode/src/kilocode/tool/agent-manager.txt - description text updated, no logic change
  • packages/opencode/test/kilocode/agent-manager-tool.test.ts - new tests exercise real select()/execute() logic (no mocked business logic), good coverage of inherit/override/edge-case paths

Verified: source/preferred short-circuiting avoids an unnecessary defaultModel() call when the invoking turn's provider is known; the deterministic provider tie-breaker (localeCompare on providerID/model id) is correctly exercised by the new stable-tie-break test; undefined/no-user-message paths in select() degrade gracefully to normal defaults or an explicit error rather than throwing. This is a Kilo-only path (src/kilocode/tool/) with no shared-file changes, so no fork-merge hygiene concerns.

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5 · Input: 62 · Output: 22.6K · Cached: 1.9M

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 18513e3 into main Jul 9, 2026
29 checks passed
@marius-kilocode
marius-kilocode deleted the research-agent-manager-default-model branch July 9, 2026 14:23
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…r-default-model

fix(agent-manager): inherit model and variant in tool sessions
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.

2 participants