fix(mindspace): fail closed on invalid page data delivery
This commit is contained in:
@@ -619,6 +619,47 @@ test('agent run succeeds when Finish is missing but session pages were already c
|
||||
);
|
||||
});
|
||||
|
||||
test('static page run succeeds when no Page Data artifact path is recorded', async () => {
|
||||
const pool = createFakePool({
|
||||
workspaceDeliverables: {
|
||||
'user-1': [{
|
||||
page_id: 'page-static-workspace',
|
||||
title: '都市时尚',
|
||||
publication_id: 'pub-static-workspace',
|
||||
publication_status: 'online',
|
||||
public_url: 'http://127.0.0.1:5173/MindSpace/user-1/public/urban-fashion.html',
|
||||
workspace_relative_path: 'public/urban-fashion.html',
|
||||
updated_at: Date.now(),
|
||||
}],
|
||||
},
|
||||
});
|
||||
const gateway = createAgentRunGateway({
|
||||
pool,
|
||||
userAuth: {},
|
||||
tkmindProxy: {
|
||||
async startSessionForUser() {
|
||||
return { id: 'session-static-workspace' };
|
||||
},
|
||||
async submitSessionReplyAndAwaitFinishForUser() {
|
||||
return { ok: true, finishEvent: { type: 'Finish' } };
|
||||
},
|
||||
},
|
||||
// This mirrors a static-page-publish run: no Page Data artifact list.
|
||||
syncUserPagesOnSuccess: async () => ({ pageDataBind: { errors: [] }, pageDataRelativePaths: [] }),
|
||||
retryDelaysMs: [],
|
||||
});
|
||||
|
||||
const run = await gateway.createRun('user-1', {
|
||||
requestId: 'req-static-workspace-page',
|
||||
userMessage: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: '生成一个都市时尚展示页面' }],
|
||||
},
|
||||
});
|
||||
|
||||
await waitFor(() => pool.runs.get(run.id)?.status === 'succeeded');
|
||||
});
|
||||
|
||||
test('agent run uses direct chat service for eligible chat messages', async () => {
|
||||
const pool = createFakePool();
|
||||
const directRuns = [];
|
||||
|
||||
Reference in New Issue
Block a user