Refuse browser and pasted-callback logins under BASECAMP_NONINTERACTIVE
#681 gated interactive login on the explicit machine-output flags and left the environment half of #669 open: BASECAMP_NONINTERACTIVE=1 basecamp login still opened a browser (or, under SSH, printed a URL and read stdin for a pasted callback) and sat there for up to five minutes. The repo's own contract for the variable — "the CLI must not show interactive prompts regardless of TTY detection; they become actionable errors" (config.NonInteractiveEnv, SKILL.md) — is what this applies to login.
What
auth login/loginrefuse underBASECAMP_NONINTERACTIVEunless--device-codeis given. The check sits after the machine-output gate and before any network call, and its hint names the two headless shapes:--device-code, which prints a code to approve from any device and asks nothing of the terminal (the exception #681 argued for), and--with-token, plusauth statusfor a check. Same usage-error shape as the flag gate.- The pasted-callback prompt refuses under the variable too (
internal/auth). A device login on a Launchpad-backed host — every production account until the BC5 authorization server ships — falls back to remote mode, whose "Paste the callback URL" read is the one place a login consumes stdin. That prompt now returns the same actionable error before printing instructions, so the--device-codeexemption cannot route a harness into a stdin wait. - SKILL.md's auth block gains the one-line rule; no surface change.
Verification
- Failing first: on
main,TestAuthLoginRefusesNonInteractiveEnvWithoutDeviceCode(default,--remote,--local,--no-browser) andTestLoginRemoteModeRefusesNonInteractiveEnvdo not fail fast — they hang on the callback wait until the harness timeout, which is the reported behavior. With the gates they refuse withusage, nameBASECAMP_NONINTERACTIVE,--device-codeand--with-token, and the identity server sees no request; the remote test also asserts the paste prompt was never logged. TestAuthLoginDeviceCodeRunsUnderNonInteractiveEnvproves the exemption end-to-end: a pinned-issuer device grant under the variable prints the code and completes.- e2e:
auth.batscase for the env refusal (exit non-zero, hint names both flags). bin/cigreen on Linux (thelio, Go 1.26.7): fmt, vet, lint, unit, e2e, naming, surface, skill drift, bare groups, provenance, tidy.
Not doing here
- Gating on a non-terminal stdin without the variable: the remote paste read already errors at EOF, and the browser flows never read stdin.
- Bounding the device flow's poll with
signal.NotifyContext: separate from this gate.
Fixes #669
Summary by cubic
Fixes #669: basecamp auth login and basecamp profile create now refuse browser and pasted-callback logins under BASECAMP_NONINTERACTIVE instead of opening a browser or waiting up to five minutes on a pasted callback. --device-code remains the exception, but only where the server offers the device flow — Launchpad does not.
Changes
- The gate now runs at the command layer for both
auth loginandprofile create, plus again in the auth layer for every converging Launchpad shape, so the refusal happens before any network call, stdin read, or in-memory profile entry. LoginOptions.defaultstreats the variable as--no-browserfor every flow, so no login shape can launch a browser under it.- The usage error names
--device-codeand--with-token; SKILL.md documents the rule.