From 11f6712ddea99a89c547c5ec25d78834f4eb1e38 Mon Sep 17 00:00:00 2001 From: ismeth Date: Wed, 4 Mar 2026 01:36:43 +0100 Subject: [PATCH] fix(athena): add termination guards to non-interactive retry loop --- src/agents/athena/non-interactive-prompt.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agents/athena/non-interactive-prompt.ts b/src/agents/athena/non-interactive-prompt.ts index 62d382067..1139cab82 100644 --- a/src/agents/athena/non-interactive-prompt.ts +++ b/src/agents/athena/non-interactive-prompt.ts @@ -67,9 +67,9 @@ Track every task_id from the response for use in Step 5. - Parse returned metadata JSON for member states. - If a member's elapsed runtime exceeds {MEMBER_MAX_RUNNING_SECONDS}, mark as failed (timeout). - If a member is idle and last_activity_s > {STUCK_THRESHOLD_SECONDS}, mark as failed (stuck). -- If retry_failed_if_others_finished is false AND any members are failed while at least one other member is still non-terminal, jump to Step 9 immediately for opportunistic retries, then return to Step 5. -- If retry_failed_if_others_finished is true, continue until ALL members reach terminal state before Step 6. -- If retry_failed_if_others_finished is false and no retry candidates exist yet, continue tracking until more status updates arrive. +- If ALL members are now terminal (completed/error/cancelled/marked failed), proceed to Step 6 immediately. +- If retry_failed_if_others_finished is false AND retry_on_fail > 0 AND any members are failed while at least one other member is still non-terminal, jump to Step 9 immediately for opportunistic retries, then return to Step 5. +- Otherwise, continue tracking until one of the above conditions is met. ### Step 6: Collect results with council_finalize. - Call: council_finalize(task_ids=[...], name="{topic-slug}", intent="{intent}", question="{original question}", prompt_file="{path from Step 4.1}", mode="non-interactive") @@ -100,6 +100,7 @@ If retry_on_fail > 0 and failed members exist: - If retry_failed_if_others_finished is false, retry opportunistically as soon as failures are detected while others are still running. - If retry_failed_if_others_finished is true, only retry after all non-failed members have completed. - If cancel_retrying_on_quorum is true, stop retrying once quorum (2+ successful) is met. +- If retry_on_fail is 0, no failed members remain, or retry budget is exhausted, do NOT re-launch members; proceed to Step 10. ### Step 10: Synthesize using council_finalize runtime guidance. - Read every member's archive_file with Read tool.