Skip to content

fix(linux): first-run desktop onboarding automatically connects working AI - #129211

Merged
steipete merged 6 commits into
mainfrom
codex/linux-tauri-onboarding-parity
Aug 25, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/linux-tauri-onboarding-parity

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Related #106337
Follows #128614
Builds on #108977

What Problem This Solves

Fixes an issue where Linux desktop users installing OpenClaw for the first time landed in onboarding without working AI access. Provider API keys present when launching the desktop app were lost at the systemd service boundary, and available model credentials were never automatically verified or activated.

Why This Change Was Made

The native companion now routes first installation directly to Model Setup. A dedicated first-run owner verifies an existing model or attempts detected, credentialed provider routes in Gateway order, only falls through definitive failures, and continues to guided onboarding after a verified activation. Restart-required activation waits for the replacement Gateway and verifies the exact committed model before continuing.

Linux Gateway installation accepts provider-declared, app-guided inference API keys only from bundled or independently verified official plugins and keeps them in owner-only systemd environment files. Crucially, genuinely new shell-provided keys remain operator-owned instead of being mislabeled as managed dotenv values: Gateway pre-bootstrap correctly removes stale managed dotenv credentials, so misclassifying a first-install provider key silently deleted it before detection. Removing an existing configuration-owned key's SecretRef retires the unchanged credential, while a genuinely different same-provider replacement supplied by the operator remains safely file-backed. Durable, operator-owned, and auth-profile-owned credentials retain their existing precedence and survive reinstalls.

User Impact

A Linux desktop launch with an available supported provider API key can finish AI setup automatically and enter guided onboarding with working inference. Existing configured models are live-verified before entering chat. Failed or unavailable setup remains visible and actionable; unrelated GitHub tokens, provider admin credentials, OAuth secrets, and keys requested by enabled third-party plugins are not copied into the Gateway service.

Evidence

  • Final PR head f404ac61fdc34e238649749814f358f38b5ca664 was canonically built and run on a real Linux/XFCE desktop using the actual native Tauri/WebKit application and a real OpenAI API key. The managed CLI reported (f404ac6); the systemd Gateway was active; gateway.systemd.env had mode 0600 and contained the provider credential without classifying it as a managed dotenv key. Existing configuration-owned credentials remain retired while deliberately rotated same-provider replacements survive.
  • On clean first setup, the untouched native desktop automatically advanced from /settings/model-setup?firstRun=1 to /custodian?onboarding=1 without selecting a provider or entering a credential. Actual Gateway logs recorded successful openclaw.setup.detect followed by openclaw.setup.activate; the live OpenAI Responses API independently returned HTTP 200 and model output. On exact final head, the real app automatically detected the configured OpenAI model, displayed Checking — asking openai/gpt-5.6-sol for a quick reply…, completed openclaw.setup.verify in 2565 ms, and navigated to /chat/main showing Inference is ready. and Verified model: openai/gpt-5.6-sol. Choosing Talk to my agent opened real chat, where the live assistant replied exactly LINUX_ONBOARDING_OK.
  • Focused Gateway/service startup regressions: 149 tests passed across the daemon-install and Gateway bootstrap suites, including first-install capture, malicious-plugin rejection, durable precedence, and failing-then-passing owner regressions for both removed configuration-owned keys and rotated same-provider replacements. The final owner fix drops unchanged retired credentials, captures genuinely different replacement values and unrelated new provider keys, and preserves existing stale-secret cleanup.
  • Focused Control UI and Gateway/service proof: 123 tests passed across two Vitest shards, covering candidate ordering, ambiguous transport failures, stale connection fencing, missing verification, exact-model restart handoff, secure provider-key selection, durable/auth-profile precedence, and enabled third-party plugin credential-capture rejection. Browser E2E proof passed 13 scenarios; native Rust proof passed 120 tests.
  • Independent structured review: clean, with no accepted/actionable findings. Scoped core/UI lint, assertion-safety and maximum-file-line ratchets, native Rust formatting, and changed-file formatting passed. Exact-head Linux App CI passed both the Linux companion build and macOS companion tests.

Before: real Linux desktop after a clean install

The baseline reaches Model Setup, but the desktop process's available OpenAI credential is missing from the managed Gateway and setup stalls on unrelated local-model choices.

Linux desktop onboarding before automatic AI setup

After: real native Linux desktop with automatically verified OpenAI inference

The actual Tauri/WebKit window reaches guided onboarding automatically and reports the live verified model without manual provider selection or API-key entry.

Linux desktop onboarding after automatically verifying a live OpenAI model

Live chat after onboarding

The same real Linux desktop handed off to the normal agent and completed an actual OpenAI-backed user-to-assistant chat round trip.

Linux desktop live OpenAI chat after automatic onboarding

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui commands Command implementations app: linux plugin: linux-node size: XL maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete force-pushed the codex/linux-tauri-onboarding-parity branch from 80a56af to fd7f865 Compare August 25, 2026 09:42
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 25, 2026, 7:21 AM ET / 11:21 UTC.

ClawSweeper review

What this changes

The PR sends Linux desktop first runs through automatic model verification and selectively copies eligible provider API keys into the managed Gateway service.

Regression provenance

Possible regression — suspected (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open: the latest head fixes the prior stale-key reclassification case but drops a newly supplied replacement key when it has the same provider environment-variable name as the retired managed key.

Priority: P1
Reviewed head: c8245c32e89fb097673c08985d6a975a0393bd30
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The live-proof claims are strong supplemental context, but the latest ownership repair has a concrete P1 gap.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its supplied native Linux and live-provider evidence remains useful supplemental context.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its supplied native Linux and live-provider evidence remains useful supplemental context.
Evidence reviewed 6 items Same-name replacement is filtered out: The new ambient-key collector marks every existing service key as owned by name, so a current shell OPENAI_API_KEY is excluded even when it differs from a retired managed OPENAI_API_KEY.
Install path gives the current shell value precedence: Reinstall merges preserved service values first and then overlays the invocation environment; the later candidate filter therefore loses the new same-name value rather than the old value.
Retired managed keys are removed at the final writer: Systemd drops prior managed keys before preserving operator-only values, so the omitted replacement is absent from the regenerated service environment.
Findings 1 actionable finding [P1] Preserve rotated same-provider credentials
Security None None.

How this fits together

The Linux Tauri companion installs a local Gateway and opens its Control UI. The installer decides which desktop credentials can enter the systemd service, then Model Setup verifies inference before onboarding or chat.

flowchart LR
  A[Desktop launch environment] --> B[Gateway service installer]
  B --> C[Credential ownership decision]
  C --> D[Systemd environment file]
  D --> E[Gateway bootstrap cleanup]
  E --> F[Model Setup verification]
  F --> G[Onboarding or chat]
Loading

Decision needed

Question Recommendation
Should this PR require the same-provider replacement-key repair before merge? Repair the same-provider rotation path: Treat a changed current shell key as a new file-backed operator credential while retaining deletion of the unchanged retired managed value.

Why: The diff changes credential ownership across the desktop, installer, and systemd boundary; the current behavior can silently remove a newly rotated credential on repair.

Before merge

  • Preserve rotated same-provider credentials (P1) - A previous managed OPENAI_API_KEY makes the new candidate filter reject the current shell key solely by name. On repair, the writer then removes the old managed key, so a rotated OpenAI key is lost instead of becoming an operator-owned file-backed credential; distinguish changed current values from inherited stale values and add that regression.
  • Resolve merge risk (P1) - A Linux reinstall or repair can remove a retired configuration-owned provider key and fail to adopt a deliberately rotated shell key for that same provider, leaving first-run inference unavailable.
  • Resolve merge risk (P2) - The bug-fix branch has a production net increase of about 404 lines; the new cross-boundary lifecycle is concrete justification, but the replacement-key repair should stay within that owner rather than add another fallback path.
  • Complete next step (P2) - A focused repair is clear, but this maintainer-labeled credential-boundary PR needs explicit maintainer handling before any automated branch work.

Findings

  • [P1] Preserve rotated same-provider credentials — src/commands/daemon-install-helpers.ts:195-201
Agent review details

Security

None.

PR surface

Source +397, Tests +801, Docs +6, Other +7. Total +1211 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 448 51 +397
Tests 5 849 48 +801
Docs 2 11 5 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 14 7 +7
Total 12 1322 111 +1211

Review metrics

Metric Value Why it matters
Production versus test delta production +404, tests +801, docs +6 The large test investment covers a new first-run and credential-ownership lifecycle; the remaining repair should be absorbed into its existing service-env owner.
Credential capture policy 1 added Linux-only ambient provider-key capture path It creates a new desktop-to-systemd credential boundary that must preserve upgrade and repair ownership semantics.

Stored data model

Persistent data-model change detected: persistent cache schema: ui/src/pages/model-setup/first-run-auto-setup.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Handle rotated provider keys before merge (recommended)
    Add the same-provider replacement regression and preserve a changed current shell value as file-backed while retiring only the unchanged managed value.
  2. Accept the recovery gap explicitly
    Maintain the current behavior only if maintainers accept that repair or reinstall can discard a newly rotated same-name provider credential.

Technical review

Best possible solution:

Preserve the retirement rule for an unchanged inherited managed value, but adopt a different current shell value for that same eligible provider as a new file-backed operator credential and cover that exact reinstall path.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: remove the config SecretRef, retain the old managed OPENAI_API_KEY in the service, then rerun repair with a different shell OPENAI_API_KEY; the current merge and candidate filters omit it.

Is this the best way to solve the issue?

No: the stale-key fix is incomplete because ownership is decided only by key name rather than whether the current shell value is a new replacement credential.

Full review comments:

  • [P1] Preserve rotated same-provider credentials — src/commands/daemon-install-helpers.ts:195-201
    A previous managed OPENAI_API_KEY makes the new candidate filter reject the current shell key solely by name. On repair, the writer then removes the old managed key, so a rotated OpenAI key is lost instead of becoming an operator-owned file-backed credential; distinguish changed current values from inherited stale values and add that regression.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8166cc01b94d.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P1: A normal Linux repair or reinstall can leave the default first-run route without usable provider inference after credential rotation.
  • merge-risk: 🚨 compatibility: The PR changes whether existing and newly supplied provider credentials survive managed-service regeneration.
  • merge-risk: 🚨 security-boundary: The PR decides which desktop environment credentials may cross into the owner-only systemd service environment.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its supplied native Linux and live-provider evidence remains useful supplemental context.

Evidence

What I checked:

  • Same-name replacement is filtered out: The new ambient-key collector marks every existing service key as owned by name, so a current shell OPENAI_API_KEY is excluded even when it differs from a retired managed OPENAI_API_KEY. (src/commands/daemon-install-helpers.ts:195, c8245c32e89f)
  • Install path gives the current shell value precedence: Reinstall merges preserved service values first and then overlays the invocation environment; the later candidate filter therefore loses the new same-name value rather than the old value. (src/cli/daemon-cli/install.ts:140, c8245c32e89f)
  • Retired managed keys are removed at the final writer: Systemd drops prior managed keys before preserving operator-only values, so the omitted replacement is absent from the regenerated service environment. (src/daemon/systemd-install.ts:434, c8245c32e89f)
  • Regression coverage misses the same-provider rotation: The new test proves that a fresh ANTHROPIC_API_KEY survives alongside a retired OPENAI_API_KEY, but not that a changed current OPENAI_API_KEY replaces the retired one. (src/commands/daemon-install-helpers.test.ts:757, c8245c32e89f)
  • Current main does not already contain this feature path: Current main retains the earlier Linux navigation that adds onboarding=1 and has no ambient provider-key collector; the central change remains unique to this open PR. (apps/linux/src-tauri/src/main.rs:146, 8166cc01b94d)
  • Latest-head provenance and release check: Blame attributes the candidate ownership logic to the latest PR commit; no local release tag contains that commit, so it is unshipped PR-head behavior. (src/commands/daemon-install-helpers.ts:199, c8245c32e89f)

Likely related people:

  • steipete: Current-head blame attributes the changed credential-selection logic and Linux navigation to this author; the related merged Linux companion work also lists the same author. (role: recent area contributor; confidence: high; commits: c8245c32e89f, f6aa7c24f1cf; files: src/commands/daemon-install-helpers.ts, apps/linux/src-tauri/src/main.rs)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a regression where a retired managed OPENAI_API_KEY is replaced by a different current shell OPENAI_API_KEY, and show it is retained as file-backed after reinstall or repair.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-25T09:47:47.814Z sha fd7f865 :: found issues before merge. :: [P1] Restrict ambient API-key import to a trusted provider set
  • reviewed 2026-08-25T10:15:09.680Z sha 51afce4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T11:01:38.510Z sha 512be49 :: found issues before merge. :: [P1] Preserve cleanup ownership for existing managed keys

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Aug 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The latest head fixes a real Linux first-run failure found with the native desktop and a live OpenAI key: ambient provider credentials remain protected in the systemd environment file but are correctly classified as operator-owned, so Gateway pre-bootstrap no longer removes them as stale managed dotenv values. Focused owner-boundary regressions, stale-secret cleanup, credential migration, and plugin trust restrictions pass.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The latest head directly resolves the previous P1: existing managed provider credentials are never reclassified as operator-owned after their configuration SecretRef is removed. The new owner-boundary regression first failed against the previous head, then passed after deleting the migration path: the retired managed OpenAI key is absent while a genuinely fresh Anthropic operator key remains protected and file-backed. All 148 focused daemon/Gateway bootstrap tests pass, stale-secret cleanup remains intact, and the PR now includes public-safe screenshots showing real automatic OpenAI onboarding plus an actual assistant chat response.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The latest head resolves both previous P1 findings together. A table-driven owner-boundary regression first failed for same-provider rotation, then passed after distinguishing unchanged inherited managed values from deliberately changed current shell values: an unchanged retired OpenAI key is removed, a rotated OpenAI replacement remains operator-owned and file-backed, and an unrelated fresh Anthropic key still works. All 149 focused daemon/Gateway bootstrap tests pass, stale-secret cleanup remains intact, and public-safe screenshots show real automatic OpenAI onboarding plus an actual assistant chat response.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 22fa9f5 into main Aug 25, 2026
252 checks passed
@steipete
steipete deleted the codex/linux-tauri-onboarding-parity branch August 25, 2026 11:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…ng AI (openclaw#129211)

* fix(linux): make desktop AI onboarding work automatically

* fix(linux): harden provider ownership and onboarding lifecycle

* test(ui): document partial onboarding context fixture

* fix(linux): preserve operator-owned onboarding API keys

* fix(linux): retire previously managed provider credentials

* fix(linux): retain rotated onboarding provider credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: linux app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. plugin: linux-node rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant