Skip to content

fix: Local AI fails to start after first setup - #1208

Open
TheAngryPit wants to merge 1 commit into
openclaw:mainfrom
TheAngryPit:codex/fix-local-ai-first-start-null-endpoint
Open

fix: Local AI fails to start after first setup#1208
TheAngryPit wants to merge 1 commit into
openclaw:mainfrom
TheAngryPit:codex/fix-local-ai-first-start-null-endpoint

Conversation

@TheAngryPit

@TheAngryPit TheAngryPit commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Related: #1178

What Problem This Solves

Fixes an issue where users who completed a fresh managed Local AI setup could not start the runtime from the Tray because the first quiesce required a verified endpoint that is only recorded after llama-server starts successfully.

Why This Change Was Made

A provider-absent first start may safely quiesce before an endpoint exists. Existing providers still require the verified endpoint and exact ownership match before any mutation. Catalog/alias qualification, primary ownership, and fallback validation remain fail-closed.

User Impact

Fresh managed Local AI installations can proceed to their first start instead of entering Failed with every runtime control disabled.

Evidence

  • Failed-first disposable Windows/WSL reproduction acquired the managed model, then the Tray logged The verified Local AI endpoint is required, never launched llama-server, and disabled Start/Stop/Restart/Logs.
  • New catalog and alias tampering regressions failed before the final qualification fix.
  • Focused coordinator suite: 19/19 passed on this exact tree.
  • Repository-required ./build.ps1: passed.
  • Full Shared suite: 3,812 passed, 32 skipped, 0 failed (3,844 total).
  • Complete Tray suite: 2,709 passed, 0 skipped, 0 failed.
  • CI at exact head: all required test, E2E, win-x64, win-arm64, hygiene, and setup-gate checks passed; no failed or pending checks.
  • Exact-head disposable native Windows/WSL proof: 1/1 passed in 7m48s.
  • git diff --check: clean apart from line-ending notices.
  • Independent exact-diff review: no actionable findings.
  • openclaw-autoreview with gpt-5.6-sol high: clean, patch correct (0.97), no actionable correctness or security findings.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Validation

  • ./build.ps1 — PASS
  • Full OpenClaw.Shared.Tests — PASS, 3,812 passed / 32 skipped / 0 failed
  • Full OpenClaw.Tray.Tests — PASS, 2,709 passed / 0 skipped / 0 failed
  • Focused LocalAiGatewayProviderCoordinatorTests — PASS, 19/19
  • Exact-head native LocalAiInstalledRuntimeAvailabilityProofTests.PriorQualifiedInstall_CurrentUnavailableHardware_KeepsHealthyInstalledActionsAvailable — PASS, 1/1 in 7m48s

Real Behavior Proof

  • Environment tested: disposable Windows 11 app data plus an isolated WSL Gateway; no production Companion, Gateway, settings, credentials, pairings, or existing distros were used or changed.
  • PR head tested: de890ce876b8476846cbea997c3cc0d3f43af830
  • Exact executable SHA-256: C14241FE7F8BEDABE8D5EE93977C83EC1596A6F97F8B9556443AB7514D780266
  • Exact path exercised: persist a fresh qualified managed Local AI install with no endpoint, launch the exact candidate Tray, let its real background first-start lifecycle quiesce the absent provider, start the managed llama process, persist the verified loopback endpoint, and expose the installed controls.
  • Observed result: Start disabled; Stop, Restart, Open logs, and Open chat enabled; Retry absent; no action error. The route was background-autostart.
  • Runtime provenance: llama.cpp b10488-cuda13-x64, model qwen3.5-9b-mtp-q4-k-m, expected acquisition 6,406,621,974 bytes; all pinned asset hashes matched the qualified manifest.
  • Cleanup: exact Tray and managed llama processes absent, isolated Tray and Gateway roots removed, Gateway disposed, exact temporary WSL distro unregistered. Port-connectivity checks remained diagnostic-only; identity-bound process/root/distro cleanup gates passed.
  • Redacted evidence hashes:
    • UI state JSON: 3310D8DBE6300E0399CE820A154F8CFAD5F8F1B0156F9801EF95BCFF3AB3CB69
    • Redacted native screenshot: B756A11BF0185E9EBC47389424EC4DD4C1B3395090363EC7AC99EAB43330EEE6
    • Proof provenance JSON: 31544D40D407F83EF352DBE8D4D2F5D65E3A671926BE859C3E1D32A474881921
  • Screenshot or artifact links verified? (Yes/No/N/A): Yes, inspected locally; only the redacted state/provenance and their hashes are published here. Raw logs, private paths, endpoints, IDs, tokens, and credentials are excluded.
  • Not claimed by this PR: LocalAiUnavailableInfoBar visibility. That banner behavior belongs to the separate Preserve installed Local AI runtime controls #1206 UI lane and was diagnostic-only in this proof.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Aug 22, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 22, 2026
@clawsweeper

clawsweeper Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 22, 2026, 6:31 PM ET / 22:31 UTC.

ClawSweeper review

What this changes

The PR allows a fresh managed Local AI installation with no saved endpoint to quiesce an empty gateway route before its first llama-server launch, while preserving validation for existing routes.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer merge review. Current main still blocks the first Local AI launch before it can create its verified endpoint; this focused branch fixes that path without weakening existing-provider checks.

Priority: P2
Reviewed head: de890ce876b8476846cbea997c3cc0d3f43af830

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A compact, well-tested repair with exact-head native behavior proof and no actionable review finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.
Evidence reviewed 6 items Current-main root cause: Current main builds provider JSON before launch, and that builder requires a verified endpoint, while the runtime quiesces before starting llama-server.
Narrow branch fix: The branch validates the qualified model and fallback first, then requires endpoint-backed provider JSON only when a provider already exists.
Regression coverage: New coordinator tests cover the endpoint-less empty route, existing-provider preservation, invalid model metadata, and managed-primary fallback restoration.
Findings None None.
Security None None.

Live Verification

Command: dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --filter FullyQualifiedName~LocalAiGatewayProviderCoordinatorTests

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

Assertions:

  • FAIL expect_output: Passed!

How this fits together

Tray startup creates the Local AI runtime, which first inspects and temporarily quiesces the app-owned WSL Gateway route before launching llama-server. Once the server proves its loopback endpoint, the runtime persists it and publishes the gateway provider.

flowchart LR
A[Saved Local AI install] --> B[Tray runtime startup]
B --> C[Inspect app-owned gateway route]
C --> D{Provider exists?}
D -->|No| E[Launch managed llama server]
D -->|Exact managed route| F[Quiesce route]
F --> E
E --> G[Verify loopback endpoint]
G --> H[Publish gateway provider]
Loading

Before merge

  • Resolve merge risk (P1) - Merging changes how an endpoint-less, provider-absent persisted gateway state is handled; existing-provider drift remains fail-closed, but this compatibility boundary merits the supplied native proof review.
  • Complete next step (P2) - No discrete repair remains; this PR is ready for ordinary maintainer merge review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and regression coverage production +21/-10, tests +118 across 3 files The behavioral exception is concentrated in two lifecycle helpers and is accompanied by focused preservation and tampering coverage.

Root-cause cluster

Relationship: canonical
Canonical: #1208
Summary: This PR is the concrete repair for a first-start lifecycle gap in the merged Local AI feature.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the bounded startup compatibility change (recommended)
    Merge the branch because its new path applies only when no provider exists and retains fail-closed behavior for an existing provider.

Technical review

Best possible solution:

Merge the focused coordinator change after normal maintainer review, retaining the model qualification, fallback validation, and exact existing-provider match checks.

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

Yes. Current main calls quiesce before launching llama-server, but unconditionally requires the endpoint that only becomes available after that launch; the PR also documents an exact-head native reproduction.

Is this the best way to solve the issue?

Yes. Conditioning endpoint construction on an existing provider is the narrowest fix because it preserves qualification and drift checks while unblocking the empty first-start state.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded first-run Local AI startup defect rather than a broad runtime outage.
  • merge-risk: 🚨 compatibility: The PR deliberately changes lifecycle behavior for persisted gateway configuration that has no provider and no endpoint.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies exact-head redacted native Windows/WSL live output showing the previously blocked first start reach a verified loopback endpoint and healthy installed controls.

Evidence

What I checked:

Likely related people:

  • joelagnel: The merged Local AI feature introduced the current coordinator and provider-definition behavior; blame assigns the relevant main lines to its merge commit. (role: initial feature author; confidence: high; commits: ccd64bbb7d68; files: src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayProviderCoordinator.cs, src/OpenClaw.Connection/LocalAi/LocalAiGatewayProviderDefinition.cs)

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 (1 earlier review cycle)
  • reviewed 2026-08-22T20:28:35.140Z sha de890ce :: needs real behavior proof before merge. :: none

@TheAngryPit

Copy link
Copy Markdown
Contributor Author

Exact-head validation and redacted native behavior proof are now complete for de890ce876b8476846cbea997c3cc0d3f43af830.

Fresh qualified install persisted without an endpoint completes its first managed Local AI start, persists a loopback endpoint, launches the managed llama process, and exposes healthy installed-action state without an action error.

Required validation:

  • ./build.ps1: PASS
  • Full Shared suite: 3,812 passed / 32 skipped / 0 failed
  • Complete Tray suite: 2,709 passed / 0 skipped / 0 failed
  • Exact-head native Windows/WSL proof: 1/1 PASS in 7m48s
  • Exact executable SHA-256: C14241FE7F8BEDABE8D5EE93977C83EC1596A6F97F8B9556443AB7514D780266
  • All current CI checks are terminal with no failures or pending checks.

Redacted live UI output:

{
  "route": "background-autostart",
  "start": { "present": true, "enabled": false },
  "stop": { "present": true, "enabled": true },
  "restart": { "present": true, "enabled": true },
  "openLogs": { "present": true, "enabled": true },
  "openChat": { "present": true, "enabled": true },
  "retrySetup": { "present": false },
  "actionError": { "present": false },
  "manifestEndpoint": "verified-loopback-present",
  "managedLlamaProcess": "present-under-isolated-root",
  "cleanup": {
    "trayAbsent": true,
    "llamaAbsent": true,
    "trayRootsRemoved": true,
    "gatewayDisposed": true,
    "gatewayRootsRemoved": true,
    "temporaryDistroRemoved": true
  }
}

Evidence SHA-256:

  • UI state JSON: 3310D8DBE6300E0399CE820A154F8CFAD5F8F1B0156F9801EF95BCFF3AB3CB69
  • Redacted native screenshot: B756A11BF0185E9EBC47389424EC4DD4C1B3395090363EC7AC99EAB43330EEE6
  • Proof provenance JSON: 31544D40D407F83EF352DBE8D4D2F5D65E3A671926BE859C3E1D32A474881921

Only redacted state/provenance and hashes are included. Raw logs, private paths, credentials, tokens, endpoints, device/pairing IDs, and unrelated transcript content are excluded. LocalAiUnavailableInfoBar visibility is diagnostic-only and belongs to the separate #1206 UI lane; it is not claimed by #1208.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 22, 2026

Copy link
Copy Markdown

🦞🧹
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 proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants