Repository navigation
fix(models): allow headless device-code login - #128457
gaoanze888 wants to merge 3 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 2:53 AM ET / 06:53 UTC. ClawSweeper reviewWhat this changesThe PR lets provider-declared headless-safe authentication methods run from Merge readinessThe focused repair is correct: non-TTY login remains fail-closed unless the resolved provider method explicitly opts in. The prior public-contract documentation finding is addressed; this PR now needs normal SDK-contract review and exact-head checks. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe models-auth CLI resolves a provider plugin and selected auth method, then runs it to persist an auth profile. OpenAI’s device-code method displays verification instructions, polls for external confirmation, and returns an OAuth profile. flowchart LR
A[Headless CLI command] --> B[Resolve provider and auth method]
B --> C{Headless-safe method?}
C -->|No| D[TTY-required error]
C -->|Yes| E[OpenAI device-code flow]
E --> F[Verification instructions]
F --> G[Saved OpenAI auth profile]
Decision needed
Why: The implementation is mechanically sound, but this exported capability determines when third-party provider code may bypass a core interactive-safety guard. Before merge
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +58. Total +75 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the generic provider-owned opt-in after accepting that SDK contract and confirming exact-head checks, while preserving the default TTY requirement for every method that does not opt in. Do we have a high-confidence way to reproduce the issue? Yes, by source: the documented OpenAI Is this the best way to solve the issue? Yes: resolving the requested method first and requiring explicit provider-owned eligibility is narrower and safer than allowing any method named device-code. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc64c5704a77. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. |
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Closes #113326
What Problem This Solves
Fixes an issue where
openclaw models auth login --provider openai --method device-codewas rejected in non-interactive shells before the provider-owned device-code flow could start.Why This Change Was Made
The non-TTY guard now resolves the requested provider and method first, then permits only methods whose provider-declared auth capability is
kind: "device_code". Other login methods, including a method whose id happens to bedevice-codebut is not a device-code capability, still require an interactive TTY.User Impact
Headless operators and agents can start provider device-code recovery from the CLI without weakening the TTY boundary for interactive provider auth flows.
Evidence
pnpm test src/commands/models/auth.test.tspnpm check:changed -- src/commands/models/auth.ts src/commands/models/auth.test.tsautoreview --mode local --engine pi --thinking high→ cleanRegression coverage includes both the accepted provider-declared
kind: "device_code"path and a same-id non-device OAuth method rejection.Redacted real command proof from this branch:
This proves the non-TTY command reaches the provider-owned OpenAI device-code flow instead of failing at
models auth login requires an interactive TTY. The actual provider network request was stopped by the local URL safety policy before any account code/token was exposed.AI-assisted implementation; I reviewed the auth guard change and validation output.