diff --git a/src/agent-runner-environment.ts b/src/agent-runner-environment.ts index 43b548e..6608b7f 100644 --- a/src/agent-runner-environment.ts +++ b/src/agent-runner-environment.ts @@ -184,9 +184,10 @@ function prepareCodexSessionEnvironment(args: { fs.mkdirSync(sessionCodexDir, { recursive: true }); const rotatedAuthSrc = getActiveCodexAuthPath(); - const authSrc = rotatedAuthSrc && fs.existsSync(rotatedAuthSrc) - ? rotatedAuthSrc - : path.join(hostCodexDir, 'auth.json'); + const authSrc = + rotatedAuthSrc && fs.existsSync(rotatedAuthSrc) + ? rotatedAuthSrc + : path.join(hostCodexDir, 'auth.json'); const authDst = path.join(sessionCodexDir, 'auth.json'); if (fs.existsSync(authSrc)) fs.copyFileSync(authSrc, authDst); for (const file of ['config.toml', 'config.json']) { diff --git a/src/codex-token-rotation.ts b/src/codex-token-rotation.ts index 185092d..f02932a 100644 --- a/src/codex-token-rotation.ts +++ b/src/codex-token-rotation.ts @@ -164,12 +164,20 @@ function loadCodexState(): void { } } if (Array.isArray(state.resetAts)) { - for (let i = 0; i < Math.min(state.resetAts.length, accounts.length); i++) { + for ( + let i = 0; + i < Math.min(state.resetAts.length, accounts.length); + i++ + ) { if (state.resetAts[i]) accounts[i].resetAt = state.resetAts[i]; } } if (Array.isArray(state.resetD7Ats)) { - for (let i = 0; i < Math.min(state.resetD7Ats.length, accounts.length); i++) { + for ( + let i = 0; + i < Math.min(state.resetD7Ats.length, accounts.length); + i++ + ) { if (state.resetD7Ats[i]) accounts[i].resetD7At = state.resetD7Ats[i]; } } diff --git a/src/message-agent-executor.ts b/src/message-agent-executor.ts index 17c1c55..9b21d3c 100644 --- a/src/message-agent-executor.ts +++ b/src/message-agent-executor.ts @@ -401,7 +401,10 @@ export async function runAgentForGroup( // Codex rate-limit rotation (non-Claude agents) if (!isClaudeCodeAgent && getCodexAccountCount() > 1) { const trigger = detectFallbackTrigger(output.error); - if (trigger.shouldFallback && rotateCodexToken(output.error ?? undefined)) { + if ( + trigger.shouldFallback && + rotateCodexToken(output.error ?? undefined) + ) { logger.info( { chatJid, group: group.name, runId, reason: trigger.reason }, 'Codex rate-limited, retrying with rotated account',