feat(opencode): allow changing model mid-session
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
Start in opencode_compat.rs, especially resolve_session_agent(), set_session_overrides(), and the runtime update path shown in the issue. Trace how SessionMessageRequest.model is resolved and how the backing agent process is managed; done means a mid-session model change updates the runtime, handles unsupported native switching, and exposes the change to the frontend.
索引モデルが issue の本文から書いたものです。
説明
Problem
When an OpenCode session is created and the first message is sent, the agent/provider/model is locked into the session runtime context. Subsequent messages cannot change the provider or model because the runtime is only set on the first message:
state.opencode.update_runtime(session_id, |runtime| {
if runtime.session_agent_id.is_none() {
runtime.session_agent_id = Some(agent);
runtime.session_provider_id = Some(provider_id);
runtime.session_model_id = Some(model_id);
}
});
While SessionMessageRequest accepts a model field on every message, the resolved model from the first message is reused for all subsequent messages. The set_session_overrides() function can update the SessionState, but the OpenCode runtime context does not reflect the change.
This means users cannot switch models mid-conversation (e.g., start with a fast model for simple tasks, then switch to a more capable model for complex reasoning).
Expected Behavior
Users should be able to change the model on any message within an existing session. When a model field is provided in SessionMessageRequest, it should override the session-level model for that message and update the session runtime accordingly.
Proposed Approach
- In
resolve_session_agent()(opencode_compat.rs), update the runtime even whensession_agent_idis already set, if the incoming message specifies a different model. - When the model changes mid-session, terminate the existing backing agent process and start a new one with the updated model, or pass the model switch through to agents that support it natively.
- Emit a synthetic event (e.g.,
session.model_changed) so the frontend can reflect the model switch. - Consider whether changing the agent (not just the model within the same agent) mid-session should also be supported, or scoped out for now.
Considerations
- Some agents may not support model switching natively — the daemon may need to restart the backing process.
- The
PATCH /opencode/session/{sessionID}endpoint could also be extended to accept model changes, giving the frontend an explicit way to switch before sending the next message. - Need to decide how model changes interact with conversation history — the new model should still receive the full conversation context.
- 主要言語
- TypeScript
- スター
- 1.6k
- フォーク
- 131
- 平均マージ
- 7時間 40分
- マージ済み PR(30日)
- 29
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rivet-dev/agents のほかの issue
-
skills add rivet-dev/skills -s sandbox-agent fails: the skill was removed from rivet-dev/skillsオープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
rivet-dev/agents#319 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
rivet-dev/agents#313 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
bug: codex model variants are out of order対応中かも @c7ozkan が 205 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
rivet-dev/agents の issue をすべて見る
似ている issue
-
documentation good first issue hacktoberfest help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
libredb/libredb-studio#1756 ·
メンテナーはふだん 1 日以内に返信
-
state:triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
lingdojo/kana-dojo#32365 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
friction
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
kentcdodds/kody#3706 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
copperheadhq/copperhead#378 ·
メンテナーはふだん 1 日以内に返信