feat: add agent default variant handling in TUI and desktop#7156
feat: add agent default variant handling in TUI and desktop#7156CasualDeveloper wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicates FoundPR #7140: Add default variant config per agent Why related: This is the primary implementation that the current PR (#7156) is an alternative version of. According to the PR description, #7156 is an alternative implementation for #7138 that includes additional changes not present in #7140, specifically:
The PR author explicitly states they're "happy to close this if #7140 incorporates these changes," indicating these are addressing the same feature with slightly different approaches. |
|
@CasualDeveloper we can do ur change if u want but I think ti requires updates to both tui AND desktop |
11edba0 to
9cc62c8
Compare
9cc62c8 to
ae2dd3e
Compare
|
Thanks @rekram1-node! I've updated this PR to include both TUI and desktop support: TUI: Both now have:
The Ready for review when you have time! |
07c8bd5 to
065875f
Compare
065875f to
6088a6f
Compare
2e9637c to
d415762
Compare
a792e49 to
2abcbe0
Compare
2abcbe0 to
0cc306d
Compare
|
@rekram1-node rebuilt feature on top of latest origin/dev, taking into account your feedback:
Also reran typecheck + variant-focused tests locally and they pass. |
76c9044 to
6355ca1
Compare
db52404 to
263a4e5
Compare
0f6f922 to
0a5c0da
Compare
0a5c0da to
99a76ac
Compare
There was a problem hiding this comment.
Pull request overview
Adds agent-level default model variant handling and surfaces the effective variant in the UI, aligning TUI/Desktop behavior with per-agent configured reasoning effort.
Changes:
- Introduces shared variant resolution helpers for the TUI (configured vs selected vs default sentinel) plus tests.
- Updates TUI local context + prompt bar to compute/show an “effective” variant.
- Adjusts Desktop variant cycling behavior/tests and adds
variantto the triage agent config.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/test/cli/tui/model-variant.test.ts | Adds unit coverage for variant resolution/cycling semantics in the TUI. |
| packages/opencode/test/agent/agent.test.ts | Verifies agent variant is loaded from config and defaults to undefined. |
| packages/opencode/src/cli/cmd/tui/context/model-variant.ts | Adds helper functions for configured-variant matching and variant resolution/cycling. |
| packages/opencode/src/cli/cmd/tui/context/local.tsx | Wires configured + selected variant resolution into the TUI local model context. |
| packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx | Initializes local agent/model/variant from the last user message; shows effective variant in prompt bar. |
| packages/app/src/context/model-variant.ts | Updates Desktop cycling logic (no longer advances from configured variant). |
| packages/app/src/context/model-variant.test.ts | Updates/adds tests to match the new Desktop cycling behavior. |
| packages/app/src/context/local.tsx | Adds effective() alias for variant display parity. |
| .opencode/agent/triage.md | Sets triage agent default variant: "high". |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Fork updated to sync with dev (as of cb1a500). |
|
Hey everyone, wondering what the latest is on this? Trying to have "Build" agent (with local model) default to |
- Resolve configured variants through shared helpers used by app and TUI - Respect agent-configured variants unless the user selects an override or Default - Restore and hydrate TUI variant state without stale overrides or legacy default sentinels - Add variant tests for shared helpers and agent config Closes anomalyco#22065
Issue for this PR
Closes #22065
Type of change
What does this PR do?
Respect an agent's configured model variant in the app and TUI when the current model supports it.
The change keeps selected/current/configured variant resolution in a shared helper so both clients agree on:
The PR stays client/local-state scoped; it does not add backend/session/API/SDK behavior.
How did you verify your code works?
bun turbo typecheckpackages/opencode:bun test --timeout 900000 ./test/agent/agent.test.ts(40 pass)packages/core:bun test --timeout 900000 ./test/util/model-variant.test.ts(8 pass)Screenshots / recordings
Not included; this changes prompt-bar metadata display/state behavior and is covered by the focused tests above.
Checklist