From a6e4132a8c33dbb7497ed31adee78affb16279cb Mon Sep 17 00:00:00 2001 From: Jim Dawdy Date: Sun, 10 May 2026 19:12:00 -0500 Subject: [PATCH] fix: preserve timeout reason after idle-only profile rotations Addresses Codex P3 review finding: when shouldRotateAssistant fires on idleTimedOut alone (timedOut=false), mergeRetryFailoverReason was passed timedOut: params.timedOut (false), so the accumulated retry reason did not record 'timeout'. Pass timedOut || idleTimedOut so the timeout reason survives idle-only rotations and downstream fallback_model receives the correct reason. --- src/agents/pi-embedded-runner/run/assistant-failover.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agents/pi-embedded-runner/run/assistant-failover.ts b/src/agents/pi-embedded-runner/run/assistant-failover.ts index 0e31f5e78b5f..98db9ce0aa14 100644 --- a/src/agents/pi-embedded-runner/run/assistant-failover.ts +++ b/src/agents/pi-embedded-runner/run/assistant-failover.ts @@ -176,7 +176,7 @@ export async function handleAssistantFailover(params: { lastRetryFailoverReason: mergeRetryFailoverReason({ previous: params.previousRetryFailoverReason, failoverReason: params.failoverReason, - timedOut: params.timedOut, + timedOut: params.timedOut || params.idleTimedOut, }), }; }