Repository navigation
feat: automatically choose inference for first-run setup - #169628
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 changesThis PR automatically selects available inference for first-run setup and offers separate sign-in when reusing a native Codex login. Example: A fresh Gateway has a Codex login in ~/.codex and no configured primary model.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: it supplies the maintainer-directed Gateway setup capability required by the landed desktop flows, and no actionable introduced code defect remains. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherDesktop onboarding calls a Gateway administrator RPC, which discovers available inference and delegates verification, installation, credential persistence, and config activation to existing owners. flowchart TD
A[Desktop setup card] --> B[Gateway administrator RPC]
B --> C[Retained requester authority]
C --> D[Inference discovery and ranking]
D --> E[Existing verification and activation]
E --> F[Plugin and credential owners]
E --> G[Config application and recovery]
G --> A
Technical reviewBest possible solution: Complete the existing Gateway-owned setup flow while preserving configured routes, explicit preferences, and live requester authority. Do we have a high-confidence way to reproduce the issue? This is an approved feature rather than a bug report; current main lacks its Gateway method, and the supplied evidence covers selected UI and activation scenarios. Is this the best way to solve the issue? The implementation reuses the existing ranking inputs, installer, authentication, and activation owners, with a coherent separate-login path and no demonstrated competing state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e4f463159d0a. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete remaining bypass was found, but the retained Gateway authority boundary still needs final-effect verification. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +737, Tests +1460, Docs +80. Total +2277 across 50 files. Added test files: 6. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 (12 earlier review cycles; latest 8 shown)
Reviewed October 12, 2026, 7:55 PM ET / 23:55 UTC (Revision 13). |
ab14798 to
66a7f84
Compare
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Reuse ranked detection, verified activation, and the official Codex installer for automatic first-run setup. Keep manual selection explicit and native conversation discovery disabled. Add the Gateway protocol and onboarding documentation.
034fadb to
e0843d8
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…9628) * feat(gateway): automatically select first-run inference Reuse ranked detection, verified activation, and the official Codex installer for automatic first-run setup. Keep manual selection explicit and native conversation discovery disabled. Add the Gateway protocol and onboarding documentation. * fix(setup): wait for applied inference and tolerate audit failures * fix(setup): allow plugin reload before requiring applied receipt * fix(setup): retain automatic setup authority and preferences * test(setup): tighten retained authority fixture types * fix(gateway): preserve advertised method ordering * fix(setup): fence capability and credential storage commits * fix(setup): reuse native Codex login without token import Reuse Codex user-home authentication for automatic setup, including API-key homes, and leave rotating OAuth credentials with Codex. Detect native login-file presence without reading token values. Include ordinary registered credentials in shared setup discovery and document the isolation choice. * test(setup): align live inference discovery fixture * feat(setup): offer separate sign-in for shared Codex * fix(setup): keep prepared Codex sign-ins on its runtime * test(setup): confirm isolated sign-in activation * test(setup): run credential authority proof with its host broker * fix(setup): retain requester authority through Codex repairs
What Problem This Solves
Fresh Gateway setup should use inference access already available on the host and explain how to keep a Codex login separate.
User Impact
openclaw.setup.autopreserves configured inference. Otherwise it verifies and activates available access in a deterministic order: saved OpenClaw profiles, stored Codex credentials, Claude CLI, OpenAI and Anthropic environment keys, then eligible loaded local models. If needed, it prepares official Codex support and offers the existing ChatGPT sign-in flow.Automatic Codex reuse uses the Gateway user's home without importing OAuth tokens; Codex owns authentication and refresh. The setup card now says “Using your existing Codex login · sessions shared with Codex” and offers Use a separate login. That action runs the existing wizard with the Gateway's advertised auth option, refreshes automatic setup after success, and removes the shared notice when the isolated agent home is active. Model Setup still offers a separate ChatGPT or OpenAI API-key sign-in. Manual inference selection stays explicit. Automatic setup does not enable native conversation discovery.
Why This Change Was Made
One Gateway ranking and activation owner handles detection, verification, credential staging, config application/recovery, managed installation, and authority checks. Automatic capability acceptance is restricted to the official Codex catalog entry and recorded through existing owners. The card consumes protocol types directly and reuses its existing wizard and connection guards; it adds no native-shell dependency or new credential owner.
Merged main, preserving its fresh-install progress window, local Gateway startup, dashboard card, native recovery, shell-neutral setup capability, asynchronous plugin metadata, and awaited credential rollback. The onboarding docs now describe that flow together with inference ranking, login sharing, and switching to a separate login. No new dependency or storage schema is added by this feature.
Evidence
Codex repair authority follow-up
Follow-up head:
5e34f0ab4b50eb004170fa7b70af8d50007c395c. Pushed once; PR remains open and ready for review. Exact-head ClawSweeper review reports Findings: None and explicitly resolves the previous Codex repair authority finding. It retains proof-only holds for the broader Gateway authority chain, fresh managed acquisition, and stable-version upgrade preservation. GitHub reports CONFLICTING with main; no fresh CI run has attached andopenclaw/ci-gateis PENDING. Security Review run 38320773973 passed. Conflict integration and broader proof disposition remain with the lead; no second push or merge was attempted.Recorded official Codex installations can enter Doctor repair before the later enable check. Both automatic preparation and candidate staging now bind the existing requester assertion to their enclosing plugin lifecycle lease, retaining it through nested repair and the index worker's transaction/commit admission. This uses the existing authority mechanism and adds no schema, dependency, or parallel authorization state. The follow-up is production +6/-3, regression tests +188/-0, and test-lane registration +1/-0.
The regression runs both setup entry points, the real recorded-install repair branch, Doctor, nested leases, and worker-backed SQLite persistence. Only package updating is synthetic. A deferred gate pauses the repair's index worker handoff; requester revocation must preserve the original persisted integrity fingerprint. Before the fix at
78beb378c881160d8f3688a5b4a1098416a83251, both revoked cases failed because the repaired fingerprint was published; both authorized controls passed. After the fix, all four cases pass. This is owning-boundary proof, not a live provider, package download, packaged-app, or whole-Gateway device-revocation trace.The four repair cases took 57.86s of reported test execution on the contended host; the wrapper wall time also includes compiling and verifying the runtime worker bundle. The real nested repair, retained authority, worker admission, and persisted result are the protected contract; a mocked persistence helper would not prove it. No timers, sleeps, polling, or Gateway boots were added to the regression.
Wall times include shared-host contention and waiting for the runtime artifact lock. The setup-card unit cases took 2.08s of reported test execution; browser cases took 31.17s through the actual route/wizard and screenshot owner. The existing activation file exercises credential/configuration transactions at their owning boundary.
Strict native translation checks are inherited failures:
native:i18n:checkfails with the identical eight missing macOS keys across 21 locales on this head (5.53s) and baseline worktreerepinata590510d0415ff9fa72b45a4331bf99c56280896(10.60s);apple:i18n:checkreports the same stale macOSLocalizable.xcstringscatalog on both (5.00s/7.25s). No native strings or catalogs changed in this PR. The initial core typecheck used stale local dependencies; canonical worktree preparation installed the locked versions, after which types passed.The shared-state unit regression failed on the original card in both
configuredandactivatedstates, while the existing needs-sign-in case passed. After the change all 14 setup-card cases pass. The browser proof uses the real Control UI route and wizard with a synthetic mock Gateway; it is boundary proof, not a native-app or live-provider run.Before: selected Codex without sharing information.
Shared: the existing login and separate-login action.
After separate sign-in: refreshed selection, sharing notice removed.
Prior isolated live proof at
b1d83b124bccefc6703048ade22fd5cdc5431cd6exercised CLI → Bun Gateway → Codex app-server/provider: automatic shared activation returnedshared: true, the separate-sign-in action, and user home scope; the agent repliedAUTO_OK; repeated setup returnedconfiguredwith unchanged config bytes/mtime; an empty Codex home returned isolatedneeds-sign-in. No credentials were imported into OpenClaw. This revision reruns the merge-affected owners; final packaged-app validation remains lead-owned.This revision adds deterministic requester-revocation proof through real Doctor repair and worker-backed SQLite publication. It does not claim an end-to-end device/operator revocation trace, fresh managed npm download, or published-version upgrade replay; those broader limitations remain for the lead's landing decision.
A later ClawSweeper review of the previous head identified a concrete Codex repair authority gap. This follow-up fixes that gap at the setup owner; the earlier revision-9 verdict is superseded. Current committed-branch independent autoreview is scoped-clean, with no actionable P0–P2 findings. Exact-head ClawSweeper and CI status for this follow-up are recorded at the start of this evidence section.
Previous-head CI run 38310089069 completed failure in 842s across 123 jobs, and
openclaw/ci-gateis failure. All Control UI, UI E2E, UI i18n, and performance jobs passed (UI shards 269/303/322s; E2E shards 206/291/283/255s; i18n 92s; performance 117s). The workflow classifier calls the three failed test jobsunknownbecause scheduled main has no matching jobs. Manual classification:users-preferences.test.ts(7 cases)session-sharing-committed-read.test.ts(5 cases)b70cab277ca2c5480117c3a2ecae09a54027ada0, 217.61s/221.69s. One unexpected worker message assertion and four profile-catalog-not-ready errors.install.npm-spec.e2e.test.ts, npm-pack successorFailed logs were fetched once and reused; no CI rerun, retry-only push, or timeout/expectation changes were made. The prior pass pushed once and left the PR open; no merge was attempted.
Before this follow-up, the prior lane recorded the diff against merged main
93087c17bfe94: production +930/-196; tests/support +1403/-132; docs +114/-34. The current repair delta is recorded above. The card integration itself is production +21/-18 and tests +100/-51. Release-note context: automatic first-run inference selection, native Codex login reuse, and a setup-card action for isolated sign-in.