fix: unblock local news page generation

This commit is contained in:
john
2026-07-25 21:55:00 +08:00
parent 793e64bfbc
commit 6b6f9ed01c
16 changed files with 1075 additions and 47 deletions
+32
View File
@@ -76,6 +76,38 @@ test('consumeSessionEventsUntilFinish records a successful raster generate_image
assert.equal(result.toolEvidence.generateImage.jobId, 'job-1');
});
test('consumeSessionEventsUntilFinish surfaces reasoning_content protocol errors before Finish', async () => {
const frames = [
`data: ${JSON.stringify({
type: 'Message',
request_id: 'req-1',
message: {
role: 'assistant',
content: [{
type: 'text',
text: 'Ran into this error: Bad request (400): The reasoning_content in the thinking mode must be passed back to the API.\n\nPlease retry if you think this is a transient or recoverable error.',
}],
},
})}\n\n`,
'data: {"type":"Finish","request_id":"req-1"}\n\n',
];
const stream = new ReadableStream({
start(controller) {
for (const frame of frames) controller.enqueue(new TextEncoder().encode(frame));
controller.close();
},
});
await assert.rejects(
consumeSessionEventsUntilFinish(stream, { requestId: 'req-1', timeoutMs: 5000 }),
(error) => {
assert.equal(error.code, 'SESSION_REASONING_CONTENT_POISONED');
assert.match(error.message, /reasoning_content/);
return true;
},
);
});
test('consumeSessionEventsUntilFinish surfaces provider tool history errors before Finish', async () => {
const frames = [
`data: ${JSON.stringify({