From 1ae6089bb3b5e65b6041efd38aea8212cabc15c1 Mon Sep 17 00:00:00 2001 From: ismeth Date: Wed, 4 Mar 2026 00:40:18 +0100 Subject: [PATCH] fix(athena): restore opportunistic retry flow and include athena-junior builtin name --- src/agents/athena/non-interactive-prompt.ts | 5 ++++- src/config/schema/agent-names.test.ts | 11 +++++++++++ src/config/schema/agent-names.ts | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/agents/athena/non-interactive-prompt.ts b/src/agents/athena/non-interactive-prompt.ts index c93b284de..62d382067 100644 --- a/src/agents/athena/non-interactive-prompt.ts +++ b/src/agents/athena/non-interactive-prompt.ts @@ -67,7 +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). -- Repeat until ALL members reach terminal state. +- 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. ### 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") @@ -95,6 +97,7 @@ If retry_on_fail > 0 and failed members exist: 2. Return to Step 5 to wait for their completion via background_wait. 3. Call council_finalize again to collect retried results. 4. Continue retrying until retry count exhausted or quorum met. +- 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. diff --git a/src/config/schema/agent-names.test.ts b/src/config/schema/agent-names.test.ts index 17dc00c8b..6b210fdc4 100644 --- a/src/config/schema/agent-names.test.ts +++ b/src/config/schema/agent-names.test.ts @@ -35,6 +35,17 @@ describe("agent name schemas", () => { expect(result.success).toBe(true) }) + test("BuiltinAgentNameSchema accepts athena-junior", () => { + //#given + const candidate = "athena-junior" + + //#when + const result = BuiltinAgentNameSchema.safeParse(candidate) + + //#then + expect(result.success).toBe(true) + }) + test("OverridableAgentNameSchema accepts athena", () => { //#given const candidate = "athena" diff --git a/src/config/schema/agent-names.ts b/src/config/schema/agent-names.ts index c8d712e28..0ad8f55e2 100644 --- a/src/config/schema/agent-names.ts +++ b/src/config/schema/agent-names.ts @@ -13,6 +13,7 @@ export const BuiltinAgentNameSchema = z.enum([ "atlas", "sisyphus-junior", "athena", + "athena-junior", "council-member", ])