fix(agent): capture compaction retry AbortError for model fallback

Wrap waitForCompactionRetry() in try/catch to capture AbortError
that was escaping and bypassing the model fallback mechanism.

When a timeout fires, session.abort() causes both session.prompt()
and waitForCompactionRetry() to throw AbortError. Previously only
the prompt error was captured, allowing the compaction error to
escape to model-fallback.ts where it was immediately re-thrown
(line 199: isAbortError check), bypassing fallback model attempts.

Fixes #313
This commit is contained in:
Erik
2026-01-06 19:34:54 -03:00
committed by Peter Steinberger
parent 5da8258614
commit cd4e2023ab

View File

@@ -923,7 +923,7 @@ export async function runEmbeddedPiAgent(params: {
try {
await waitForCompactionRetry();
} catch (err) {
// Capture AbortError from waitForCompactionRetry to enable fallback/rotation
// Capture AbortError from waitForCompactionRetry to enable fallback/rotation.
if (isAbortError(err)) {
if (!promptError) promptError = err;
} else {