Repository navigation
feat(auth): import declared credentials during provider login - #142933
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: blocked before merge. Reviewed September 9, 2026, 6:48 AM ET / 10:48 UTC (Revision 5). ClawSweeper reviewWhat this changesProvider login can import an existing credential through a plugin-declared migration owner while preserving model settings and explicit login options. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 4 items remain This remains useful, protected work absent from inspected main. Earlier defects are addressed, but the prior channel account-selection decision remains unresolved; the latest commit changes only a test fixture. Priority: P2 Review scores
Verification
How this fits togetherProvider authentication serves both CLI sign-in and channel login commands. The new import path reads the selected credential source, saves an agent auth profile, and returns that profile to callers that may select it for subsequent requests. flowchart TD
A[CLI or channel login] --> B[Selected provider method]
B --> C{Import eligible?}
C -->|Yes| D[Policy-approved migration owner]
D --> E[Read and recheck source credential]
E --> F[Save and select auth profile]
C -->|No or unavailable| G[Interactive sign-in]
G --> F
Decision needed
Why: The shared login shortcut changes which account a channel session selects, and neither the supplied discussion nor the latest test-only commit establishes the intended behavior. Before merge
Agent review detailsSecurityNone. PR surfaceSource +713, Tests +664, Docs +25. Total +1402 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep plugin-owned CLI credential reuse while preserving explicit account choice for channel device-code login, with documented behavior for existing installations. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature proposal; source inspection establishes the changed channel path, but this review did not execute a channel login. Is this the best way to solve the issue? Unclear overall: reusing the migration owner is coherent, but extending automatic import to device-code callers needs an explicit account-selection decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 056d14028ff1. LabelsLabel 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 (4 earlier review cycles)
|
|
landpr-approve-unrelated-red |
|
Landed as 0d383e9 after a clean exact-head review and guarded merge.
Native sign-in/status/catalog ownership and removal of ordinary-read credential sync remain separate work. |
…aw#142933) Provider login can import an existing credential through the selected method's migration provider. For example, `openclaw models auth login --provider openai --method api-key` reuses a supported Codex file key without another paste prompt. The migration owner selects the declared item and credential kind, checks plugin policy before loading the artifact, and re-reads the credential before saving. Import preserves existing profiles and model settings. A matching OAuth profile must be usable at planning and again under the existing store lock. An expired match leads to renewed sign-in; expiry after planning fails closed. `--force`, `--profile-id`, and `--set-default` use normal sign-in. This uses the existing credential writer and changes no SQLite schema or table version. The approved method-level behavior includes device-code login: an eligible usable stored account may be reused by the shared channel caller, and that returned profile is selected for the session. Existing owner, private-context and account checks remain. Fresh pairing is used when import is unavailable. Live channel behavior is outside the captured CLI proof below. Validation: - Compiled baseline prompts for the existing key; the candidate imports without input and a fresh `models auth list --json` sees the profile. Paired source-file and full configuration observations remain unchanged. - Enabled-owner control imports. Disabled and denylisted controls show no opens of the selected artifact/source paths and no saved profile; their recorded timeout and cancellation remain explicit limits. `--set-default` takes fresh input and applies the provider recommendation. An API-key compatibility control preserves the existing OAuth profile, tokens and configuration. - Before the usability fix, the compiled CLI falsely reports import success for an expired local OAuth profile. After the fix, it requires renewal and reaches a device-code request, then exits1 with `EAI_AGAIN auth.openai.com` in the isolated environment. No cancellation input or completed vendor authentication is claimed. The usable-profile control reuses the existing profile, exits0 and preserves its tokens, configuration and source file. - Independent captured-observation validation passes all five required clauses at those limits. Native formatting, lint and commit hooks pass. The exact-head CI credential-import regressions pass. Optional public force/profile-id and race controls, inherited/shared-owner reuse, live account validity and other storage backends remain outside this proof. The affected commands use the original package from [CI34339642829](https://github.com/openclaw/openclaw/actions/runs/34339642829), build `cb74e7eefc9e9fe7cf87ded8bc568e8dc136cd2f`. All15 production PR files match `d74df581a8dc8863c428b213c8582b5f348b5e3e`; the later commit repairs only test setup. Full source/sibling comparison is retained. The nearby checkout makes the CLI banner show `9a7bbc1`; original package stamps remain unchanged. Earlier valid controls keep their original package identities. [Current CI34341630235](https://github.com/openclaw/openclaw/actions/runs/34341630235) is terminal with one unrelated failed child: [Telegram loopback reply](https://github.com/openclaw/openclaw/actions/runs/34341630235/job/102433708549), plus the aggregate gate. The failure follows successful session persistence and matches [an earlier separate candidate failure](https://github.com/openclaw/openclaw/actions/runs/34329028662/job/102393560836). The exercised model callback does not call login/import; its complete test/router/reply source matches the tested main parent. The low-level transport cause is unknown. [Standing unrelated-red approval](openclaw#142933 (comment)) records the exact run and head; final review and guarded merge remain required. This completes the explicit-import capability. Wider native sign-in/status/catalog ownership and removal of ordinary-read credential sync remain separate work. Co-authored-by: Ayaan Zaidi <[email protected]>
## Summary Native Codex sign-in now supplies model availability without copying its credentials into OpenClaw profiles. CLI, chat, status, and Gateway model controls use one prepared owner for per-model runtime eligibility, physical routes, and authentication mode. Selections are revalidated before session persistence. Native sign-in observations no longer masquerade as host-prepared credentials when the registered runtime evaluates model eligibility. Native credentials remain with Codex. Explicit profiles, account pins, authored routes, isolated agent homes, and remote server accounts retain their existing boundaries. Native local stdio uses the user home only when no prepared OpenClaw credential or explicit home selection owns the route. The separate Gateway authentication projection and ordinary-read Codex credential import are removed. Explicit import preserves the supported declared `openai:default` profile reference. Apply now rechecks inherited account identity and usability at the destination, so an account inserted under the same profile ID after planning cannot be silently replaced. Matching shared accounts stay inherited. Native authentication enumeration also follows the captured plugin generation, including an explicitly empty generation, instead of unrelated ambient registry state. Default local discovery asks the existing ordered-profile owner first and carries its selected profile and store into the shared client. Native login is the fallback when that owner selects no profile; an explicitly selected native home retains its authority. Stdio proxies keep the destination server’s account and model catalog. Local login probing and the native user-home default apply only to owned local stdio runtimes; proxy arguments from configuration and environment use the existing proxy classifier. Login-status probing also retains the official Node launcher prefix and native configuration arguments while removing the app-server transport suffix. Runtime verification rules are unchanged. ## Compatibility The approved native-owner cutover requires explicit import or reselection for old CLI-backed pins outside the supported declared default-profile recovery. The credential documentation describes that recovery. Existing explicitly isolated homes and remote connections retain their selection. No configuration key, protocol version, or SQLite schema is added. Dependency contract personally inspected in Codex at `e5769939113536eb72752660bf7d1903f799d198`: [`codex-rs/app-server-protocol/src/protocol/v2/account.rs:524`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/app-server-protocol/src/protocol/v2/account.rs#L524) (`GetAccountParams` and `GetAccountResponse`), [`codex-rs/app-server/src/request_processors/account_processor.rs:826`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/app-server/src/request_processors/account_processor.rs#L826) (managed refresh and client-supplied token login), and [`codex-rs/cli/src/login.rs:443`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/cli/src/login.rs#L443) (native login status). `account/read` supplies account identity; an unknown remote subscription mode remains unknown. [`codex-rs/cli/src/main.rs:1344`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/cli/src/main.rs#L1344) confirms that stdio proxy forwards to the selected Unix socket. ## Validation - Native Testbox: 300 selected tests passed across import/auth bridge, native login/logout, per-model choices, captured generation ownership, status, Gateway metadata, and CLI cleanup. - The inherited-account and captured-registry regressions failed before their fixes and pass afterward. - The registered-harness correction passed 60 focused tests. The proxy correction failed six regression cases before the fix, then passed all 76 focused tests. - The profile-owned discovery correction passed 18 catalog cases and two selected shared-client cases after two expected regression failures. The launcher correction passed 31 native/transport cases after its expected regression failure. - A required merge-conflict rebase retained all 17 PR patches. The auth-pin and selected-model setup tests passed all 23 cases on the rebased head; retained runtime captures keep their original tested build identities. - Formatting and syntax lint passed for each correction. Type checks and full CI run on GitHub. - Telegram Test Server commands on the compiled candidate: native runtime selection succeeds; status agrees; a missing explicit profile rejects without changing selection; verified native logout plus public catalog refresh rejects the native runtime. No inference requests were made. - Enabled-discovery proof with the real Codex binary selects the profile-owned catalog while native login is absent or different, and the native catalog for explicit user-home selection. An official Node-launcher control with no host profiles reports native auth and an available native model. Synthetic host-token cases retain vendor auth-rejection diagnostics; this proof establishes catalog ownership, not vendor credential validity. - Public interactive migration was paused at confirmation while a same-ID inherited account was inserted. A different account reports conflict; a matching usable account is reused; neither writes a child-local shadow. The unrelated shared profile and native source remain intact. - Public CLI migration preserves the declared `openai:default` reference, configured model, and native source bytes. Repeating import with a separate backup output retains one profile and reports no credential write. - Synthetic native credentials prove local command and ownership behavior; they do not establish vendor authentication or inference. Full GitHub CI and the exact-head landing review are tracked by the required checks and landing receipt. Related: #136257. Builds on explicit import from #142933. Discord #143322 is a separate consumer lane. Co-authored-by: Ayaan Zaidi <[email protected]>
…w#143588) ## Summary Native Codex sign-in now supplies model availability without copying its credentials into OpenClaw profiles. CLI, chat, status, and Gateway model controls use one prepared owner for per-model runtime eligibility, physical routes, and authentication mode. Selections are revalidated before session persistence. Native sign-in observations no longer masquerade as host-prepared credentials when the registered runtime evaluates model eligibility. Native credentials remain with Codex. Explicit profiles, account pins, authored routes, isolated agent homes, and remote server accounts retain their existing boundaries. Native local stdio uses the user home only when no prepared OpenClaw credential or explicit home selection owns the route. The separate Gateway authentication projection and ordinary-read Codex credential import are removed. Explicit import preserves the supported declared `openai:default` profile reference. Apply now rechecks inherited account identity and usability at the destination, so an account inserted under the same profile ID after planning cannot be silently replaced. Matching shared accounts stay inherited. Native authentication enumeration also follows the captured plugin generation, including an explicitly empty generation, instead of unrelated ambient registry state. Default local discovery asks the existing ordered-profile owner first and carries its selected profile and store into the shared client. Native login is the fallback when that owner selects no profile; an explicitly selected native home retains its authority. Stdio proxies keep the destination server’s account and model catalog. Local login probing and the native user-home default apply only to owned local stdio runtimes; proxy arguments from configuration and environment use the existing proxy classifier. Login-status probing also retains the official Node launcher prefix and native configuration arguments while removing the app-server transport suffix. Runtime verification rules are unchanged. ## Compatibility The approved native-owner cutover requires explicit import or reselection for old CLI-backed pins outside the supported declared default-profile recovery. The credential documentation describes that recovery. Existing explicitly isolated homes and remote connections retain their selection. No configuration key, protocol version, or SQLite schema is added. Dependency contract personally inspected in Codex at `e5769939113536eb72752660bf7d1903f799d198`: [`codex-rs/app-server-protocol/src/protocol/v2/account.rs:524`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/app-server-protocol/src/protocol/v2/account.rs#L524) (`GetAccountParams` and `GetAccountResponse`), [`codex-rs/app-server/src/request_processors/account_processor.rs:826`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/app-server/src/request_processors/account_processor.rs#L826) (managed refresh and client-supplied token login), and [`codex-rs/cli/src/login.rs:443`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/cli/src/login.rs#L443) (native login status). `account/read` supplies account identity; an unknown remote subscription mode remains unknown. [`codex-rs/cli/src/main.rs:1344`](https://github.com/openai/codex/blob/e5769939113536eb72752660bf7d1903f799d198/codex-rs/cli/src/main.rs#L1344) confirms that stdio proxy forwards to the selected Unix socket. ## Validation - Native Testbox: 300 selected tests passed across import/auth bridge, native login/logout, per-model choices, captured generation ownership, status, Gateway metadata, and CLI cleanup. - The inherited-account and captured-registry regressions failed before their fixes and pass afterward. - The registered-harness correction passed 60 focused tests. The proxy correction failed six regression cases before the fix, then passed all 76 focused tests. - The profile-owned discovery correction passed 18 catalog cases and two selected shared-client cases after two expected regression failures. The launcher correction passed 31 native/transport cases after its expected regression failure. - A required merge-conflict rebase retained all 17 PR patches. The auth-pin and selected-model setup tests passed all 23 cases on the rebased head; retained runtime captures keep their original tested build identities. - Formatting and syntax lint passed for each correction. Type checks and full CI run on GitHub. - Telegram Test Server commands on the compiled candidate: native runtime selection succeeds; status agrees; a missing explicit profile rejects without changing selection; verified native logout plus public catalog refresh rejects the native runtime. No inference requests were made. - Enabled-discovery proof with the real Codex binary selects the profile-owned catalog while native login is absent or different, and the native catalog for explicit user-home selection. An official Node-launcher control with no host profiles reports native auth and an available native model. Synthetic host-token cases retain vendor auth-rejection diagnostics; this proof establishes catalog ownership, not vendor credential validity. - Public interactive migration was paused at confirmation while a same-ID inherited account was inserted. A different account reports conflict; a matching usable account is reused; neither writes a child-local shadow. The unrelated shared profile and native source remain intact. - Public CLI migration preserves the declared `openai:default` reference, configured model, and native source bytes. Repeating import with a separate backup output retains one profile and reports no credential write. - Synthetic native credentials prove local command and ownership behavior; they do not establish vendor authentication or inference. Full GitHub CI and the exact-head landing review are tracked by the required checks and landing receipt. Related: openclaw#136257. Builds on explicit import from openclaw#142933. Discord openclaw#143322 is a separate consumer lane. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Login could prompt again for an existing supported credential or report successful reuse of an expired saved account.
Why This Change Was Made
The migration owner selects the method’s declared credential kind, checks plugin policy before reading, and rechecks usability before saving under the existing lock. Explicit force, profile selection, and default-changing requests use normal sign-in.
User Impact
Eligible credentials can be reused without another paste prompt, preserving profiles and model settings. Expired credentials require renewal. No schema change is required.
Evidence
Compiled CLI checks reproduced the extra prompt and expired-profile false success. Candidate checks imported a usable credential and exposed it through the public auth list without changing source/config data. The expired case reached renewal but failed on unavailable network resolution, so completed authentication is unverified. Credential-import regressions passed. Live channel reuse and account validity were outside the captured proof.