From 4b95b327dd15beed34bbc47ca79ca96167bdea34 Mon Sep 17 00:00:00 2001 From: bot-hermes Date: Sun, 6 Sep 2026 17:23:57 +0000 Subject: [PATCH] fix: forward agent/model/variant to session creation createSession() only sent { directory, title } to the OpenCode server, dropping the agent field. The create() function read payload.agent but never forwarded it, so every session was created with the OpenCode default (build) and the agent was only applied later at prompt time. Now forwards agent/model/variant in the session create POST body so the session is created with the requested agent from the start. --- .../web/server/lib/openchamber-sessions/routes.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/web/server/lib/openchamber-sessions/routes.js b/packages/web/server/lib/openchamber-sessions/routes.js index b9b768e0..3303c745 100644 --- a/packages/web/server/lib/openchamber-sessions/routes.js +++ b/packages/web/server/lib/openchamber-sessions/routes.js @@ -196,7 +196,7 @@ const runPromptAsync = async ({ baseUrl, authHeaders, sessionID, directory, payl } }; -const createSession = async ({ baseUrl, authHeaders, directory, title }) => { +const createSession = async ({ baseUrl, authHeaders, directory, title, agent, model, variant }) => { const sessionUrl = new URL(`${baseUrl}/session`); sessionUrl.searchParams.set('directory', directory); const response = await fetch(sessionUrl.toString(), { @@ -207,7 +207,13 @@ const createSession = async ({ baseUrl, authHeaders, directory, title }) => { 'content-type': 'application/json', accept: 'application/json', }, - body: JSON.stringify({ directory, ...(title ? { title } : {}) }), + body: JSON.stringify({ + directory, + ...(title ? { title } : {}), + ...(agent ? { agent } : {}), + ...(model ? { model } : {}), + ...(variant ? { variant } : {}), + }), }); if (!response.ok) { @@ -725,6 +731,9 @@ export const createOpenChamberSessionService = (dependencies) => { authHeaders, directory: sessionDirectory, ...(title ? { title } : {}), + ...(agent ? { agent } : {}), + ...(model ? { model } : {}), + ...(variant ? { variant } : {}), }); let dispatch = { model, agent, variant, promptDispatched: false, dispatchedAsCommand: false };