Repository navigation
fix(onboard): keep provider credentials with named first agents - #127572
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 6:06 PM ET / 22:06 UTC. ClawSweeper reviewWhat this changesThe PR stores first-agent onboarding credentials under the named agent and forwards that agent’s workspace through provider-choice discovery in interactive and noninteractive setup. Merge readinessKeep open: current main still resolves setup auth through the default target before a named first agent exists. This branch carries the pending target and workspace through interactive and noninteractive provider setup, and it addresses both findings from the prior review; no new blocking defect was found. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherOnboarding chooses an agent and workspace before provider authentication is persisted. That target controls provider discovery and the per-agent SQLite auth-profile database consumed by later model runs. flowchart LR
A[Onboarding options] --> B[Pending first agent]
B --> C[Setup target resolution]
C --> D[Provider choice normalization]
D --> E[Provider authentication]
E --> F[Per-agent auth profile]
F --> G[Configured model runs]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +247. Total +259 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical pending-first-agent target for empty rosters, retain existing explicit/authored roster ownership, and validate the rebased head with the focused onboarding and provider-choice tests plus the documented isolated CLI/SQLite flow. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main resolves the default target before named-agent creation, while the focused regressions model a workspace-only provider and named-agent auth target. The supplied PR body also describes isolated CLI and SQLite before/after runs, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. Carrying the pending first-agent identity through the existing setup-target owner repairs both credential persistence and workspace-scoped provider discovery without changing established explicit-roster ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75b736c25263. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…claw#127572) * fix(onboard): keep provider credentials with named first agents * fix(onboard): preserve workspace in provider choice normalization
What Problem This Solves
Fixes an issue where users onboarding their first agent with
--agent-nameand a provider credential would receive a successful setup result even though the credential was saved under the unrelatedmainagent. The named agent then had no auth profile for its configured model.Both
openclaw onboardandopenclaw setupwere affected in interactive and noninteractive flows. The failure reproduces with multiple provider plugins and with both plaintext credentials and SecretRefs.Why This Change Was Made
Onboarding prepares provider authentication before creating the first agent, which is required to avoid writing agent state when provider validation fails. Carry the authoritative pending first-agent identity and selected workspace through the existing shared setup-target owner instead of resolving the still-uncreated agent from runtime defaults.
Interactive setup determines first-agent provenance from the pre-migration source roster, so synthetic runtime
mainplaceholders cannot steal ownership. Noninteractive setup only supplies a pending identity when the original roster is empty. Existing explicit/system-agent fleets, authored minimalmainagents, staged provider-profile persistence, and provider workspace discovery keep their existing ownership contracts.Generic API-key, token, and setup-token provider normalization now retains that same selected workspace in both interactive and noninteractive setup. Interactive legacy-provider aliases and deprecated-provider guidance also resolve against the selected workspace while retaining the existing untrusted-plugin restriction. This addresses both actionable ClawSweeper findings and removes duplicated context construction.
User Impact
Naming a first agent during onboarding now stores provider credentials in that agent's own SQLite auth-profile database. Setup no longer creates an orphaned
maincredential database, and existing installations retain their configured agent ownership.Evidence
openclaw onboard --non-interactive --accept-risk --agent-name robby --auth-choice nvidia-api-key --nvidia-api-key <fixture> ... --jsonexited successfully with onlyrobbyconfigured, butnvidia:defaultexisted only inagents/main/agent/openclaw-agent.sqliteand therobbyauth database did not exist.nvidia:defaultonly inagents/robby/agent/openclaw-agent.sqlite; themaindatabase is absent and the configured/JSON workspace remains the requested workspace.onboardandsetup, NVIDIA and Gemini providers, plaintext and env-backed SecretRef profiles, normalized agent names, the defaultmainpath, and existing explicit/system-agent fleets.mainroster but forwards the normalized named agent ID, its canonical agent directory, and the exact selected workspace to the real provider-auth owner.agents.entries.main={}followed by onboarding with--agent-name robbyremains owned bymain, proving runtime placeholders and authored rosters are distinguished by authoritative provenance.--auth-choice apiKey --token-provider nvidiaonboarding now forwards the exact selected workspace while persisting its profile only under the named agent. Executable workspace-only provider fixtures cover generic API-key, token, and setup-token choices, plus workspace-scoped legacy/deprecated provider handling.oxfmt --check,oxlint --tsconfig tsconfig.json,git diff --check, and an offline TruffleHog scan. Independent Codex autoreview completed with no actionable findings.AI-assisted; all source, storage effects, provider ownership, and user-visible behavior were independently reviewed.