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:
@@ -923,7 +923,7 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
try {
|
try {
|
||||||
await waitForCompactionRetry();
|
await waitForCompactionRetry();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Capture AbortError from waitForCompactionRetry to enable fallback/rotation
|
// Capture AbortError from waitForCompactionRetry to enable fallback/rotation.
|
||||||
if (isAbortError(err)) {
|
if (isAbortError(err)) {
|
||||||
if (!promptError) promptError = err;
|
if (!promptError) promptError = err;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user