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

This commit is contained in:
brother7 committed 2026-09-14 15:39:35 +08:00
1 parent 9044f7dd8c
commit 4f2caf7dbd
7 files changed
+119 -4

No files matched your search

@@ -43,6 +43,40 @@ it('approves the actual action batch through the self-session endpoint and autom
expect(api.call.mock.calls.some(call => ['resume', 'run', 'files', 'submit'].includes(call[0]))).toBe(false);
});
it.each([
['running', '运行中'],
['completed', '已完成'],
['cancelled', '已停止'],
['interrupted', '等待你的确认'],
] as const)('renders the authoritative %s WeChat run status', async (status, label) => {
const base = api.call.getMockImplementation()!;
api.call.mockImplementation(async (operation, input) => operation === 'channelConversation'
? { ...history, run: { ...run, status } } : base(operation, input));
render(<CloudChannelConversations slug={session.agent_slug} />);
expect(await screen.findByTestId('wechat-run-status')).toHaveTextContent('任务状态:' + label);
});
it('keeps partial assistant output visible while surfacing a closed run failure and its authoritative error', async () => {
const base = api.call.getMockImplementation()!;
api.call.mockImplementation(async (operation, input) => operation === 'channelConversation'
? { ...history, session_state: 'closed', grant_state: 'revoked', run: { ...run, status: 'failed', error: {
type: 'unexpected_error', message: 'Recursion limit of 40 reached',
} }, messages: [{ id: 1, role: 'assistant', content: 'PPT 只写入了一部分。' }] } : base(operation, input));
render(<CloudChannelConversations slug={session.agent_slug} />);
const status = await screen.findByTestId('wechat-run-status');
expect(status).toHaveTextContent('任务状态:失败');
expect(screen.getByRole('alert', { name: '微信任务错误' })).toHaveTextContent('unexpected_error · Recursion limit of 40 reached');
expect(screen.getByText('PPT 只写入了一部分。')).toBeVisible();
});
it('shows a queued request status before the authoritative run is exposed', async () => {
const base = api.call.getMockImplementation()!;
api.call.mockImplementation(async (operation, input) => operation === 'channelConversation'
? { ...history, run: null, queued_requests: [{ request_id: 'queued-request', thread_id: session.thread_id, run_id: null, status: 'running', version: '1' }] } : base(operation, input));
render(<CloudChannelConversations slug={session.agent_slug} />);
expect(await screen.findByTestId('wechat-run-status')).toHaveTextContent('任务状态:运行中');
});
it('retries an uncertain stop with the identical operation ID and keeps other controls disabled', async () => {
const base = api.call.getMockImplementation()!;
let original: unknown;