feat(api): register default agent in config on workspace switch

Call setDefaultAgentInConfig when switching workspaces so the gateway picks up the active workspace agent.
This commit is contained in:
kumarabhirup 2026-03-03 15:38:07 -08:00
parent 38f3cb6efe
commit 1398e556a1
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -4,6 +4,7 @@ import {
resolveOpenClawStateDir,
resolveWorkspaceRoot,
setUIActiveWorkspace,
setDefaultAgentInConfig,
} from "@/lib/workspace";
export const dynamic = "force-dynamic";
@ -45,6 +46,7 @@ export async function POST(req: Request) {
}
setUIActiveWorkspace(requestedWorkspace);
setDefaultAgentInConfig(requestedWorkspace);
const activeWorkspace = getActiveWorkspaceName();
const selected = discoverWorkspaces().find((workspace) => workspace.name === activeWorkspace) ?? null;
return Response.json({