fix(session): preserve custom agent after switching (#1017)

Use setSessionAgent (first-write wins) instead of updateSessionAgent in chat.message handler. This prevents the default agent from overwriting a custom agent that was set via UI switch.

Fixes #893

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: justsisyphus <justsisyphus@users.noreply.github.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
justsisyphus
2026-01-23 16:25:26 +09:00
committed by GitHub
parent 84a17c003e
commit 9aa2084072
2 changed files with 37 additions and 1 deletions
+1 -1
View File
@@ -314,7 +314,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
"chat.message": async (input, output) => {
if (input.agent) {
updateSessionAgent(input.sessionID, input.agent);
setSessionAgent(input.sessionID, input.agent);
}
const message = (output as { message: { variant?: string } }).message