Skip to content

Local AI setup/startup fails with latest Gateway config CLI formats #1398

Closed

Description

@joelagnel

Summary

The Companion's managed Local AI setup and runtime configuration paths are incompatible with two CLI contracts in the Gateway version now selected by normal setup. This can block fresh installation and managed Local AI startup/restart even on a supported GPU.

Observed with Gateway 2026.9.3 on native Windows 11 x64. Both contracts also exist in the downloaded 2026.9.1 package source; that is source inspection, not a claim of runtime validation on 9.1 or identification of the first affected release.

Normal setup moved from the old Gateway pin to npm latest in #1312 (improve(setup): install latest stable Gateway from npm), followed by #1381 (fix(setup): complete npm latest Gateway landing). The compatibility fix below does not change Gateway version selection.

Discovered while validating #1391. This issue is specifically about CLI compatibility, not GPU eligibility, OOM detection, or Chat recovery UX. It is also distinct from the stale-primary dispatch race in #1293.

What fails

1. Valid-but-unset settings are mistaken for operational failures

The Companion recognizes missing settings by looking for legacy Config path not found: <path> text on stderr. With openclaw config get <path> --json, the observed Gateway returns exit code 1 and a structured JSON error on stdout. It distinguishes a valid-but-unset setting from an unknown configuration path.

Affected paths include models.providers.llamacpp, agents.defaults.model.primary, and agents.defaults.workspace.

Consequences:

  • Fresh Local AI setup fails with Could not safely snapshot the existing Local AI gateway configuration.
  • Default-workspace initialization can fail with Could not resolve OpenClaw default workspace path.
  • The runtime route coordinator cannot reliably verify an absent/withdrawn provider or publish a fresh managed route.

2. Runtime provider batches are passed through a pipe instead of a regular file

The runtime coordinator invokes openclaw config set --batch-file /dev/stdin. The observed Gateway checks that the opened input is a regular file and rejects the pipe:

--batch-file must be a regular file: /dev/stdin. Choose a JSON5 input file and try again.

This blocks publishing the managed Local AI endpoint. These findings demonstrate incompatible Companion assumptions; they do not establish an upstream Gateway bug or a violated documented compatibility guarantee.

Reproduction and observed evidence

  1. Run managed Local AI setup in a fresh isolated profile with Gateway 2026.9.3 and no authored Local AI provider settings. Before the fix, configuration snapshotting fails.
  2. After correcting that read path, the next setup attempt reaches default-workspace initialization and fails on the analogous unset-setting response. Correcting that path allows both steps to complete.
  3. Run the exact production provider batch with --batch-file /dev/stdin --dry-run: exit 1, regular-file diagnostic above.
  4. Run the identical batch from an owned mktemp regular file with --dry-run: exit 0, Dry run successful: 2 update(s) validated.

Neither batch diagnostic requested a configuration write. The subsequent real setup/runtime proof is separate from those dry-run checks. Raw logs, credentials, model files, screenshots, and the local-only proof commit are not being published with this issue.

Proposed fix

An implementation is already available as the separate top commit on the maintainer's public branch:

19f76060: fix(gateway): support current config CLI missing-value and batch-file formats

  • Recognize the bounded, canonical structured unset response for the exact requested path, while retaining supported legacy stderr responses.
  • Continue rejecting unknown paths, wrong paths, malformed/oversized output, timeouts, and other operational failures. An arbitrary CLI error must not authorize configuration mutation.
  • Use a temporary regular file for runtime batch updates, retain dry-run-before-write, and remove only that file with an EXIT trap. Send the shell script via stdin so wsl.exe cannot expand Linux variables in its argv.
  • Preserve existing ownership checks, rollback, fallback-model behavior, and endpoint publication/withdrawal verification.

Production changes are limited to LocalAiGatewayConfiguration.cs, WindowsNodeBootstrapContextStep.cs, and LocalAiGatewayProviderCoordinator.cs, with corresponding tests. The branch also contains the two separately reviewable busy-GPU setup commits; those are not part of this compatibility commit.

Validation

On product head 19f76060:

  • Full repository build passed.
  • Shared: 3,989 passed, 34 environmental skips.
  • Tray: 2,921 passed, no skips.
  • SetupEngine: 1,164 passed, no skips.
  • Connection: 787 passed, 4 environmental skips.
  • Real Gateway 2026.9.3 -> Windows node -> MXC system.run: 17 passed, no skips, without -AllowSkip. This verifies the real Gateway/node path, not every Local AI lifecycle branch.
  • Focused tests cover structured and legacy unset responses, rejected error cases, rollback, cold-start/restart/teardown sequencing, and generated batch-script/stdio shape. Fake-runner tests are not represented as real Gateway execution.

ARM64/RTX Spark validation remains outstanding. Existing exact-version selectors and legacy Gateway error-format support should remain intact.

cc @karkarl @shanselman

Activity

  1. added
    P0
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    clawsweeper:source-repro
    impact:auth-provider
    impact:ux-release-blocker
    issue-rating: 🦞 diamond lobster
    no-stale
    on Sep 10, 2026
  2. clawsweeper commented on Sep 10, 2026

    @clawsweeper

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 10, 2026, 5:37 PM ET / 21:37 UTC.

    Summary
    Both reported incompatibilities remain on current main and are corroborated by Gateway 2026.9.3 source. The supplied compatibility commit provides a focused starting point; the related GPU and restart-routing work does not resolve this issue.

    Reproducibility: yes. from source: Gateway 2026.9.3's structured unset response reaches the Companion's failure branches, and its regular-file check rejects the runtime pipe. The reporter describes matching native failures; this review did not execute them.

    Root-cause cluster
    Relationship: canonical
    Canonical: #1398
    Summary: This issue isolates CLI compatibility from GPU admission, stale dispatch, and recovery workflow changes.

    Members:

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

    Next step
    A bounded, source-proven repair has clear owners and tests, no required product-policy change, and no open PR claiming it; reuse the supplied compatibility work where suitable.

    Review details

    Best possible solution:

    Adapt the existing configuration readers and batch writer without weakening ownership or rollback checks, so normal setup and an in-product Retry recover without manual configuration edits.

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

    Yes, from source: Gateway 2026.9.3's structured unset response reaches the Companion's failure branches, and its regular-file check rejects the runtime pipe. The reporter describes matching native failures; this review did not execute them.

    Is this the best way to solve the issue?

    Yes, adapting these existing consumers is the narrowest repair, and setup already demonstrates compatible regular-file batching. The supplied commit should be reviewed independently from the busy-GPU changes.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The supplied validation does not establish every Local AI lifecycle branch or ARM64/RTX Spark behavior; the reported MXC pass alone does not prove these configuration repairs.

    Codex review notes: model internal, reasoning medium; reviewed against 621f4100f8b4.

    Label changes

    Label changes:

    • add P0: Normal fresh Local AI setup can stop on supported hardware with no demonstrated in-product path past the incompatible CLI responses.
    • add impact:auth-provider: The affected coordinator cannot reliably publish or verify the managed model provider and primary route.
    • add impact:ux-release-blocker: The failure blocks installation or first useful Local AI startup and currently requires a code-level compatibility repair.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

    Label justifications:

    • P0: Normal fresh Local AI setup can stop on supported hardware with no demonstrated in-product path past the incompatible CLI responses.
    • impact:ux-release-blocker: The failure blocks installation or first useful Local AI startup and currently requires a code-level compatibility repair.
    • impact:auth-provider: The affected coordinator cannot reliably publish or verify the managed model provider and primary route.
    Evidence reviewed

    Acceptance criteria:

    • ./build.ps1
    • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore

    What I checked:

    • Current main retains both incompatible assumptions: The checkout and GitHub main both resolve to 621f410. Runtime reads recognize absence only through legacy stderr at lines 244-247; batch writes pipe JSON into --batch-file /dev/stdin at lines 286-287. (src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayProviderCoordinator.cs:244, 621f4100f8b4)
    • Setup snapshot failure and existing batch pattern: CaptureStateAsync rejects failed reads without the legacy stderr message, causing ExecuteAsync to report snapshot failure. ApplyBatchAsync already uses mktemp, an EXIT cleanup trap, dry-run-before-write, and stdin script delivery, providing a compatible pattern for runtime. (src/OpenClaw.SetupEngine/LocalAiGatewayConfiguration.cs:348, 621f4100f8b4)
    • Default-workspace failure is independently reachable: ResolveConfiguredDefaultWorkspacePathAsync returns null for a structured stdout error without legacy stderr. ExecuteAsync turns that result into the reported default-workspace failure. Existing SetupStepsTests cover legacy absence and preservation on operational failures. (src/OpenClaw.SetupEngine/WindowsNodeBootstrapContextStep.cs:410, 621f4100f8b4)
    • Gateway dependency contract: structured absence: The Companion directly executes this dependency's config CLI. At v2026.9.3, runConfigGet distinguishes valid-but-unset paths from unknown paths and emits a structured JSON failure with exit 1 in JSON mode. The annotated release tag resolves to the recorded commit. (src/cli/config-cli.ts:142, 1391f7cd2d40)
    • Gateway dependency contract: regular-file input: parseBatchSource invokes readConfigMutationFileSync for --batch-file; that reader rejects descriptors for which fstatSync().isFile() is false. This establishes why piped /dev/stdin input fails before validation or mutation. (src/cli/config-set-input.ts:72, 1391f7cd2d40)
    • Existing contributor implementation: The issue links joelagnel@19f7606. Inspected production hunks address the three reported consumers with bounded exact-path response checks and regular-file runtime batches. This is a candidate implementation, not a merged target fix or a completed patch review. (src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayProviderCoordinator.cs, 19f7606001b0)

    Likely related people:

    • joelagnel: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    • shanselman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    How this review workflow works
    • 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.
  3. locked as resolved and limited conversation to collaborators on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0clawsweeper:fix-shape-clearclawsweeper:queueable-fixclawsweeper:source-reproimpact:auth-providerimpact:ux-release-blockerissue-rating: 🦞 diamond lobsterno-stale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions