Repository navigation
feature(models): allow headless device-code auth login - #184579
nocodet888-arch wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesAllow provider-approved device-code login without terminal input while preserving existing model restrictions. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 2 items remain This PR addresses a documented headless-login failure that remains on current main; no concrete introduced bug was found, but the public capability needs an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe model-auth CLI selects a provider method, invokes its authentication flow, persists credentials through existing owners, and completes model-access handling. flowchart TD
A[Model auth CLI] --> B[Provider and method selection]
B --> C[CLI headless admission]
C --> D[Provider device authorization]
D --> E[Existing credential persistence]
E --> F[Gateway auth refresh]
F --> G[Keep model restrictions]
Technical reviewBest possible solution: Keep the focused CLI repair and existing persistence owners, subject to approval of the optional provider capability. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically rejects non-TTY device-code login before provider dispatch, despite the documented remote-login command; no target code or tests were run during this review. Is this the best way to solve the issue? The patch is a focused repair using existing authentication and model-policy owners, with explicit provider opt-in preferable to assuming every device-code method avoids prompts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b4e7ddf159ec. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +60, Tests +159, Docs 0. Total +219 across 7 files. Added test files: 0. 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. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 26, 2026, 7:56 PM ET / 23:56 UTC (Revision 3). |
|
@clawsweeper re-review Repaired for the three findings:
New head: |
b57231a to
2093efb
Compare
|
🦞👀 Re-review progress:
|
2093efb to
148c484
Compare
|
@clawsweeper re-review Rebased onto current |
|
🦞👀 Re-review progress:
|
Related: #113326
What Problem This Solves
openclaw models auth login --provider openai --device-codeis documented for remote/headless VMs, but non-TTY shells were rejected before the provider-owned device-code flow could start, so operators could not recover an expired Codex/OpenAI gateway profile without an interactive terminal.User Impact
When a provider marks an auth method
headless: true(OpenAI Codex--device-code/--method device-code), the terminal CLI can runmodels auth loginwithout a TTY if--providerand--methodresolve directly to that method. Interactive OAuth/API-key methods still require a TTY. Core and Gateway hosted login keep their caller-owned prompters (no stdin TTY requirement). After a successful headless CLI login, existing model-policy restrictions are kept without opening the consent picker.Why This Change Was Made
Headless admission is CLI-scoped only: shared
runModelsAuthLoginFlowCore/runModelsAuthLoginFlowForGatewayno longer inspectprocess.stdin.isTTY. The CLI resolves provider+method before admitting non-TTY execution, rejects unresolved CLI-backed provider fallback pickers, and completes model access inkeepmode so headless login cannot hang onprompter.select. OpenAI's device-code method opts into provider-ownedheadless.Evidence
src/plugins/provider-authentication.types.ts,extensions/openai/provider-contract-api.ts,src/commands/models/auth.ts,src/commands/models/auth-model-policy.ts,src/commands/models/auth.test.ts,src/commands/models/auth-model-policy.test.ts,docs/cli/models.mdnode scripts/run-vitest.mjs src/commands/models/auth.test.ts src/commands/models/auth-model-policy.test.ts— 46 + 8 passed (headless admission, CLI-backed picker rejection, fresh/imported keep-without-prompt, Core/Gateway hosted OAuth without TTY)Real behavior proof
Behavior or issue addressed
Non-TTY
models auth login --provider openai --device-codemust enter the provider device-code flow instead of failing with the interactive-TTY gate. Missing provider, unresolved CLI-backed providers, and non-headless methods must still refuse non-TTY shells before opening pickers. Hosted Core/Gateway OAuth must keep working without terminal stdin. Existing model restrictions must be preserved without a post-login picker on the headless CLI path.Canonical reachability path
Production CLI
modelsAuthLoginCommand→runModelsAuthLoginFlow(..., "cli")→ direct provider+method resolution → headless gate → OpenAIrunOpenAICodexDeviceCode. Hosted callers use"core"/"gateway"entrypoints and skip the stdin gate.Shared helper / provider constraint check
Adds optional
ProviderAuthMethod.headlessowned by the provider contract. Does not weaken TTY for interactive OAuth/API-key/setup-token. Does not change auth selection, persistence, or Gateway refresh ownership. Does not apply stdin policy inside shared Core/Gateway login.Real environment tested
Source CLI via
node --import ./scripts/tsx.mjs src/entry.tson Node 24.22.1; isolatedOPENCLAW_STATE_DIR; stdin not a TTY (</dev/null).Exact steps or command run after this patch
Evidence after fix
Remaining live-proof gap
This sandbox cannot complete a full OpenAI device authorization (SSRF policy blocks
auth.openai.com). Credential persistence after operator approval and a live restriction readback therefore remain covered by the focused regressions above (fresh + imported keep-without-prompt), not by a completed live login.Notes for reviewers
headlessopt-in shape, scopes TTY policy to the CLI adapter, and avoids the XL auth-file split from fix(auth): allow provider-owned headless login #155548.