GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(task): pass variant to subagent so it inherits parent's thinking level by mugnimaestra · Pull Request #12567 · anomalyco/opencode

Conversation

@mugnimaestra

@mugnimaestra mugnimaestra commented Feb 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What does this PR do?

When a user sets a thinking variant (e.g. "high") on their main session, subagents spawned via the Task tool don't inherit it — they always run at default thinking. This means if you're using Claude with extended thinking or any model with reasoning variants, your subagents silently drop that setting.

This PR fixes that by reading the parent user message's variant in task.ts and forwarding it to the child session's SessionPrompt.prompt() call. The inheritance only kicks in when the subagent doesn't already have its own variant configured (via agent config), so explicit per-agent variants are respected.

Related issues

Issue Title Relevance
#7138 Support default variant configuration per agent Root feature request for per-agent variant control
#10320 Specify sub-agent variant (thinking lvl) from script for token economy Directly requests parent→child variant passthrough
#8123 Can't set effort when configuring a sub-agent User pain point this PR alleviates
#6645 Support for Model Variants in (sub)agents Original feature request for variant support in subagents

Relationship with PR #7156 (agent-level config)

PR #7156 adds a static variant field to agent config so each agent can declare its own default. This PR complements that by handling the dynamic case: when no agent-level variant is configured, the subagent inherits the parent session's variant at spawn time.

Resolution order (with both PRs merged): user input > agent config (#7156) > parent variant (this PR) > model default

These two PRs are independent and merge cleanly; together they fully close the gap described in the issues above.

Changes

  • packages/opencode/src/tool/task.ts — After resolving the subagent, read the parent user message and compute inherited variant. Pass it to SessionPrompt.prompt().
  • packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts — Fix reasoning_opaque handling: the Copilot API can send multiple reasoning_opaque deltas in a single response (e.g. one with reasoning text, another with tool calls). Previously this threw an InvalidResponseDataError; now it accepts the latest value. This fix is required because with thinking variants active, multi-turn Copilot responses hit this edge case.
  • packages/opencode/test/session/prompt-variant.test.ts — Three new tests covering: explicit variant passthrough, parent→child variant inheritance, and no-inherit when agent has own variant.

How it works: SessionPrompt.prompt() already supports a variant parameter that gets stored on the user message and used when building the LLM request. The Task tool just wasn't passing it through. The fix reads the parent message (which task.ts already has access to via msg.info.parentID) and conditionally forwards its variant.

How did you verify your code works?

  1. bun test packages/opencode/test/session/prompt-variant.test.ts — all 5 tests pass (2 existing + 3 new)
  2. Manual testing with GitHub Copilot provider using variant: "high" — confirmed subagents now show extended thinking output where they previously didn't

Closes #10320
Related: #7138, #8123, #6645, #7156

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Solido, dollannn, iAziz786, subnix, and samiralibabic reacted with thumbs up emoji
All reactions
  • 👍 5 reactions
@github-actions github-actions Bot added the contributor label Feb 7, 2026
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

Related PR found:

  1. PR feat(agent): implement model tier selection with variant support for subagents #11377 - feat(agent): implement model tier selection with variant support for subagents
    • This PR is already mentioned in your "Related:" section and implements variant support for subagents. Your PR (feat(task): pass variant to subagent so it inherits parent's thinking level #12567) appears to be building on this work by ensuring variants are inherited from parent sessions.

The other result (PR #7140 - "Add default variant config per agent") is also in the related issues but seems to be older work on agent variant configuration.

Conclusion: No duplicate PRs detected. PR #12567 appears to be the only open PR addressing this specific feature of inheriting parent variant settings in the Task tool. The related PRs are complementary work on variant support rather than duplicates.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mugnimaestra

mugnimaestra commented Feb 7, 2026

Copy link
Copy Markdown
Contributor Author

Manual test video uploaded: manual-testing-subagent-thinking-2x-original.mp4

This recording shows a session using GitHub Copilot provider with variant: high where the subagent now correctly inherits the parent thinking variant and produces extended thinking output.

manual-testing-subagent-thinking-2x-original.mp4
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mugnimaestra and others added 3 commits February 7, 2026 11:12
@mugnimaestra
feat: inherit variant from parent session in subagent tasks
2b7ee66
@mugnimaestra @cursoragent
test: add variant inheritance tests for subagent task flow
7688837
Cover both paths of the task.ts inheritance logic:
- subagent without own variant inherits parent's variant
- subagent with own variant skips inheritance

Co-authored-by: Cursor <[email protected]>
@mugnimaestra
fix(chat): update reasoning_opaque handling to accept latest value in…
ca74d24
… multi-turn responses
@mugnimaestra
mugnimaestra force-pushed the feat/subagent-variant-inheritance branch from 55de3a1 to ca74d24 Compare February 7, 2026 04:13
@mugnimaestra
mugnimaestra marked this pull request as ready for review February 7, 2026 04:36
This was referenced Feb 7, 2026
[FEATURE]:Specify sub-agent variant (thinking lvl) from script for token economy #10320
Closed
[FEATURE] Support default variant configuration per agent (#7156) #7138
Closed
I can’t set the effort when configuring a sub-agent! How can I configure this? #8123
Closed
Missing array bounds checking in LLM provider response handling #11700
Closed
@Solido

Solido commented Feb 7, 2026

Copy link
Copy Markdown

Can the variant be specified in the prompt? not preconfigured.
I may need to clarify this subtle difference.

'ask @SpecialAgent with low variant'

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CasualDeveloper

CasualDeveloper commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

@Solido my PR originally had that feature initially but after some discussion with maintainers we agreed to take it out and deliver just the MVP first, with that feature to come as a follow up

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Solido

Solido commented Feb 7, 2026

Copy link
Copy Markdown

Fully understandable, need a split for consolidation.
At least you guys took the point!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DasOhmoff

DasOhmoff commented Feb 14, 2026

Copy link
Copy Markdown

This would be very nice, thanks for your efforts.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Feb 24, 2026
feat: add model parameter to Task tool for dynamic subagent model selection #14961
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
fix(app): improve agent selection logic passing in configured models and variants correctly #16072
Merged
4 of 6 tasks
@jogoossens

jogoossens commented Mar 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

in fact I would expect by default ALL main agent settings are copied. We are using qwen and suddenly where confronted with temperature at 0.55. We have a bunch of other settings too we need in the subagent automatically... (top_k top_p etc)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Mar 22, 2026
feat(opencode): add native dynamic subagent task support #18588
Closed
feat(plugin): add chat.model hook for dynamic model routing for token savings #18826
Closed
This was referenced Apr 2, 2026
fix(opencode): Subtasks and task calls don’t inherit selected thinking level #20742
Closed
fix(opencode): inherit thinking level (variant) in task tool subtasks #20811
Closed
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
This was referenced Apr 29, 2026
fix(opencode): apply agent variant when no explicit model is configured #24962
Closed
feat(task-tool): Add model parameter for subagent LLM routing #25881
Closed
@github-actions github-actions Bot mentioned this pull request May 24, 2026
fix(opencode): preserve subagent model variants #29066
Closed
3 of 6 tasks
@jsheremeta-alt jsheremeta-alt mentioned this pull request Jun 4, 2026
subagent model variants are parsed but not applied at runtime in v1.4.0 #21632
Closed
@github-actions github-actions Bot mentioned this pull request Jun 25, 2026
fix(tui): respect per-agent variant when TAB-cycling shared models #33960
Closed
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
feat(tui): preserve selected thinking effort per agent per model for primary agents #36708
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Jul 24, 2026
feat(tui): show model variant in subagent footer #38772
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Aug 30, 2026
fix(tui): scope reasoning-effort variants to the agent, seed from agent config #46202
Closed
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]:Specify sub-agent variant (thinking lvl) from script for token economy

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@mugnimaestra @Solido @CasualDeveloper @DasOhmoff @jogoossens @thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.