mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(agent-loop): log tool/result under the originating call.id (P1-7)
The loop passed the authoritative call.id into ctx.tools.execute() but then appended tool/result using result.callId — the value a tools/execute waterfall listener returns — with no check. A listener returning a mismatched id silently recorded the result under the wrong call. callId is the model-transcript correlation id: deriveMessages() turns it into the tool-result block's toolCallId, which must pair with the assistant tool-call block; a wrong id orphans that pairing in the next model request. Append tool/result with callId: call.id (the loop's authoritative id). A listener-internal id, if ever worth keeping, belongs in a separate diagnostic field — never overloaded onto callId. Test: a tools/execute listener returns a wrong callId; assert the logged tool/result.callId equals call.id AND deriveMessages() yields a tool-result block whose toolCallId equals call.id (not the wrong returned id). Verified the test fails on the pre-fix result.callId behavior.
This commit is contained in:
@@ -420,7 +420,13 @@ async function runStep(
|
||||
})
|
||||
session.append('tool/result', {
|
||||
turn, step,
|
||||
callId: result.callId,
|
||||
// The correlation id MUST be the loop's authoritative call.id (the
|
||||
// model-transcript id that deriveMessages turns into toolCallId), NOT
|
||||
// result.callId — a tools/execute waterfall listener returning a
|
||||
// mismatched id would otherwise orphan the call↔result pairing in the
|
||||
// next model request. A listener-internal id, if ever needed, belongs in
|
||||
// a separate diagnostic field, never overloaded onto callId.
|
||||
callId: call.id,
|
||||
content: result.content,
|
||||
isError: result.isError,
|
||||
...result.error ? { error: result.error } : {},
|
||||
|
||||
Reference in New Issue
Block a user