From 1f504f00f97b04e6729c5633fd8f13ddfd947362 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 4 Jun 2026 00:28:22 +0800 Subject: [PATCH] fix(cli): inherit provider profile from explicit agent session --- tools/hwlab-cli/client.test.ts | 5 ++++- tools/src/hwlab-cli-lib.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/hwlab-cli/client.test.ts b/tools/hwlab-cli/client.test.ts index 78a57b89..99e0dcf2 100644 --- a/tools/hwlab-cli/client.test.ts +++ b/tools/hwlab-cli/client.test.ts @@ -171,6 +171,7 @@ test("hwlab-cli client group help is visible and does not issue HTTP requests", assert.equal(agent.payload.action, "client.agent.help"); assert.equal(agent.payload.serviceRuntime, false); assert.ok(agent.payload.commands.some((command: string) => command.startsWith("send "))); + assert.ok(agent.payload.commands.some((command: string) => command.startsWith("send ") && command.includes("--provider-profile"))); const session = await runHwlabCli(["client", "session", "--help", "--base-url", "http://web.test"], { fetchImpl }); assert.equal(session.exitCode, 0); @@ -561,7 +562,8 @@ test("hwlab-cli client agent send resolves explicit session conversation before sessionId: "ses_stale_workspace", threadId: "thread-stale-workspace" }, - workspace: { sessionStatus: "idle", threadId: "thread-stale-workspace" } + providerProfile: "deepseek", + workspace: { sessionStatus: "idle", threadId: "thread-stale-workspace", providerProfile: "deepseek" } } }), { status: 200 }); } @@ -594,6 +596,7 @@ test("hwlab-cli client agent send resolves explicit session conversation before assert.equal(calls[2].body.conversationId, "cnv_manual_current"); assert.equal(calls[2].body.sessionId, "ses_manual_current"); assert.equal(calls[2].body.threadId, "thread-manual-current"); + assert.equal(calls[2].body.providerProfile, "minimax-m3"); assert.equal(calls[2].body.workspaceId, "wsp_stale_selection"); assert.equal(result.payload.continuation.conversationId, "cnv_manual_current"); assert.equal(result.payload.continuation.sessionId, "ses_manual_current"); diff --git a/tools/src/hwlab-cli-lib.ts b/tools/src/hwlab-cli-lib.ts index 28d6bc5a..9cacffd8 100644 --- a/tools/src/hwlab-cli-lib.ts +++ b/tools/src/hwlab-cli-lib.ts @@ -634,7 +634,7 @@ function agentHelp() { "session select SESSION_ID [--workspace-id ID]", "session status SESSION_ID", "session list [--limit N]", - "send --message TEXT|--message-file PATH [--from-trace TRACE] [--conversation-id ID] [--session-id ID] [--thread-id ID] [--retry-of TRACE] [default: short return]", + "send --message TEXT|--message-file PATH [--from-trace TRACE] [--conversation-id ID] [--session-id ID] [--thread-id ID] [--retry-of TRACE] [--provider-profile deepseek|codex-api|minimax-m3] [default: short return]", "composer status [--profile NAME] [--full]", "composer submit --message TEXT|--message-file PATH [--profile NAME] [default: auto turn/steer]", "send --message TEXT --wait [--timeout-ms N] [--poll-interval-ms N]", @@ -1355,6 +1355,10 @@ async function agentSend(context: any) { retryOf, fromTrace: replay.fromTrace }); + const requestProviderProfile = text(parsed.providerProfile) + || text(explicitSessionRecord?.providerProfile) + || (workspaceMatchesSelectedSession ? text(workspaceState?.providerProfile) : "") + || "deepseek"; const requestBody = clean({ message, conversationId, @@ -1362,7 +1366,7 @@ async function agentSend(context: any) { threadId, retryOf, traceId, - providerProfile: text(parsed.providerProfile) || "deepseek", + providerProfile: requestProviderProfile, gatewayShellTimeoutMs: numberOption(parsed.gatewayShellTimeoutMs), shortConnection: true, projectId: text(parsed.projectId) || DEFAULT_WORKBENCH_PROJECT_ID,