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(core): in-session session_switch_model tool (#1886) by dezren39 · Pull Request #1969 · developing-today-forks/opencode

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026

Copy link
Copy Markdown

Fixes #1886 — option 1 from the issue: an in-session switch tool.

Change

  • New session_switch_model tool in the opencode tool namespace (packages/core/src/tool/plugin/opencode.ts), alongside session_rename / session_move. It wraps the existing plugin session surface ctx.session.switchModel (core Session.switchModel), so all existing semantics apply unchanged: no-op when the model is unchanged, and child sessions are governance-checked via ModelGovernance.assertAllowed inside switchModel — a denied switch surfaces the governance error naming the allowed models.
  • Input mirrors the established tool pattern (subagent/messaging): an optional sessionID (omit = current session) and a model string parsed with Model.Ref.parse — "providerID/modelID" or "providerID/modelID#variant"; the description tells the model not to guess IDs and to look models up with the models tool.
  • The description states the required semantics up front: the switch takes effect on the next turn and the prompt cache does not carry over to the new model, so switches should be rare and deliberate. The success result repeats the next-turn / cache note.
  • The tool's input schema is added to the builtinInputs inventory in packages/core/test/tool-schema.test.ts in the same change, so the new built-in is covered by the draft-2020-12 meta-validation from day one (the general completeness gap in that hand-maintained list is test(core): tool-schema meta-validation inventory is hand-maintained with no completeness check — a new built-in tool escapes #1668 validation silently (#1674 follow-up) #1902, triaged separately).

Why this closes the workshop gap

A session asked to switch itself (the #1881 Q5 failure, where the test session improvised session_move with a route name as a directory) now has a sanctioned, discoverable path: tools.opencode.session_switch_model. No new core mechanism was needed — the plugin session domain already exposed switchModel (packages/plugin/src/effect/session.ts, host wiring in packages/core/src/plugin/host.ts); only the tool was missing.

Verification

  • New test in packages/core/test/tool-opencode.test.ts: self-switch changes the session's model (verified via sessions.get), a #variant ref rides through, and an invalid ref fails leaving the model untouched.
  • bun test test/tool-opencode.test.ts test/tool-schema.test.ts in packages/core: 26 pass / 0 fail.
  • bun run check (pre-push, turbo): all tasks successful, including @opencode/core typecheck; oxlint clean on changed files.

Queue: task 11041 (repo-health-opencode-pilot), lane opencode-a.

Sorry, something went wrong.

Uh oh!

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

All reactions
@dezren39
feat(core): add in-session session_switch_model tool backed by Sessio…
a712045
…n.switchModel (#1886)
@dezren39
dezren39 merged commit 294cf36 into main Nov 8, 2026
@dezren39
dezren39 deleted the queue/11041-1886-session-switch-model branch November 8, 2026 04:19
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 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

audit:complete PR fully implemented spawning issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

gap: no in-session model switch — expose Session.switchModel in-session, or a switch-request path to the parent/launcher

Uh oh!

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

1 participant

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