fix(llm): preserve retry routes across turns

This commit is contained in:
Turtle
2026-07-25 10:49:48 +08:00
parent d07e7dd317
commit c1f148ce7f
4 changed files with 47 additions and 7 deletions

View File

@@ -4,8 +4,9 @@ import type { SessionEvent } from '@deepseek-ai/dsh-session'
/**
* Find the provider in force when one step closed, excluding later recovery mutations.
* A preceding retry is also a route marker because every provider change
* requires a newer full request-header snapshot.
* Request headers remain effective across turn boundaries until a newer full
* snapshot changes them. A preceding retry in the same turn is also a route
* marker because every provider change requires a newer full snapshot.
* @param events - session events containing the closed step.
* @param turn - turn that owns the failed step.
* @param step - failed step whose provider is required.
@@ -32,7 +33,6 @@ export function providerForClosedStep(
&& event.data.step < step) {
return event.data.provider
}
if (event.type === 'turn/start' || event.type === 'turn/end') return undefined
}
return undefined
}