Skip to content

feat(agent-manager): assign models to workflows - #12729

Merged
marius-kilocode merged 10 commits into
mainfrom
assign-models-to-workflow
Aug 3, 2026
Merged

feat(agent-manager): assign models to workflows#12729
marius-kilocode merged 10 commits into
mainfrom
assign-models-to-workflow

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Workflow definitions can now select a model and reasoning variant from Agent Behaviour settings. The selection is persisted as a minimal global command override, so workflow templates remain in their original config source and existing kilo.json/kilo.jsonc setups are preserved. Runtime resolution validates variants against the selected model, carries selections through subtask workflows, and merges partial overrides onto existing built-in or configured commands. Model and variant labels are translated across all supported VS Code locales.\n\nThe public app.kilo.ai config schema is maintained in the separate cloud repository and still needs the matching nested command override schema update.

Screenshots

Agent Behaviour workflow settings overview

Expanded workflow model and reasoning variant settings

@marius-kilocode
marius-kilocode enabled auto-merge (squash) July 31, 2026 12:18
Comment thread packages/opencode/src/kilocode/session/workflow-variant.ts Outdated
Comment thread packages/core/src/config/plugin/command.ts Outdated
Comment thread packages/opencode/src/kilocode/command/override.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file, incremental)
  • packages/core/test/pty/pty-session.test.ts

Notes

  • Incremental range 17533989..9b2cf5a8 touches a single line: the non-ASCII PTY fixture now emits explicit octal byte escapes via printf instead of embedding literal UTF-8 in the command string. Verified each escape maps to the expected UTF-8 bytes (\303\251 = é, \303\274 = ü, \345\214\227 = , \344\272\254 = , \360\237\232\200 = 🚀), so the emitted bytes still decode to the marker the assertion checks. POSIX printf format strings support \ddd octal escapes, so this works under sh/dash/bash.
  • The assertion still compares against the literal marker, so the test continues to exercise byte-identical round-tripping rather than being weakened by the escaping.
  • Test-only change; no runtime impact.
Previous Review Summaries (8 snapshots, latest commit 1753398)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1753398)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file, incremental)
  • packages/core/test/pty/pty-session.test.ts

Notes

  • Incremental range 90a803cd..17533989 touches only the PTY session test. Moving the replay seed into attachCollecting fixes the previously flagged issue: every waitForOutput call site now sees buffered output, and Pty.attach computes replay and registers the subscriber in the same synchronous step, so replay and the pending queue stay disjoint and ordering (replay before live chunks, flushed on activate()) is preserved. Cursor -1 attachments get an empty replay, so the Queue.poll(...) assertions for detach/isolation are unaffected.
  • Reverting waitForEvents to the shared PTY_TEST_TIMEOUT is consistent with the other helpers.
  • Test-only change; no runtime impact.

Previous review (commit 90a803c)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

SUGGESTION

File Line Issue
packages/core/test/pty/pty-session.test.ts 82 Replay seed is opt-in, so the same attach race still affects the other waitForOutput callers (lines 140, 151)
Files Reviewed (1 file, incremental)
  • packages/core/test/pty/pty-session.test.ts - 1 issue

Notes

  • Incremental range b8cfc770..90a803cd touches only the waitForOutput helper in the PTY session test plus one call site. The seed fix is correct: Pty.attach returns already-buffered output as replay and only queues chunks arriving after subscriber registration, so replay and the queue are disjoint and seeding cannot double-count.
  • Test-only change; no runtime impact.
  • Findings from earlier commits on command/index.ts, kilocode/command/override.ts, kilocode/session/workflow-variant.ts, core/src/config/plugin/command.ts, WorkflowsTab.tsx, and issue-8656-stall.test.ts are outside this incremental range; their inline comments are outdated on GitHub and were not re-verified against current HEAD.
  • Still outstanding per the PR description: the cloud config.json schema mirror for the nested command override.

Fix these issues in Kilo Cloud

Previous review (commit b8cfc77)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file, incremental)
  • packages/opencode/test/kilocode/issue-8656-stall.test.ts

Notes

  • Incremental range 1bd96e4a..b8cfc770 touches only the json() helper in the issue-8656 stall regression test. Retries are now opt-in (retry flag) and used only for the idempotent GET routes (messages, status), and parse failures now throw with route, status, and a body excerpt plus the original error as cause. Both previously reported findings on this file are resolved.
  • Test-only change; no runtime impact.
  • Earlier findings on command/index.ts, kilocode/command/override.ts, kilocode/session/workflow-variant.ts, core/src/config/plugin/command.ts, and WorkflowsTab.tsx are outside this incremental range and their inline comments are outdated on GitHub; they were not re-verified against current HEAD.
  • Still outstanding per the PR description: the cloud config.json schema mirror for the nested command override (optional command.template, new command.variant).

Previous review (commit 1bd96e4)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

SUGGESTION

File Line Issue
packages/opencode/test/kilocode/issue-8656-stall.test.ts 78 Retrying on any JSON parse failure swallows genuine server errors and rethrows a bare SyntaxError with no route/status/body context, turning real backend failures into opaque CI flakes
packages/opencode/test/kilocode/issue-8656-stall.test.ts 73 The retry replays POST /session from create(), so an unparseable response body can create a second session and hide the original failure
Files Reviewed (1 file, incremental)
  • packages/opencode/test/kilocode/issue-8656-stall.test.ts - 2 issues

Notes

  • Incremental range c9cf5685..1bd96e4a contains only the json() helper retry loop in the issue-8656 stall regression test. Test-only change, no runtime impact.
  • Previously reported findings on command/index.ts, kilocode/command/override.ts, kilocode/session/workflow-variant.ts, core/src/config/plugin/command.ts, and WorkflowsTab.tsx are outside this incremental range; their inline comments are now outdated on GitHub and were not re-verified against current HEAD.
  • Still outstanding per the PR description: the cloud config.json schema mirror for the nested command override (optional command.template, new command.variant).

Fix these issues in Kilo Cloud

Previous review (commit c9cf568)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file, incremental)
  • packages/core/test/pty/pty-session.test.ts

Notes

  • Incremental range fc22eb78..c9cf5685 contains only the PTY test timeout bump: a shared PTY_TEST_TIMEOUT of 15 seconds replacing two 5 seconds waits. Test-only change, no runtime impact.
  • The other 5 seconds timeouts in the same file (waitForEvents, the EOF exit assertion) were left as-is. If macOS CI flakiness was the motivation, those paths can still time out; worth confirming the flake was isolated to output replay.
  • Previously reported findings on command/index.ts, kilocode/command/override.ts, kilocode/session/workflow-variant.ts, core/src/config/plugin/command.ts, and WorkflowsTab.tsx are outside this incremental range and were not re-reviewed.
  • Still outstanding per the PR description: the cloud config.json schema mirror for the nested command override (optional command.template, new command.variant).

Previous review (commit fc22eb7)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files, incremental)
  • packages/opencode/src/command/index.ts
  • packages/opencode/test/kilocode/skill-command-autocomplete.test.ts

Previously reported issues, now resolved

  • :mcp override landing on an unrelated same-named command (command/index.ts) — the deferred pass now drops the alias unless the registered command is actually MCP-sourced, and get("x:mcp") stays undefined. Covered by the new "does not apply a missing MCP alias" test.
  • Duplicate skill entry in list() when a skill override is registered under the :skill key — the alias entry is only created when the plain key is not already skill-sourced, and list() now skips skills that already have an active :skill entry. Covered by the added list() assertion.

Notes

  • Verified the alias resolution paths line up: an entry stored under x:skill keeps name: "x" with source: "skill", so slashDisplay still renders /x:skill and get("x:skill") hits it directly.
  • Deferred overrides always have template === undefined (a template makes the first pass succeed), so the alias branches never need to synthesize a command from scratch.
  • Unresolvable aliases (x:mcp with no MCP prompt, x:skill with no skill) are silently ignored. That matches get() returning undefined, but a config-time warning would make typos in kilo.json easier to notice.
  • Still outstanding per the PR description: the cloud config.json schema mirror for the now-optional command.template and the new command.variant key.
  • Only the incremental range a929a966..fc22eb78 was reviewed; the rest of that range is upstream main merged into the branch.

Previous review (commit a929a96)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/opencode/src/command/index.ts 170 The :mcp branch and the fallback are identical, so an x:mcp override silently mutates an unrelated command x while get("x:mcp") still returns undefined

SUGGESTION

File Line Issue
packages/opencode/src/command/index.ts 163 Registering the skill under the :skill alias key makes list() emit /name:skill twice, with the duplicate missing the override
Files Reviewed (13 files, incremental)
  • packages/opencode/src/command/index.ts - 2 issues
  • packages/core/src/command.ts
  • packages/core/src/config/plugin/command.ts
  • packages/core/test/config/command.test.ts
  • packages/opencode/src/kilocode/command/override.ts
  • packages/opencode/src/kilocode/session/workflow-variant.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/kilocode/command/override.test.ts
  • packages/opencode/test/kilocode/session/workflow-variant.test.ts
  • packages/opencode/test/kilocode/skill-command-autocomplete.test.ts
  • packages/kilo-vscode/webview-ui/src/components/settings/agent-behaviour/WorkflowsTab.tsx
  • packages/kilo-vscode/webview-ui/src/context/config.tsx, stories/StoryProviders.tsx
  • packages/sdk/js/src/v2/gen/types.gen.ts, packages/sdk/openapi.json (generated)

Previously reported issues, now resolved

  • Agent-only workflows dropping the chat thinking variant (workflow-variant.ts) — fixed by the !input.agent.model condition plus test.
  • Order-dependent template-less overrides (config/plugin/command.ts) — fixed by the template-first pass plus test.
  • Cleared model/variant override not visibly clearing (WorkflowsTab.tsx) — fixed by layering globalDraft so the null survives.
  • Overrides for MCP/skill commands being discarded (kilocode/command/override.ts) — fixed by the deferred override pass, aside from the alias-targeting notes above.

Notes

  • Verified the narrowed subtask workflow gate in prompt.ts: because command-driven subtask parts always carry a model, the previous version always forced the resolved model as a direct choice; it now only does so when the command really selects a model, a variant, or an agent with a model.
  • The cloud config.json schema mirror for the now-optional command.template and the new command.variant key is still outstanding, as the PR description states.

Fix these issues in Kilo Cloud

Previous review (commit f41ca07)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/opencode/src/kilocode/session/workflow-variant.ts 24 Workflows that set only agent (agent has no model) now drop the user's chat thinking variant, even though the resolved model is unchanged — regression vs. always forwarding input.variant
packages/core/src/config/plugin/command.ts 34 Template-less overrides are order-dependent: global documents are visited before project documents, so a global model override for a project-defined workflow is continued away and lost
packages/kilo-vscode/webview-ui/src/components/settings/agent-behaviour/WorkflowsTab.tsx 30 mergeScopedConfig strips the null written on clear, so the selector falls back to the stale effective config and the cleared model/variant reappears

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/command/override.ts 29 Overrides naming an MCP prompt or skill command are silently discarded because the config loop runs before those registries are populated
Files Reviewed (41 files)
  • packages/core/src/config/command.ts
  • packages/core/src/config/plugin/command.ts - 1 issue
  • packages/core/src/v1/config/command.ts
  • packages/core/src/v1/session.ts
  • packages/opencode/src/command/index.ts
  • packages/opencode/src/kilocode/command/override.ts - 1 issue
  • packages/opencode/src/kilocode/session/workflow-variant.ts - 1 issue
  • packages/opencode/src/kilocode/tool/task.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/src/tool/task.ts
  • packages/opencode/test/kilocode/command/override.test.ts
  • packages/opencode/test/kilocode/config/workflow-model-override.test.ts
  • packages/opencode/test/kilocode/server/config-overlay.test.ts
  • packages/opencode/test/kilocode/session/workflow-variant.test.ts
  • packages/kilo-vscode/webview-ui/src/components/settings/agent-behaviour/WorkflowsTab.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/components/shared/ThinkingSelector.tsx
  • packages/kilo-vscode/webview-ui/src/types/messages/config.ts
  • packages/kilo-vscode/webview-ui/src/i18n/*.ts (20 locales)
  • packages/sdk/js/src/v2/gen/types.gen.ts, packages/sdk/openapi.json (generated)
  • .changeset/workflow-model-variants.md

Notes

  • The changeset is user-facing and reads well; no changeset issues.
  • The cloud config.json schema mirror for the now-optional command.template is still pending, as the PR description states.
  • Subtask propagation only carries a workflow selection through extra.workflow when the workflow sets a model; a hand-written variant-only override will not reach subagent model selection (the UI can't produce that state today).

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 24 · Output: 5K · Cached: 523.6K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode disabled auto-merge July 31, 2026 12:49
Comment thread packages/opencode/src/command/index.ts Outdated
Comment thread packages/opencode/src/command/index.ts Outdated
Comment thread packages/opencode/test/kilocode/issue-8656-stall.test.ts Outdated
Comment thread packages/opencode/test/kilocode/issue-8656-stall.test.ts
Comment thread packages/core/test/pty/pty-session.test.ts Outdated
@marius-kilocode
marius-kilocode merged commit ce7984f into main Aug 3, 2026
34 of 36 checks passed
@marius-kilocode
marius-kilocode deleted the assign-models-to-workflow branch August 3, 2026 14:46
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
* feat(agent-manager): assign models to workflows

* fix(agent-manager): address workflow model review findings

* fix(cli): handle command source aliases safely

* test(pty): allow slower macOS startup

* test(cli): tolerate transient Windows response reads

* test(cli): bound transient stall response retries

* test(pty): include replayed output in wait helper

* test(pty): stabilize buffered output waits

* test(pty): avoid locale-dependent UTF-8 fixture
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