fix: fail fast on auth errors in non-interactive and agent contexts (#1537)
- Extract shouldAutoLogin(getEnv, stdinIsTerminal) helper in pkg/cmd so both login.go and root.go share the same logic: return true only when stdin is a real TTY and no AI agent env var is set - root.go isLoginRequiredError: replace bare DetectAIAgent check with shouldAutoLogin, covering CI/headless environments (non-TTY stdin) in addition to agent contexts; print actionable message to stderr and exit instead of blocking on a browser flow - login.go runLoginCmd: replace inline TTY+agent check with shouldAutoLogin - Redirect all auth error output to stderr consistently - Add TestShouldAutoLogin covering all four agent/no-agent × TTY/non-TTY cases Committed-By-Agent: claude Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
B
bernerd-stripe committed
e92423b0420491d686d2bebfd1484765796bffa2
Parent: 24386ab
Committed by GitHub <noreply@github.com>
on 4/8/2026, 5:57:39 PM