mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Fix async injection tool-result ordering
This commit is contained in:
@@ -85,6 +85,8 @@ export interface LoopHandle {
|
||||
clearCancel(): void
|
||||
/** Settle idle waiters when pre-running cancellation skips a turn, without emitting `agent/status`. */
|
||||
settleIdle(): void
|
||||
/** Append context that arrived while an assistant tool-call batch was awaiting its results. */
|
||||
readonly drainDeferredInjections: () => void
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,6 +351,10 @@ async function runTurn(
|
||||
break
|
||||
}
|
||||
|
||||
// A successful tool step has committed its complete result batch. Context
|
||||
// accepted while that batch was pending can now join the open turn.
|
||||
if (stepOutcome.hadToolCalls) handle.drainDeferredInjections()
|
||||
|
||||
// Preserve max-token completion unless a later disposal, abort, or error wins.
|
||||
const stepReason = stepFinishReason(stepOutcome.finish)
|
||||
if (stepReason) reason = stepReason
|
||||
|
||||
Reference in New Issue
Block a user