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(opencode): add optional model param to Task tool and show provider in message headers by shoootyou · Pull Request #31694 · anomalyco/opencode

Conversation

@shoootyou

@shoootyou shoootyou commented Jun 10, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Issue for this PR

Closes #17595
Related #9584
Related #24812

Type of change

  • New feature

What does this PR do?

Two related changes:

1. Optional model param on the Task tool

Adds an optional model string (provider/model format) to the Task tool input. When provided, the spawned subagent runs on that model instead of its configured or inherited one. The param is validated before the child session is created so invalid values fail fast without orphaning a session. Error messages distinguish malformed format from unavailable models, and surface getModel's fuzzy suggestions as a Did you mean: clause.

Note: PR #29447 implements the same Task model param with an additional model_override permission gate (default deny). This PR intentionally omits that gate and leaves the policy decision to maintainers. The implementations are otherwise complementary — this one adds full test coverage (36 passing tests), differentiated error messages, and prototype-key security hardening.

2. provider/model in message headers

Shows provider/model (e.g. anthropic/Claude Sonnet 4) instead of just the model name in assistant and user message headers — across packages/ui (app + desktop) and the TUI (session view + transcript export). providerID was already persisted on AssistantMessage; this is a presentational change only.

How did you verify your code works?

  • bun test test/tool/task.test.ts in packages/opencode — 36/36 pass (model override, inheritance, error cases, prototype-key rejection, no orphan sessions)
  • bun test src/components/message-part-model.test.ts in packages/ui — 6/6 pass
  • bun test test/util/provider-model-label.test.ts test/util/model.test.ts test/util/transcript.test.ts in packages/tui — 29/29 pass
  • bun typecheck clean in packages/opencode, packages/ui, packages/tui
  • Tested in a running opencode serve instance: model override routes subagents correctly, provider/model label visible in the web UI

Screenshots / recordings

UI change (provider label in message headers) — screenshot available on request.

Checklist

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

Sorry, something went wrong.

Uh oh!

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

All reactions
shoootyou and others added 11 commits June 10, 2026 01:21
@shoootyou @yui-soul
feat(opencode): add optional model param to Task tool
c1dd236
Allow a Task subagent call to specify the model it runs on via an
optional "providerID/modelID" string param. The model is parsed with
Provider.parseModel and validated with Provider.getModel; an explicit
model overrides both the agent's configured model and parent
inheritance, forcing variant to undefined. Omitting the param preserves
the existing inherit-from-agent/parent behavior.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
feat(ui): show provider next to model in messages
5008785
Display the provider alongside the model as "provider/model" in both
assistant footer and user header of the shared message component (used
by app web and desktop). Extracts a pure formatModelLabel helper with
per-field catalog fallback to raw providerID/modelID and a no-model
guard that never renders a stray slash.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
feat(tui): show provider next to model in session and transcript
cabeeb8
Add Model.providerModel formatter returning "provider/model" with raw
providerID/modelID fallback on catalog miss, leaving Model.name intact.
Switch the session transcript header and the session view model label to
the new formatter. Existing transcript tests updated to the new format.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
fix(opencode): harden Task model param validation
97268f6
Address audit findings on the Task tool model override:
- treat the param as present when defined (model: "" now errors instead
  of silently inheriting the parent model)
- reject empty and prototype-polluting segments (__proto__, constructor,
  prototype) before any provider lookup, and catch defects so a crafted
  value never leaks a raw TypeError
- validate the model before creating the child subagent session, so an
  invalid model fails fast without spawning an orphan session
Adds tests for empty-string, prototype keys, multi-slash modelID, and
override-beats-agent-own-model.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
fix(tui): align provider/model partial-miss to per-field fallback
df87770
When the provider resolves but the model is unknown, render the provider
display name with the raw model id (provider/model), matching the shared
UI helper instead of falling back to raw IDs for both. Full miss still
yields raw providerID/modelID. Adds direct Model.name tests for the
retained helper.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
test(ui): cover provider/model partial-miss and no-model guard
968dcd0
Add tests for the partial-miss branch (provider known, model unknown) and
both branches of the no-model guard, and replace the brittle double-cast
fixture with a fully-typed one.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
fix(opencode): reject inherited prototype keys in Task model param
9e79d90
Replace the fixed denylist with a prototype-membership check
(segment in {}) so inherited Object.prototype member names such as
toString and valueOf cannot pass as a modelID against a valid provider
and spawn an orphan subagent session. Adds regression tests and
strengthens the empty-string assertion.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
docs: document optional model param on the Task tool
6e9302b
Note that the invoking agent can override the subagent model per call via
the Task tool's optional model parameter (provider/model form), and that
an invalid value fails with an Invalid task model error.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
feat(opencode): differentiate Task model error messages
92d3196
Split the single generic Task model error into format vs availability:
- malformed format (no slash, empty segment, prototype-chain key) keeps a
  "provider/model format" explanation
- a well-formed but unknown provider reports "provider ... is not
  configured"
- a known provider with an unknown model reports "model ... is not
  available for provider ..."
Availability errors surface getModel suggestions (Did you mean: ...),
discriminated by the typed ModelNotFoundError tag and Provider.list()
membership rather than message text.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
test(opencode): cover no-suggestions branch and join format
5137d40
Add cases for the empty/omitted suggestions branch (no dangling
Did you mean), pin the comma-join separator and order, cover the
single-suggestion no-comma path, guard the suggestion-presence loops
against vacuum, and assert the empty-string format echo.

Co-authored-by: yui-soul <[email protected]>
@shoootyou @yui-soul
docs: clarify differentiated Task model errors
acd6c43
Distinguish the malformed-format Invalid task model error from the
well-formed-but-unavailable Model unavailable error (with suggestions).

Co-authored-by: yui-soul <[email protected]>
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Jun 10, 2026
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title feat(opencode,ui,tui): dynamic model param for Task tool + provider display in messages doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented Jun 10, 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:

Potential Duplicate/Related PR

PR #29447: feat(opencode): add task model override
#29447

This PR appears to address the same feature—adding a model override capability to the Task tool. Since PR #31694 (the current PR) implements dynamic model parameters for Task tools with both feature and provider display improvements, PR #29447 may be an earlier or alternative approach to the same problem.

You should verify whether #29447 was closed/superseded or if there's overlapping work between the two PRs.

All reactions

Sorry, something went wrong.

Uh oh!

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

@shoootyou shoootyou changed the title feat(opencode,ui,tui): dynamic model param for Task tool + provider display in messages feat(opencode): add optional model param to Task tool and show provider in message headers Jun 10, 2026
@github-actions github-actions Bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Jun 10, 2026
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

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

This was referenced Jun 29, 2026
feat(tui): show provider name in assistant message headers #34481
Closed
feat(opencode): add dispatch controls to the task tool #34947
Closed
@shoootyou

shoootyou commented Jul 5, 2026

Copy link
Copy Markdown
Author

Closing this PR — the change has already been merged into our fork (shoootyou/opencode) and will be maintained there. Thanks for the framework!

All reactions

Sorry, something went wrong.

Uh oh!

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

@shoootyou shoootyou closed this Jul 5, 2026
@shoootyou
shoootyou deleted the feat/dynamic-task-model-and-provider branch July 5, 2026 07:57
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

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Runtime model override for task tool subagents

Uh oh!

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

1 participant

@shoootyou
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.