子代理工具失败时在事件日志记录原因(截断 300 字)
This commit is contained in:
parent
12157621b5
commit
b844eceb88
@ -381,9 +381,11 @@ export class DetailPiAgent {
|
||||
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
||||
const retry = {enabled:true,maxRetries:3};
|
||||
const workers = new Map();
|
||||
// Worker sessions are in memory, so the event log is the only place a failed tool's reason survives.
|
||||
const recordToolEvent = (event,activity,scope) => store.appendEvent({
|
||||
type:event.type,toolName:event.toolName,toolCallId:event.toolCallId,isError:event.isError??false,...scope,
|
||||
...(activity?{status:activity.status,phase:activity.phase,category:activity.category,durationMs:activity.durationMs}:null),
|
||||
...(event.isError?{error:event.result?.content?.find(item=>item.type==='text')?.text?.slice(0,300)}:null),
|
||||
});
|
||||
runtime.registerProvider('jiansun-native-98k', {
|
||||
api, apiKey: 'native-broker-only', baseUrl: api === 'anthropic-messages' ? 'https://api.vip98k.com' : 'https://api.vip98k.com/v1',
|
||||
|
||||
@ -171,6 +171,9 @@ test('waiting screen review returns its last rejection when Pi reaches the turn
|
||||
assert.equal(starts.length,WORKER_TURN_LIMIT);
|
||||
assert.equal(ends.length,WORKER_TURN_LIMIT);
|
||||
assert.ok(ends.every(event=>event.isError&&event.toolName==='review_output_screen'));
|
||||
assert.ok(ends.every(event=>event.error.includes('overlayFixes[0].nativeLayerId')&&event.error.length<=300),
|
||||
JSON.stringify(ends[0]));
|
||||
assert.ok(starts.every(event=>event.error===undefined));
|
||||
assert.deepEqual(ends.map(event=>event.toolCallId).sort(),starts.map(event=>event.toolCallId).sort());
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user