Skip to content

[FEATURE]: Plugin hook to update active model and have subagents inherit it #18666

Closed

Description

@v1truv1us
  • I have verified this feature I'm about to request hasn't been suggested before.

Right now when a plugin changes the model via the chat.message hook, it only affects that one turn. The model picker still shows the old model, and the next turn goes back to it.

I want plugins to be able to actually change the active model so that:

  • The model picker updates to show the new model
  • Future turns use the new model
  • Subagents inherit it properly

This would fix #17870 (subagents ignoring parent's model) and enable things like dynamic model routing based on task type.

What works today: chat.message can mutate output.message.model and it flows through to the assistant and subagents for that turn.

What's missing: The active model state and UI don't update. Future turns revert.

Proposed: When a plugin changes the model in chat.message, also update OpenCode's active model state so the UI reflects it and future turns use it.

I have tests covering the model inheritance chain at packages/opencode/test/session/chat-message-model-routing.test.ts and JSDoc in the plugin index documenting this capability.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 22, 2026
  2. github-actions commented on Mar 22, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

    If your feature request is specifically about the plugin hook mechanism (not just the inheritance bug), it may be worth clarifying how it differs from #18615 to avoid duplicate effort.

  3. v1truv1us commented on Mar 22, 2026

    @v1truv1us
    Author

    Closing this one and reopening with better context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions