Skip to content

Native Gateway setup waits 30 minutes when the Store stages the Gateway package but skips current-user registration #1999

Closed

Description

@larroy

Summary

Native Gateway setup can sit on "WinGet finished. Waiting for the Gateway package registration." for the full 30-minute acquisition budget, even though the Store has already deployed the package. WinGet exits 0, but the Store staged the package for the machine (S-1-5-18) and never registered it for the current user. NativeGatewayPackageAcquisition.EnsureAsync can't distinguish this from a slow deployment, so it polls FindPackagesForUser until the deadline and then reports a generic timeout.

This is a different failure from #1756 ([Windows ARM64] Native Gateway setup times out while Microsoft Store deployment continues). In #1756 deployment is still running. Here deployment has finished and no registration will ever arrive.

Environment

  • Windows 11 24H2 (10.0.26100), x64
  • WinGet v1.29.380 (Microsoft.DesktopAppInstaller_1.29.379.0)
  • Companion: Debug build from source, unpackaged. The acquisition, installer, and resolver files are identical to main at 7967d50
  • Gateway Store product 9NV70LV3D6XC, deployed version 2026.10.900.0
  • History: OpenClawFoundation.OpenClawGateway_2026.10.600.0_x64__rfcbke2p71se2 was installed for this user until about 2026-11-02, then removed before this setup run

What happened

Timeline from native-setup-*.jsonl, Microsoft-Windows-Store/Operational and Microsoft-Windows-AppXDeploymentServer/Operational (local time):

  1. 2026-10-31 19:12 and 2026-11-02 08:48: while 2026.10.600.0 was still installed, Windows Update's background scan (MoUpdateOrchestratorDeviceScan / MoUpdateOrchestratorUserScan) queued an update item for OpenClawFoundation.OpenClawGateway_rfcbke2p71se2. At 2026-11-02 18:35 a MoUsoCoreWorker resume of that item logged [Error] Creating UWA Work, and the item stayed queued.
  2. The package was then removed for the user. The queued update item was not cleared.
  3. 2026-11-03 22:03:39: setup runs winget install --id 9NV70LV3D6XC --source msstore --silent ....
  4. 22:03:42: the Store install service logs Work already enqueued. Refusing to queue duplicate work CatalogId = PackageFamilyName:OpenClawFoundation.OpenClawGateway_rfcbke2p71se2. WinGet resumes the existing item (winget-RestartWithTelemetry) instead of creating a per-user acquisition. The item runs with IsUpdate = true, Install Starting. Client Sid: S-1-5-18, User Sid: S-1-5-18.
  5. 22:06:50: AppX deployment reports the Stage operation for OpenClawFoundation.OpenClawGateway_2026.10.900.0_x64__rfcbke2p71se2 "finished successfully". The folder exists under C:\Program Files\WindowsApps.
  6. 22:06:51: Update requested from LocalSystem context. Attempting to register for all logged-on users who have it, followed by Nothing to register for User: S-1-5-21-...-1000. Skipping Install.
  7. 22:06:52: WinGet exits 0 with Starting package install... Successfully installed. Setup logs WinGet finished. Waiting for the Gateway package registration.
  8. From then on, Get-AppxPackage -Name OpenClawFoundation* returns nothing for the user and winget list --id 9NV70LV3D6XC reports No installed package found. Setup keeps polling until the 30-minute deadline.

A setup cancelled 0.6 s after starting and retried immediately did not contribute. The Store log shows only one winget.exe reaching the install service (22:03:40), and the conflicting queue item predates the run by more than a day.

Why Companion stays stuck

  • NativeGatewayPackageAcquisition.EnsureAsync treats WinGet success as "registration will follow" and polls resolver.ResolveAsync once a second until the deadline (NativeGatewayPackageAcquisition.cs#L86-L100).
  • NativeGatewayPackageResolver only looks at current-user registrations via PackageManager.FindPackagesForUser(string.Empty) (NativeGatewayPackageResolver.cs#L37), so a package that is staged but not registered looks the same as one that hasn't arrived yet.
  • The final TimeoutException says "Windows may still finish deployment. Check WinGet and Microsoft Store access, then retry native setup." In this state Windows will never finish, and a plain retry probably hits the same queued item. Retry was not exercised on this host.

Expected

After WinGet reports success, setup either continues with a registered Gateway package or fails quickly with guidance that names this state. It should not wait the full acquisition budget for a registration that won't happen.

Proposed fix

In NativeGatewayPackageAcquisition.EnsureAsync, once installPackage returns and the first resolve after it still throws NativeGatewayPackageNotInstalledException:

  1. Try registering the staged Store package for the current user, once, by family name: PackageManager.RegisterPackageByFamilyNameAsync("OpenClawFoundation.OpenClawGateway_rfcbke2p71se2", null, DeploymentOptions.None, null, null), using the expected family that NativeGatewayPackageIdentity already derives. The equivalent PowerShell is Add-AppxPackage -RegisterByFamilyName -MainPackage <family>. Registering an already-staged package needs no elevation and downloads nothing.
  2. If registration succeeds, go back to the existing ResolveAsync verification. The registered package must still pass the existing identity, publisher, and alias checks before setup trusts it.
  3. If registration fails because the package isn't staged (a real slow deployment, as in [Windows ARM64] Native Gateway setup times out while Microsoft Store deployment continues #1756), keep the current polling loop and budget unchanged.
  4. If registration fails for any other reason, fail now with a specific message and the HRESULT in the setup log, not after 30 minutes. Point the user to the Microsoft Store listing ("Get"/"Install") or the manual Add-AppxPackage -RegisterByFamilyName command.

Keep registration behind the injected installer/resolver seam so the fake-resolver tests in tests/OpenClaw.SetupEngine.Tests/NativeGatewayPackageAcquisitionTests.cs can cover:

  • WinGet succeeds, not registered, register-by-family succeeds, resolve succeeds (continues without waiting).
  • WinGet succeeds, register-by-family returns "not staged", polling continues and still respects the deadline ([Windows ARM64] Native Gateway setup times out while Microsoft Store deployment continues #1756 behavior preserved).
  • WinGet succeeds, register-by-family fails with another error (fails fast with the specific message).
  • Cancellation during the registration attempt.

This only restores a registration that WinGet already started for this Store package. It does not touch other packages, and it does not require elevation or -AllUsers queries.

Workaround

Register the staged package for the current user, then select Retry setup:

Add-AppxPackage -RegisterByFamilyName -MainPackage OpenClawFoundation.OpenClawGateway_rfcbke2p71se2

Not yet run on the reporting host. Installing from the Microsoft Store listing should work too.

Related

Activity

  1. added
    bug
    on Nov 4, 2026
  2. added
    clawsweeper:intake:bug
    P0
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    clawsweeper:source-repro
    impact:ux-release-blocker
    issue-rating: 🦞 diamond lobster
    no-stale
    and removed
    clawsweeper:intake:bug
    on Nov 4, 2026
  3. clawsweeper commented on Nov 4, 2026

    @clawsweeper

    Codex review: this still needs some work.

    Summary
    Keep open: current main still waits until the acquisition deadline when WinGet succeeds without current-user registration, and the collaborator-authored report establishes a distinct setup failure.

    Reproducibility: Current source proves that successful installation followed by persistent missing registration consumes the remaining deadline; the report supplies a concrete Windows timeline, but no native reproduction or tests were run during this read-only review.

    Next step
    Establish a failing staged-without-registration regression, then add bounded registration repair and inline recovery while preserving slow-deployment polling.

    Review details

    Best possible solution:

    Automatically repair current-user registration for the staged Store Gateway, with an inline Fix action or actionable failure when repair cannot complete.

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

    Current source proves that successful installation followed by persistent missing registration consumes the remaining deadline; the report supplies a concrete Windows timeline, but no native reproduction or tests were run during this read-only review.

    Is this the best way to solve the issue?

    A single injected registration-recovery attempt fits the existing acquisition owner, provided native evidence establishes which errors mean staging is still pending and all existing resolver checks remain mandatory.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The proposed register-by-family workaround was not exercised on the reporting host.
    • The exact Windows not-staged error classification and registration cancellation behavior need native validation before relying on the proposed recovery.

    Codex review notes: model internal, reasoning medium; reviewed against 7967d509886f.

    Label changes

    Label changes:

    • add P0: The reported native onboarding state cannot produce a usable Gateway through existing setup controls and requires external package-registration recovery.
    • add impact:ux-release-blocker: A community user encounters a long wait followed by generic retry guidance, with no in-product registration 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: The reported native onboarding state cannot produce a usable Gateway through existing setup controls and requires external package-registration recovery.
    • impact:ux-release-blocker: A community user encounters a long wait followed by generic retry guidance, with no in-product registration repair.
    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
    • ./scripts/validate-mxc-e2e.ps1

    What I checked:

    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; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed November 4, 2026, 1:42 AM ET / 06:42 UTC.

  4. larroy commented on Nov 4, 2026

    @larroy
    CollaboratorAuthor
    Image
  5. larroy commented on Nov 4, 2026

    @larroy
    CollaboratorAuthor

    related #1969

  6. locked as resolved and limited conversation to collaborators on Nov 7, 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

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

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions