Agents: add fallback error observations (#41337)

Merged via squash.

Prepared head SHA: 852469c82f
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
Altay
2026-03-10 01:12:10 +03:00
committed by GitHub
parent 3c3474360b
commit 531e8362b1
17 changed files with 502 additions and 36 deletions

View File

@@ -199,6 +199,7 @@ export async function runAgentTurnWithFallback(params: {
const onToolResult = params.opts?.onToolResult;
const fallbackResult = await runWithModelFallback({
...resolveModelFallbackOptions(params.followupRun.run),
runId,
run: (provider, model, runOptions) => {
// Notify that model selection is complete (including after fallback).
// This allows responsePrefix template interpolation with the actual model.

View File

@@ -474,6 +474,7 @@ export async function runMemoryFlushIfNeeded(params: {
try {
await runWithModelFallback({
...resolveModelFallbackOptions(params.followupRun.run),
runId: flushRunId,
run: async (provider, model, runOptions) => {
const { authProfile, embeddedContext, senderContext } = buildEmbeddedRunContexts({
run: params.followupRun.run,

View File

@@ -159,6 +159,7 @@ export function createFollowupRunner(params: {
cfg: queued.run.config,
provider: queued.run.provider,
model: queued.run.model,
runId,
agentDir: queued.run.agentDir,
fallbacksOverride: resolveRunModelFallbacksOverride({
cfg: queued.run.config,