|
1 | 1 | import assert from 'node:assert/strict'; |
| 2 | +import { readFileSync } from 'node:fs'; |
2 | 3 | import { APICallError } from 'ai'; |
3 | 4 | import { ASK_MODE_TOOL_SCHEMAS } from '../../src/agent/ask-mode-tools'; |
4 | 5 | import { TOOL_SCHEMAS } from '../../src/agent/tools'; |
@@ -326,14 +327,19 @@ console.log('server agent executor message verification passed'); |
326 | 327 | // instead of feeding truncated text back into the next turn. |
327 | 328 | assert.equal(turnDisposition(false, true), 'continue'); |
328 | 329 | assert.equal(turnDisposition(false, false), 'completed'); |
329 | | -assert.equal(turnDisposition(false, true, true), 'continue', |
330 | | - 'an unresolved tool failure may continue only while the model is retrying'); |
331 | | -assert.equal(turnDisposition(false, false, true), 'failed', |
332 | | - 'completion is rejected while a tool failure remains unresolved'); |
333 | | -assert.equal(turnDisposition(true, true, true), 'failed', |
334 | | - 'a token cutoff cannot turn an unresolved tool failure into completion'); |
335 | 330 | assert.equal(turnDisposition(true, true), 'max-tokens', 'output cutoff wins over pending tool calls'); |
336 | 331 | assert.equal(turnDisposition(true, false), 'max-tokens'); |
| 332 | +// An unresolved tool failure is not a disposition input: the model already saw the |
| 333 | +// failed result and replied to it, and that reply is the run's outcome. Failing the run |
| 334 | +// here put the tracker's English template under a Chinese reply (a probe_media that |
| 335 | +// could not run, then a complete answer, then "I couldn't complete the requested |
| 336 | +// operation"), and made the documented probe→finalize fallback impossible to complete. |
| 337 | +assert.equal(turnDisposition.length, 2, 'the disposition takes no failure flag'); |
| 338 | +assert.doesNotMatch( |
| 339 | + readFileSync(new URL('./executor.ts', import.meta.url), 'utf8'), |
| 340 | + /toolFailures\.report\(\)/, |
| 341 | + 'the executor never surfaces the failure-report template', |
| 342 | +); |
337 | 343 |
|
338 | 344 | console.log('server executor turn-disposition checks passed'); |
339 | 345 |
|
|
0 commit comments