Исправить двойной логин Anthropic: убрать claude auth login, запускать claude напрямую
В Claude Code v2.x команда "claude auth login" запускает полный интерактивный TUI (включая "Welcome to Claude Code" и "Select login method"), а затем функция дополнительно вызывала claude "$@" — вторая сессия. Пользователь проходил выбор типа аккаунта дважды. Исправление: ветка [L] теперь запускает claude "$@" напрямую с нужными моделями и сразу делает return "$?", не допуская повторного вызова claude снизу функции. Claude сам обрабатывает весь auth flow (браузер → OAuth → выбор аккаунта) за одно взаимодействие. Добавлен тест test_fix8_no_double_login (3 проверки), итого 24/24. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -272,6 +272,38 @@ test_offer_reauth_enter_defaults_yes() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ── Fix8: no double login — [L] branch calls claude directly, not auth login ─
|
||||
test_fix8_no_double_login() {
|
||||
# [L] branch must NOT call "claude auth login"; must call claude directly and return.
|
||||
|
||||
# Find the line number of [Ll])
|
||||
local ll_line
|
||||
ll_line=$(grep -n '^\s*\[Ll\])' "$SCRIPT" | head -1 | cut -d: -f1)
|
||||
|
||||
# Extract the next 20 lines starting at [Ll]) — enough to cover the whole arm
|
||||
local ll_branch
|
||||
ll_branch=$(awk "NR>=$ll_line && NR<=$((ll_line+20))" "$SCRIPT")
|
||||
|
||||
# Check for actual invocation (not just a comment mentioning the command)
|
||||
if echo "$ll_branch" | grep -v '^\s*#' | grep -q 'claude auth login'; then
|
||||
fail "Fix8: [L] branch still calls 'claude auth login' — double login present"
|
||||
else
|
||||
ok "Fix8: [L] branch does NOT call 'claude auth login' (only mentions it in a comment)"
|
||||
fi
|
||||
|
||||
if echo "$ll_branch" | grep -qF 'return "$?"'; then
|
||||
ok "Fix8: [L] branch returns after launching claude (no fallthrough to outer call)"
|
||||
else
|
||||
fail "Fix8: [L] branch missing 'return \"\$?\"' — outer claude call still reached"
|
||||
fi
|
||||
|
||||
if echo "$ll_branch" | grep -q 'ANTHROPIC_MODEL='; then
|
||||
ok "Fix8: [L] branch sets model env vars before launching claude"
|
||||
else
|
||||
fail "Fix8: [L] branch missing model env vars"
|
||||
fi
|
||||
}
|
||||
|
||||
# ── bash syntax of the whole script ─────────────────────────────────────────
|
||||
test_script_syntax() {
|
||||
if bash -n "$SCRIPT" 2>&1; then
|
||||
@@ -283,6 +315,7 @@ test_script_syntax() {
|
||||
|
||||
# ── run all tests ─────────────────────────────────────────────────────────────
|
||||
test_script_syntax
|
||||
test_fix8_no_double_login
|
||||
test_fix1_export_api_key
|
||||
test_fix2_trap_return
|
||||
test_fix3_readiness_loop
|
||||
|
||||
Reference in New Issue
Block a user