Skip to content

Commit 045c2d6

Browse files
authored
Retry eval tasks if API instability detected (#9365)
1 parent 1fa12f6 commit 045c2d6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/evals/src/cli/runTask.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,23 @@ export const runTask = async ({ run, task, publish, logger }: RunTaskOptions) =>
217217
"diff_error",
218218
"condense_context",
219219
"condense_context_error",
220+
"api_req_retry_delayed",
221+
"api_req_retried",
220222
]
221223

224+
let isApiUnstable = false
225+
222226
client.on(IpcMessageType.TaskEvent, async (taskEvent) => {
223227
const { eventName, payload } = taskEvent
224228

229+
if (
230+
eventName === RooCodeEventName.Message &&
231+
payload[0].message.say &&
232+
["api_req_retry_delayed", "api_req_retried"].includes(payload[0].message.say)
233+
) {
234+
isApiUnstable = true
235+
}
236+
225237
// Publish all events except for these to Redis.
226238
if (!ignoreEvents.broadcast.includes(eventName)) {
227239
await publish({ ...taskEvent, taskId: task.id })
@@ -388,4 +400,8 @@ export const runTask = async ({ run, task, publish, logger }: RunTaskOptions) =>
388400
}
389401

390402
logger.close()
403+
404+
if (isApiUnstable) {
405+
throw new Error("API is unstable, throwing to trigger a retry.")
406+
}
391407
}

0 commit comments

Comments
 (0)