fix(opencode): apply agent variant when no explicit model is configured#24962
fix(opencode): apply agent variant when no explicit model is configured#2496221pounder wants to merge 4 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that address variant inheritance and agent configuration: Potentially Related PRs:
These PRs all touch on similar areas of agent variant/model configuration and inheritance, particularly for subagents. PR #20742 appears most closely related as it specifically addresses thinking level (variant) inheritance for subtasks. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #21632
Type of change
What does this PR do?
In
packages/opencode/src/session/prompt.ts:902, thesamevariable is computed as:When a subagent has no explicit
modelconfigured,ag.modelisundefined, sosameisfalse. This gates off theag.variantbranch, causing the configured variant to be silently dropped at runtime.Fix: treat a missing
ag.modelas "same model" (inherited), so the variant is applied:How did you verify your code works?
Added a temporary debug log at line 908 to trace variant resolution, then ran the subagent before and after the fix.
Before fix:
agVariant=highis present butvariantis missing (undefined).After fix:
variant=highis correctly resolved.Screenshots / recordings
Subagent running (configured with
variant: "high", nomodel):Before fix —
agVariant=highbutvariantmissing:After fix —
variant=highcorrectly resolved:Checklist