refactor: run Claude and Codex on one fixed account each
The deployment has a single Claude OAuth credential and a single Codex ChatGPT account, so the N-account rotation machinery only added state files, cooldown bookkeeping and code paths that never ran. Removed: - Claude token rotation (token-rotation.ts, token-rotation-base.ts): rotate-on-limit, per-token cooldowns, token-rotation-state.json. CLAUDE_CODE_OAUTH_TOKENS is still read, but only its first entry. - Codex account rotation (codex-token-rotation.ts): account pool, rotate-on-429/auth, dead-auth/cooldown tracking, round-robin advance, d7 auto-rotate, codex-rotation-state.json, manual account switch. - Account index plumbing in token-refresh, claude-credentials-path (CLAUDE_ACCOUNTS_DIR / ~/.claude-accounts/<n>), Claude/Codex usage collectors, the dashboard rows and the Codex warm-up. - provider-retry.ts rotation loops and the Codex retry path. Kept: - Codex exclusive auth lease (one Codex run at a time), the 15-minute waitForCodexAuthLease, and a usage-poll lease that skips while a run holds the account (codex-auth.ts). - Session auth copy and write-back of refreshed tokens (syncCodexSessionAuthBack, syncClaudeSessionAuthBack). - Codex auth path: ~/.codex-accounts/0/auth.json, else ~/.codex/auth.json (now resolved per run, so a re-login needs no restart). - Claude token refresh loop, CLAUDE_CREDENTIALS_PATH and the CLAUDE_TOKEN_REFRESH_* / CLAUDE_USAGE_USE_HOME_CREDENTIALS flags; an auth-expired run still force-refreshes the token and retries once. - Error classification (classifyClaudeTrigger, classifyCodexTrigger). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
# codex_relogin.sh — Codex(ChatGPT) 계정을 device-code OAuth 로 재로그인한다.
|
||||
#
|
||||
# 사용법:
|
||||
# ./codex_relogin.sh # 기본 슬롯(0) 재로그인
|
||||
# ./codex_relogin.sh 1 # ~/.codex-accounts/1 슬롯 재로그인
|
||||
# ./codex_relogin.sh
|
||||
#
|
||||
# 참고:
|
||||
# * Codex 로그인은 이 호스트에서 두 봇(EJClaw / KAClaw)이 "공유"한다.
|
||||
# 계정 저장 위치가 폴더별이 아니라 ~/.codex-accounts/{n} 이기 때문.
|
||||
# 계정 저장 위치가 폴더별이 아니라 ~/.codex-accounts/0 이기 때문.
|
||||
# → 한 번만 재로그인하면 두 봇 모두에 반영된다.
|
||||
# * codex CLI 가 URL + 일회용 코드를 출력한다(15분 유효). 브라우저에서
|
||||
# 로그인/코드입력을 마치면 codex 가 auth.json 을 자동 저장한다.
|
||||
@@ -31,18 +30,11 @@ if [ -z "$CODEX" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- 대상 슬롯 결정 --------------------------------------------------------
|
||||
# 앱은 ~/.codex-accounts/{n}/auth.json 를 읽는다. 없으면 ~/.codex 로 폴백.
|
||||
SLOT="${1:-0}"
|
||||
ACCOUNTS_DIR="$HOME/.codex-accounts"
|
||||
if [ -d "$ACCOUNTS_DIR/$SLOT" ]; then
|
||||
CODEX_TARGET="$ACCOUNTS_DIR/$SLOT"
|
||||
elif [ -d "$ACCOUNTS_DIR" ] && ls -d "$ACCOUNTS_DIR"/[0-9]* >/dev/null 2>&1; then
|
||||
echo "❌ 슬롯 '$SLOT' 이(가) 없습니다. 사용 가능한 슬롯:" >&2
|
||||
ls -d "$ACCOUNTS_DIR"/[0-9]* 2>/dev/null | sed 's#.*/# - #' >&2
|
||||
exit 1
|
||||
# --- 대상 위치 결정 --------------------------------------------------------
|
||||
# 앱은 ~/.codex-accounts/0/auth.json 를 읽는다. 없으면 ~/.codex 로 폴백.
|
||||
if [ -d "$HOME/.codex-accounts/0" ]; then
|
||||
CODEX_TARGET="$HOME/.codex-accounts/0"
|
||||
else
|
||||
# accounts 디렉터리가 비어있으면 기본 codex home 사용
|
||||
CODEX_TARGET="$HOME/.codex"
|
||||
fi
|
||||
export CODEX_HOME="$CODEX_TARGET"
|
||||
|
||||
Reference in New Issue
Block a user