Skip to content

fix(session): agent.model and agent.variant config ignored in handleSubtask#36281

Open
naveen9036 wants to merge 2 commits into
anomalyco:devfrom
naveen9036:fix/subagent-model-variant-override
Open

fix(session): agent.model and agent.variant config ignored in handleSubtask#36281
naveen9036 wants to merge 2 commits into
anomalyco:devfrom
naveen9036:fix/subagent-model-variant-override

Conversation

@naveen9036

@naveen9036 naveen9036 commented Jul 10, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #36250

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes two bugs in handleSubtask where agent.model and agent.variant configured in opencode.json are silently ignored when a subagent is spawned.

  1. taskAgent was being fetched after taskModel was already resolved, meaning the agent's configured model was never consulted.
  2. variant was hardcoded to the parent session's variant, ignoring agent.variant.

Fix: Moved the taskAgent fetch before taskModel resolution, added taskAgent.model to the fallback chain, and prioritized taskAgent.variant over the parent session's variant.

How did you verify your code works?

Tested locally with Ollama to ensure the subagent correctly switches to the configured model from opencode.json. Also verified that bun run typecheck passes cleanly with 0 errors.

Screenshots / recordings

N/A (Backend logic fix, no UI changes)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

naveen9036 and others added 2 commits July 10, 2026 15:49
- Move taskAgent fetch before taskModel resolution so the agent's
  configured model is available when deciding which model to use
- Add taskAgent.model as middle tier in the fallback chain:
  task.model > agent.model > parent session model
- Use taskAgent.variant as preference over parent session variant

Closes anomalyco#21632
Re-fixes anomalyco#21952
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

bug(session): agent.model and agent.variant config ignored in handleSubtask

1 participant