Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 74 additions & 5 deletions packages/cli/src/acp-integration/acpAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6635,6 +6635,65 @@ describe('QwenAgent MCP SSE/HTTP support', () => {
}
});

it('defers standalone reasoning options until the generation config is available', async () => {
const sessionId = '11111111-1111-4111-8111-111111111111';
const innerConfig = await setupSessionMocks(sessionId);
innerConfig.getSessionSourceType = vi.fn().mockReturnValue('standalone');
innerConfig.getModel = vi.fn().mockReturnValue('qwen3.8-max');
innerConfig.getContentGeneratorConfig = vi.fn().mockReturnValue(undefined);
const { agent, agentPromise } = await bootInitializedAcpAgent(
makeSessionSettings(),
'trusted-capability',
);

try {
const session = (await agent.newSession({
cwd: '/tmp',
mcpServers: [],
_meta: {
[SESSION_SOURCE_META_KEY]: {
sourceType: 'standalone',
[DAEMON_OWNED_STANDALONE_CREATION_KEY]: true,
},
},
})) as {
configOptions: Array<{ id: string; options: Array<{ value: string }> }>;
};

expect(session.configOptions.map((option) => option.id)).toEqual([
'mode',
'model',
]);
expect(innerConfig.refreshAuth).not.toHaveBeenCalled();

innerConfig.getContentGeneratorConfig.mockReturnValue({
thinkingMandatory: true,
});
const context = (await agent.extMethod(
SERVE_STATUS_EXT_METHODS.sessionContext,
{ sessionId },
)) as {
state: {
configOptions: Array<{
id: string;
options: Array<{ value: string }>;
}>;
};
};
const reasoningOption = context.state.configOptions.find(
(option) => option.id === 'reasoning_effort',
);

expect(reasoningOption).toBeDefined();
expect(
reasoningOption?.options.some((option) => option.value === 'none'),
).toBe(false);
} finally {
mockConnectionState.resolve();
await agentPromise;
}
});

it('persists trusted direct Realtime dialogue without prompting the backend', async () => {
const sessionId = 'session-A';
await setupSessionMocks(sessionId);
Expand Down Expand Up @@ -21556,6 +21615,10 @@ describe('QwenAgent loadSession / unstable_resumeSession', () => {
messages: [{ role: 'user', parts: [{ text: 'restored' }] }],
},
});
innerConfig.getModel = vi.fn().mockReturnValue('qwen3.8-max');
innerConfig.getContentGeneratorConfig = vi
.fn()
.mockReturnValue(undefined);
vi.mocked(loadSettings).mockReturnValue(settings);
const { agent, agentPromise } = await spawnAgent('expected-capability');

Expand All @@ -21571,12 +21634,18 @@ describe('QwenAgent loadSession / unstable_resumeSession', () => {
},
},
};
if (action === 'load') {
await agent.loadSession(request);
} else {
await agent.unstable_resumeSession(request);
}
const response = (
action === 'load'
? await agent.loadSession(request)
: await agent.unstable_resumeSession(request)
) as {
configOptions: Array<{ id: string }>;
};

expect(response.configOptions.map((option) => option.id)).toEqual([
'mode',
'model',
]);
expect(innerConfig.refreshAuth).not.toHaveBeenCalled();
expect(innerConfig.activateProvisionalWorkspace).not.toHaveBeenCalled();
expect(
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/acp-integration/acpAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13918,7 +13918,10 @@ class QwenAgent implements Agent {
return [modeConfigOption, modelConfigOption];
}

const generation = config.getContentGeneratorConfig();
const generation = config.getContentGeneratorConfig?.();
if (!generation) {
return [modeConfigOption, modelConfigOption];
}
const modelReasoning = this.getModelReasoningConfiguration(
config,
currentModelId,
Expand Down
Loading