From aa6b92752cee17c8019cd6bc4ce4bc7ce4cb0c2e Mon Sep 17 00:00:00 2001 From: ejclaw Date: Mon, 6 Apr 2026 20:38:38 +0900 Subject: [PATCH] Format retry rule refactor files --- src/message-agent-executor.ts | 17 +++++++++-------- src/provider-retry.test.ts | 4 +++- src/provider-retry.ts | 5 +---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/message-agent-executor.ts b/src/message-agent-executor.ts index 48ab6d5..01378f3 100644 --- a/src/message-agent-executor.ts +++ b/src/message-agent-executor.ts @@ -44,9 +44,7 @@ import { resolvePairedFollowUpQueueAction, } from './message-agent-executor-rules.js'; import { buildRoomRoleContext } from './room-role-context.js'; -import { - type AgentTriggerReason, -} from './agent-error-detection.js'; +import { type AgentTriggerReason } from './agent-error-detection.js'; import { runClaudeRotationLoop, runCodexRotationLoop, @@ -759,9 +757,7 @@ export async function runAgentForGroup( const getPairedExecutionStatus = (): 'succeeded' | 'failed' => pairedExecutionStatus; - const isRetryableClaudeSessionFailure = ( - attempt: AgentAttempt, - ): boolean => + const isRetryableClaudeSessionFailure = (attempt: AgentAttempt): boolean => isRetryableClaudeSessionFailureAttempt({ attempt, isClaudeCodeAgent, @@ -771,7 +767,10 @@ export async function runAgentForGroup( const recoverRetryableClaudeSessionFailure = async ( attempt: AgentAttempt, - ): Promise<{ attempt: AgentAttempt; resolved: 'success' | 'error' | null }> => { + ): Promise<{ + attempt: AgentAttempt; + resolved: 'success' | 'error' | null; + }> => { if (!isRetryableClaudeSessionFailure(attempt)) { return { attempt, resolved: null }; } @@ -916,7 +915,9 @@ export async function runAgentForGroup( // success-null-result with no visible output — agent returned nothing useful. // But if output was already delivered to Discord (sawOutput), treat as success. if (attempt.sawSuccessNullResultWithoutOutput && !attempt.sawOutput) { - log.error('Agent returned success with null result and no visible output'); + log.error( + 'Agent returned success with null result and no visible output', + ); return 'error'; } diff --git a/src/provider-retry.test.ts b/src/provider-retry.test.ts index 4809b16..7835af8 100644 --- a/src/provider-retry.test.ts +++ b/src/provider-retry.test.ts @@ -229,7 +229,9 @@ describe('runCodexRotationLoop', () => { it('continues rotation when streamed trigger arrives before visible output', async () => { vi.mocked(getCodexAccountCount).mockReturnValue(2); - vi.mocked(rotateCodexToken).mockReturnValueOnce(true).mockReturnValueOnce(false); + vi.mocked(rotateCodexToken) + .mockReturnValueOnce(true) + .mockReturnValueOnce(false); let attempts = 0; const outcome = await runCodexRotationLoop( diff --git a/src/provider-retry.ts b/src/provider-retry.ts index f19081b..52dfeea 100644 --- a/src/provider-retry.ts +++ b/src/provider-retry.ts @@ -344,10 +344,7 @@ export async function runCodexRotationLoop( let trigger = initialTrigger; let lastRotationMessage = rotationMessage; - while ( - getCodexAccountCount() > 1 && - rotateCodexToken(lastRotationMessage) - ) { + while (getCodexAccountCount() > 1 && rotateCodexToken(lastRotationMessage)) { logger.info( { ...logContext, reason: trigger.reason }, 'Codex account unhealthy, retrying with rotated account',