fix(云智能体): 修复微信失败运行状态投影并提高默认执行步数

This commit is contained in:
2026-09-14 15:39:35 +08:00
parent 9044f7dd8c
commit 4f2caf7dbd
7 changed files with 119 additions and 4 deletions

View File

@@ -155,6 +155,16 @@ describe('Main cloud Agents boundary', () => {
expect(JSON.parse(fetchImpl.mock.calls[1][1].body)).toEqual({ request_id: 'request', thread_id: 'thread', query: 'hello' });
});
it('defaults omitted execution steps to 300 while preserving an explicit saved limit', async () => {
const { max_execution_steps: _omitted, ...configurationWithoutSteps } = EMPTY_CLOUD_CONFIGURATION;
const fetchImpl = vi.fn().mockResolvedValueOnce(session())
.mockResolvedValueOnce(json({ ...draft, configuration: { ...configurationWithoutSteps, max_execution_steps: 40 } }))
.mockResolvedValueOnce(json({ ...draft, configuration: configurationWithoutSteps }));
const module = moduleFor(fetchImpl);
expect((await module.get(draft.slug)).configuration.max_execution_steps).toBe(40);
expect((await module.get(draft.slug)).configuration.max_execution_steps).toBe(300);
});
it('uses the WS credential directly for the creator ledger and never exchanges it into Renderer data', async () => {
const fetchImpl = vi.fn().mockResolvedValueOnce(json({ unit: '词元点数', items: [], access_token: 'private' }));
const result = await moduleFor(fetchImpl).execute({ operation: 'costs', input: { slug: draft.slug } });
@@ -222,6 +232,21 @@ describe('Main cloud Agents boundary', () => {
});
});
it('preserves a failed channel run status, partial output, and authoritative error', () => {
const plan = operationPlan({ operation: 'channelConversation', input: { session_id: 'session-1' } });
expect(plan.project({
session_id: 'session-1', thread_id: 'thread-1', messages: [], queued_requests: [], next_offset: null,
run: { agent_run_id: 'run-1', request_id: 'request-1', thread_id: 'thread-1', agent_slug: draft.slug,
status: 'failed', output: 'PPT 只写入了一部分。', version: '1',
error: { type: 'execution_step_limit', message: '本次运行已达到执行步数上限,尚未完成。可在智能体设置中提高上限后重试。' } },
})).toEqual({
session_id: 'session-1', thread_id: 'thread-1', messages: [], queued_requests: [], next_offset: null,
run: { agent_run_id: 'run-1', request_id: 'request-1', thread_id: 'thread-1', agent_slug: draft.slug,
status: 'failed', output: 'PPT 只写入了一部分。', version: '1',
error: { type: 'execution_step_limit', message: '本次运行已达到执行步数上限,尚未完成。可在智能体设置中提高上限后重试。' } },
});
});
it('routes user-level channel accounts without requiring an Agent slug', () => {
const list = operationPlan({ operation: 'channelAccounts', input: {} });
expect(list.path).toBe('/api/makelore/channel-accounts');