Skip to content

fix(setup): native Gateway setup waits 30 minutes when the Store stages the package without registering it - #2000

Merged
joelagnel merged 1 commit into
openclaw:mainfrom
larroy:am/fix-issue-1999-native-gateway-staged-registration
Nov 4, 2026
Merged

joelagnel merged 1 commit into
openclaw:mainfrom
larroy:am/fix-issue-1999-native-gateway-staged-registration

Conversation

@larroy

@larroy larroy commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #1999
Related: #1756

What Problem This Solves

Fixes: native Gateway setup waits the full 30 minutes, then reports a misleading timeout, when the Microsoft Store puts the Gateway package on the machine but never registers it for the current user.

User Impact

User impact: when WinGet finishes but the Gateway package is on the machine without being registered for this user, setup now registers it and continues within seconds. If Windows refuses, setup fails right away with guidance that names the Microsoft Store and the exact Add-AppxPackage -RegisterByFamilyName command. Slow Store deployments (#1756) keep the existing 30-minute wait.

Why This Change Was Made

After WinGet succeeds and the first check still finds no package for this user, setup registers OpenClawFoundation.OpenClawGateway_rfcbke2p71se2 for the current user once, using PackageManager.RegisterPackageByFamilyNameAsync. This needs no elevation, does not use -AllUsers, and never applies to development or patched packages. A registered package still has to pass the existing identity, publisher, health and alias checks.

On this host, Windows reports a package that isn't on the machine as generic 0x80073CF9 with extended error 0x80070490. That case, plus 0x80073CF1, means "nothing on the machine": setup keeps polling within the existing deadline, so a slow deployment is never cut short. If registration fails with any other error, setup checks once more in case Windows registered the package at the same moment, then fails fast. When the timeout happens after WinGet has finished, the message no longer claims Windows may still finish.

Ownership is unchanged. Setup already records this package as one it acquired, so uninstall removes only this user's registration.

Owners touched
  • New NativeGatewayStagedPackageRegistrar (OpenClaw.SetupEngine.UI): the Windows API call. Error classification lives in NativeGatewayPackageRegistration (OpenClaw.SetupEngine, net10.0). New ledger row in docs/ARCHITECTURE.md.
  • NativeGatewayPackageAcquisition.EnsureAsync takes a required registerStagedPackage delegate.
  • NativeGatewayPackageIdentity.StoreFamilyName is a new constant. A test recomputes its publisher ID from StorePublisher.
  • NativeGatewaySetupPage logs each outcome and shows the new localized Onboarding_Native_RegistrationGuidance (all six locales).
  • NativeGatewaySetupDiagnostics adds the deployment activity ID, for use with Get-AppPackageLog.

Evidence

  • 9 new behavior tests in NativeGatewayPackageAcquisitionTests cover:
    • registration success continuing without delay;
    • nothing on the machine, with polling running until the deadline or a late registration succeeding;
    • fast failure on other errors;
    • Windows registering the package at the same moment;
    • a registered package that fails validation and is still rejected;
    • cancellation and deadline during registration;
    • error-code classification.
  • The test for an already registered package now fails if setup attempts registration.
  • A real Windows API test (OpenClaw.Tray.UITests) registers a family that doesn't exist. It returns NotStaged, which proves the extended error code reaches C# through CsWinRT.
  • Manual Windows PowerShell 5.1 probes on this host (unelevated) produced the error codes above. Re-registering an already registered Gateway returned IsRegistered=True.

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

Required proof pools

  • windows-winui-interactive: visible native setup progress, the registration log lines, and the recovery guidance in the isolated app.
  • Reproducing a package that is on the machine but not registered for this user needs a disposable VM with Store access. No named pool covers it, so it will be done as separate ad hoc proof.

Validation

Run from the worktree with OPENCLAW_REPO_ROOT set to it, on commit 464174f7:

  • ./build.ps1: all builds succeeded (Cli, Shared, WinUI, SetupEngine, WinNodeCli).
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 4831 passed, 0 failed, 24 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 4875 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj: 2547 passed, 0 failed, 4 skipped (the new acquisition tests were confirmed in the run listing).
  • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --filter FullyQualifiedName~NativeGatewayPackageIdentityTests: 36 passed.
  • dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 --no-build --filter FullyQualifiedName~NativeGatewayStagedPackageRegistrarTests: 1 passed.

An earlier run with OPENCLAW_REPO_ROOT accidentally empty showed unrelated failures: 118 in Shared (MXC) and 5 in Tray (PinnedPages). The rerun with the variable set passed cleanly.

Real Behavior Proof

  • Environment tested: Windows 11 10.0.26100 x64, unelevated, unpackaged Debug build.
  • PR head or commit tested: 464174f7
  • Exact steps or command run: the NativeGatewayStagedPackageRegistrarTests UI test above (real PackageManager). Separately, manual Windows PowerShell 5.1 WinRT probes of RegisterPackageByFamilyNameAsync, and Get-AppPackageLog -ActivityID.
  • Evidence after fix: a family that isn't on the machine returns NotStaged through the production registrar. The probe showed IAsyncInfo.ErrorCode=0x80073CF9, ExtendedErrorCode=0x80070490, and AppX event 404 with error 0x80070490.
  • Observed result: setup classifies a package that isn't on the machine as "keep waiting". Re-registering an already registered Gateway reports success without elevation.
  • Screenshot or artifact links verified? N/A
  • Not verified or blocked:
    • End-to-end setup on a machine where the package is on the machine but not registered for this user (VM repro: user B keeps the Gateway, user A removes it, then A runs setup).
    • The exact Native Gateway setup waits 30 minutes when the Store stages the Gateway package but skips current-user registration #1999 trigger (a stale Windows Update item).
    • The fast-fail UI with the new guidance (no reliable way to trigger it).
    • ARM64.
    • Packaged (MSIX) Companion: assumed able to call the API as full trust without the packageManagement capability.
    • The independent rubber-duck review required for setup changes has not been done yet.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? Yes
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: setup now calls the Windows package deployment API to register one fixed, publisher-bound Store family for the current user only. There is no download, no elevation and no -AllUsers. The call happens only after the user has approved the native install. The registered package must still pass the existing trust and alias checks before setup uses it.

Compatibility and Migration

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

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.

…utes

When WinGet succeeds but the Store staged the Gateway package without
registering it for the current user, native setup polled until the
30-minute acquisition deadline (openclaw#1999).

After the first post-install resolve misses, EnsureAsync now registers
the staged Store family once for the current user via
RegisterPackageByFamilyNameAsync. A registered package still passes the
resolver's identity, health and alias checks. "Not staged" (extended
error 0x80070490 or 0x80073CF1) keeps the existing bounded wait for slow
deployments (openclaw#1756); other errors fail fast with HRESULTs, a deployment
activity ID and localized recovery guidance. The post-install timeout
message no longer claims Windows may still finish.

Fixes openclaw#1999
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR attempts current-user registration of the staged Store Gateway after WinGet succeeds, preserving package validation and bounded waiting for unfinished deployments.

Example: WinGet exits successfully, but OpenClawFoundation.OpenClawGateway_rfcbke2p71se2 is staged without a current-user registration.

  • Before: Setup polls until the 30-minute acquisition deadline and reports a timeout.
  • After: Setup attempts registration once, verifies the resulting package, and continues or reports a specific registration failure.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation preserves existing boundaries and has useful regression coverage, but native evidence covers only adjacent API scenarios.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; supplied native evidence exercises the production registrar against an absent family and manual re-registration of an existing package, while the body explicitly records that actual staged-package setup recovery and packaged execution remain unverified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Native Gateway onboarding waits 30 minutes and fails after the Store stages the package without registering it for the signed-in user.
Reason: The collaborator-authored direction repairs a documented setup dead end without adding configuration or replacing established package validation.

Merge readiness

✅ Ready for maintainer review

Keep open: this collaborator-authored PR addresses a concrete current-main setup failure, and no definite introduced defect was found; it remains a draft with an unresolved failing CI job.

Priority: P0
Reviewed head: 464174f78375593784ab1bd17782c292cf44b6e5

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not show staged-package recovery through setup, packaged Companion execution, visible fast-fail guidance, existing-state upgrade validation, or a regression run failing for the intended defect on the base.
Agent review details

How this fits together

The native setup page calls package acquisition, which coordinates WinGet, Windows package registration and trusted package resolution before Gateway profile preparation.

flowchart TD
A[Native setup page] --> B[Package acquisition]
B --> C[WinGet Store installation]
B --> D[Current user package resolver]
B --> E[Staged package registrar]
E --> F[Windows deployment API]
D --> G[Verified Gateway setup]
Loading

Technical review

Best possible solution:

Recover the staged Store package within the existing acquisition owner while preserving current-user scope, trusted resolution, slow-deployment waiting and actionable recovery.

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

Current-main source deterministically consumes the acquisition deadline when WinGet succeeds but current-user registration remains absent, matching the linked report's Windows deployment timeline; this read-only review ran no target code.

Is this the best way to solve the issue?

A single injected registration attempt is a focused repair using the existing acquisition and verification owners, with separate Windows and portable components justified by their platform boundaries.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Pedro Larroy: Raw commit 6435749 adds src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 64357496432f; files: src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs)
  • Karen: Raw commit dba8121 adds src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dba81213371c; files: src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs)
  • Linus Huang: Raw commit 6bcc68c adds src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs:44 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6bcc68cde97c; files: src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs)
  • Joel: Raw commit 62752f4 adds src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 62752f44cda2; files: src/OpenClaw.SetupEngine/NativeGatewayPackageAcquisition.cs)

Review metrics

Metric Value Why it matters
Introduced scope Production and resources +195/-15; tests +241/-14; documentation +8/-0. Growth supports a Windows API adapter, portable error classification and distinct acquisition regressions; no unnecessary parallel owner was identified.

Labels

Label changes:

  • add P0: The reported first-run state leaves native onboarding without a usable Gateway and requires external package-registration recovery; this PR supplies the automatic repair.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P0: The reported first-run state leaves native onboarding without a usable Gateway and requires external package-registration recovery; this PR supplies the automatic repair.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Demonstrate current-head setup recovering a genuinely staged but unregistered Store package, including packaged Companion and visible recovery guidance.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 4, 2026, 4:14 AM ET / 09:14 UTC.

@larroy
larroy marked this pull request as ready for review November 4, 2026 15:45
@joelagnel
joelagnel merged commit 2c327dc into openclaw:main Nov 4, 2026
53 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants