fix: sync refreshed OAuth tokens to process.env for container exec

Token refresh updated internal array and .env file but not process.env,
so docker exec -e kept injecting the stale startup token. Now syncs
to process.env after refresh. Container kill on refresh is no longer
needed since docker exec picks up the latest token each turn.
This commit is contained in:
Eyejoker
2026-03-31 13:34:21 +09:00
parent bfe164dece
commit 47d532e869
2 changed files with 15 additions and 39 deletions

View File

@@ -316,6 +316,16 @@ async function checkAndRefreshAll(): Promise<void> {
}
if (anyRefreshed) {
// Sync refreshed tokens to process.env so docker exec picks them up
const refreshedTokens = getAllTokens();
if (refreshedTokens.length > 0) {
process.env.CLAUDE_CODE_OAUTH_TOKEN = refreshedTokens[0].token;
if (refreshedTokens.length > 1) {
process.env.CLAUDE_CODE_OAUTH_TOKENS = refreshedTokens
.map((t) => t.token)
.join(',');
}
}
updateEnvTokens();
if (onTokenRefreshedCallback) {
try {