diff --git a/src/message-agent-executor.ts b/src/message-agent-executor.ts index bb80d66..2a12dd9 100644 --- a/src/message-agent-executor.ts +++ b/src/message-agent-executor.ts @@ -35,7 +35,10 @@ import { getCodexAccountCount, markCodexTokenHealthy, } from './codex-token-rotation.js'; -import type { AgentTriggerReason, CodexRotationReason } from './agent-error-detection.js'; +import type { + AgentTriggerReason, + CodexRotationReason, +} from './agent-error-detection.js'; import { getTokenCount } from './token-rotation.js'; import type { RegisteredGroup } from './types.js'; @@ -409,7 +412,8 @@ export async function runAgentForGroup( retryOutput.status !== 'error' ) { trigger = { - reason: retryAttempt.streamedTriggerReason.reason as CodexRotationReason, + reason: retryAttempt.streamedTriggerReason + .reason as CodexRotationReason, }; lastRotationMessage = typeof retryOutput.result === 'string' @@ -422,8 +426,8 @@ export async function runAgentForGroup( const retryTrigger = retryAttempt.streamedTriggerReason ? { shouldRotate: true, - reason: - retryAttempt.streamedTriggerReason.reason as CodexRotationReason, + reason: retryAttempt.streamedTriggerReason + .reason as CodexRotationReason, } : detectCodexRotationTrigger(retryOutput.error); @@ -672,7 +676,8 @@ export async function runAgentForGroup( ) { return retryCodexWithRotation( { - reason: primaryAttempt.streamedTriggerReason.reason as CodexRotationReason, + reason: primaryAttempt.streamedTriggerReason + .reason as CodexRotationReason, }, output.error ?? output.result ?? undefined, ); diff --git a/src/streamed-output-evaluator.ts b/src/streamed-output-evaluator.ts index 5db3d4b..3b93fad 100644 --- a/src/streamed-output-evaluator.ts +++ b/src/streamed-output-evaluator.ts @@ -54,12 +54,12 @@ export function evaluateStreamedOutput( ) { const triggerReason: AgentTriggerReason | undefined = isClaudeUsageExhaustedMessage(output.result) - ? 'usage-exhausted' - : isClaudeOrgAccessDeniedMessage(output.result) - ? 'org-access-denied' - : isClaudeAuthExpiredMessage(output.result) - ? 'auth-expired' - : undefined; + ? 'usage-exhausted' + : isClaudeOrgAccessDeniedMessage(output.result) + ? 'org-access-denied' + : isClaudeAuthExpiredMessage(output.result) + ? 'auth-expired' + : undefined; if (triggerReason) { const newTrigger = nextState.streamedTriggerReason diff --git a/src/task-scheduler.ts b/src/task-scheduler.ts index 0fbd528..902a7a6 100644 --- a/src/task-scheduler.ts +++ b/src/task-scheduler.ts @@ -49,7 +49,10 @@ import { getCodexAccountCount, markCodexTokenHealthy, } from './codex-token-rotation.js'; -import type { AgentTriggerReason, CodexRotationReason } from './agent-error-detection.js'; +import type { + AgentTriggerReason, + CodexRotationReason, +} from './agent-error-detection.js'; import { getTokenCount, markTokenHealthy, @@ -520,7 +523,8 @@ async function runTask( retryAttempt.output.status !== 'error' ) { trigger = { - reason: retryAttempt.streamedTriggerReason.reason as CodexRotationReason, + reason: retryAttempt.streamedTriggerReason + .reason as CodexRotationReason, }; lastRotationMessage = typeof retryAttempt.output.result === 'string' @@ -533,8 +537,8 @@ async function runTask( const retryTrigger = retryAttempt.streamedTriggerReason ? { shouldRotate: true, - reason: - retryAttempt.streamedTriggerReason.reason as CodexRotationReason, + reason: retryAttempt.streamedTriggerReason + .reason as CodexRotationReason, } : detectCodexRotationTrigger( retryAttempt.attemptError || retryAttempt.output.error, @@ -618,7 +622,8 @@ async function runTask( const trigger = attempt.streamedTriggerReason ? { shouldRotate: true, - reason: attempt.streamedTriggerReason.reason as CodexRotationReason, + reason: attempt.streamedTriggerReason + .reason as CodexRotationReason, } : detectCodexRotationTrigger(error); if (trigger.shouldRotate) {