




























@@ -328,7 +328,6 @@ vi.mock("../routing/session-key.js", async () => {
328328);
329329return {
330330 ...actual,
331-isSubagentSessionKey: () => false,
332331normalizeAgentId: (id: string) => id,
333332normalizeMainKey: (key?: string | null) => key?.trim() || "main",
334333};
@@ -1340,6 +1339,75 @@ describe("agentCommand – LiveSessionModelSwitchError retry", () => {
13401339});
13411340});
134213411342+it("clamps unsupported explicit thinking for subagent spawns instead of throwing", async () => {
1343+setupSingleAttemptFallback();
1344+state.runAgentAttemptMock.mockResolvedValue(makeSuccessResult("anthropic", "claude-fable-5"));
1345+state.resolvedSessionKeyMock = "agent:planner:subagent:00000000-0000-4000-8000-000000000000";
1346+state.isThinkingLevelSupportedMock.mockReturnValue(false);
1347+state.resolveSupportedThinkingLevelMock.mockReturnValue("high");
1348+1349+await agentCommand({
1350+message: "hello",
1351+sessionKey: state.resolvedSessionKeyMock,
1352+thinking: "xhigh",
1353+lane: "subagent",
1354+});
1355+1356+expect(state.resolveSupportedThinkingLevelMock).toHaveBeenCalled();
1357+expectRecordFields(mockCallArg(state.runAgentAttemptMock), {
1358+resolvedThinkLevel: "high",
1359+});
1360+});
1361+1362+it("rejects unsupported explicit thinking for interactive subagent-key runs", async () => {
1363+setupSingleAttemptFallback();
1364+state.runAgentAttemptMock.mockResolvedValue(makeSuccessResult("anthropic", "claude-fable-5"));
1365+state.resolvedSessionKeyMock = "agent:planner:subagent:00000000-0000-4000-8000-000000000000";
1366+state.isThinkingLevelSupportedMock.mockReturnValue(false);
1367+1368+await expect(
1369+agentCommand({
1370+message: "hello",
1371+sessionKey: state.resolvedSessionKeyMock,
1372+thinking: "xhigh",
1373+}),
1374+).rejects.toThrow(/is not supported/u);
1375+expect(state.runAgentAttemptMock).not.toHaveBeenCalled();
1376+});
1377+1378+it("rejects unsupported explicit thinking for non-subagent sessions on the subagent lane", async () => {
1379+setupSingleAttemptFallback();
1380+state.runAgentAttemptMock.mockResolvedValue(makeSuccessResult("anthropic", "claude-fable-5"));
1381+state.resolvedSessionKeyMock = "agent:main:main";
1382+state.isThinkingLevelSupportedMock.mockReturnValue(false);
1383+1384+await expect(
1385+agentCommand({
1386+message: "hello",
1387+sessionKey: state.resolvedSessionKeyMock,
1388+thinking: "xhigh",
1389+lane: "subagent",
1390+}),
1391+).rejects.toThrow(/is not supported/u);
1392+expect(state.runAgentAttemptMock).not.toHaveBeenCalled();
1393+});
1394+1395+it("rejects unsupported explicit thinking for direct interactive runs", async () => {
1396+setupSingleAttemptFallback();
1397+state.runAgentAttemptMock.mockResolvedValue(makeSuccessResult("anthropic", "claude-fable-5"));
1398+state.resolvedSessionKeyMock = "agent:main:main";
1399+state.isThinkingLevelSupportedMock.mockReturnValue(false);
1400+1401+await expect(
1402+agentCommand({
1403+message: "hello",
1404+to: "+1234567890",
1405+thinking: "xhigh",
1406+}),
1407+).rejects.toThrow(/is not supported/u);
1408+expect(state.runAgentAttemptMock).not.toHaveBeenCalled();
1409+});
1410+13431411it("skips the initial session touch after gateway ingress already persisted activity", async () => {
13441412setupSingleAttemptFallback();
13451413state.runAgentAttemptMock.mockResolvedValue(makeSuccessResult("openai", "gpt-5.4"));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。