-
-
Notifications
You must be signed in to change notification settings - Fork 10
Make headless authentication fail fast with truthful exit codes #698
Copy link
Copy link
Open
Labels
P1 stability-reliabilityNear-term stability, reliability, recovery, and safe sync behaviorNear-term stability, reliability, recovery, and safe sync behaviorauthAuthentication, sessions, cookies, Apple routing, and 2FAAuthentication, sessions, cookies, Apple routing, and 2FAbugSomething isn't workingSomething isn't workinginfraRuntime, services, reporting, metrics, distribution, and internal structureRuntime, services, reporting, metrics, distribution, and internal structure
Milestone
Description
Metadata
Metadata
Assignees
Labels
P1 stability-reliabilityNear-term stability, reliability, recovery, and safe sync behaviorNear-term stability, reliability, recovery, and safe sync behaviorauthAuthentication, sessions, cookies, Apple routing, and 2FAAuthentication, sessions, cookies, Apple routing, and 2FAbugSomething isn't workingSomething isn't workinginfraRuntime, services, reporting, metrics, distribution, and internal structureRuntime, services, reporting, metrics, distribution, and internal structure
Problem
Headless authentication does not have one reliable fail-fast contract.
The password and Apple auth layers detect a non-terminal stdin, but the initial
kei syncpath catchesTwoFactorRequiredand waits up to 10 minutes for another process to submit a code. That is useful for a long-running service, but it makes a one-shot command look hung to CI, cron, and agents.main_inneralso classifiesTwoFactorRequiredas exit 0. A foreground caller can therefore treat an incomplete login as success unless it parses log text.Other input paths are inconsistent:
kei password setalways prompts, even though the parent command exposes password-source options.kei reset statetreats non-TTY EOF as a successful cancellation. Require --yes for non-interactive reset state #679 tracks that specific reset bug.Proposed change
Define one input mode at startup and use it across login, sync, password management, reset, and setup.
kei login get-codeandkei login submit-code <CODE>flow.password setshould either accept a safe explicit source or reject headless use before invoking the terminal prompt.Acceptance criteria
submit-code.password sethas a documented scriptable path using a safe secret source, or fails immediately with an actionable message.Relevant owners:
src/lib.rs,src/password.rs,src/auth/,src/sync_loop.rs, andsrc/commands/service.rs.Reference: 10 Principles for Agent-Native CLIs