Repository navigation
Description
Summary
Store migration cannot prepare when %APPDATA%\OpenClawTray\gateways\ contains any file, because MigrationInventory.GetGatewayDirectories enumerates every filesystem entry and then requires each one to be a directory. The app's own SetupEngine writes native-setup-draft.json into exactly that folder, so the two features collide and migration dead-ends with Migration2_ValidationFailed.
Environment
- Windows Companion (Inno install,
2026.9.8-1) migrating to the Microsoft Store build - Gateway
2026.10.2 - Windows 11
Repro
- Set up a native gateway through the SetupEngine (it writes
%APPDATA%\OpenClawTray\gateways\native-setup-draft.json). - Start the Store migration (Settings -> "Install Store version and migrate"), accept consent.
- The preparation step fails; the dialog shows the
Migration2_ValidationFailedmessage.
Evidence
%LOCALAPPDATA%\OpenClawTray\openclaw-tray.log:
[INFO] Store migration startup admission: ConsentRequired (receipt: False, source payload: False).
[ERROR] Store migration preparation failed: Migration source has an unexpected file type.
Root cause
src/OpenClaw.Connection/Migration/MigrationInventory.cs (~line 151):
private static string[] GetGatewayDirectories(string roaming)
{
var path = Path.Combine(roaming, "gateways");
if (!CheckPath(path, directory: true))
return [];
var names = new List<string>();
foreach (var child in Directory.EnumerateFileSystemEntries(path)) // ~157: files AND directories
{
if (names.Count >= MaximumGateways)
throw new InvalidDataException("Too many gateway identity directories.");
CheckPath(child, directory: true); // ~161: throws for a file
var name = Path.GetFileName(child);
ValidateSegment(name);
names.Add(name);
}
return names.Order(StringComparer.Ordinal).ToArray();
}EnumerateFileSystemEntries returns files and directories. CheckPath(child, directory: true) throws InvalidDataException("Migration source has an unexpected file type.") (~line 246) for any file.
The offending file is written on purpose by src/OpenClaw.SetupEngine/NativeGatewaySetupService.cs:214 (documented in docs/ONBOARDING_WIZARD.md:328):
Path.Combine(Path.GetDirectoryName(registry.GetIdentityDirectory("native-setup"))!, "native-setup-draft.json");So the migration inventory and the native-gateway setup feature disagree about what may live in gateways\.
Suggested fix
Enumerate directories only (Directory.EnumerateDirectories) or skip non-directory entries, since the rest of the inventory never reads files from gateways\.
Workaround
Move %APPDATA%\OpenClawTray\gateways\native-setup-draft.json out of the gateways\ folder, then Retry. Preparation, completion and finalization then succeed:
[INFO] Store migration preparation completed
[INFO] Store migration completion recorded
[INFO] Store migration startup admission: FinalizationRequired (receipt: True, source payload: False)
[INFO] Store migration finalized
Note
Second, independent blocker in the same migration flow as #1592 / #1676 (the stale, non-numeric Inno DisplayVersion).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity
clawsweeper commentedon Oct 14, 2026
Codex review: this still needs some work.
Summary
This issue establishes a current-main migration bug; an existing open PR addresses the native setup draft collision but has not merged.
Reproducibility: Current main proves the failure: setup writes gateways/native-setup-draft.json and migration requires that same entry to be a directory; the reporter supplies matching logs and a successful file-removal workaround, but this read-only review ran no reproduction or tests.
Next step
Review #1675 (fix(migration): Store migration blocked for Native Gateway users and correction releases) for safe draft handling and in-app Retry recovery, then verify this issue before closure.
Review details
Best possible solution:
Recognize and validate the existing setup draft while preserving strict inventory safeguards and allowing users to retry migration within the app.
Do we have a high-confidence way to reproduce the issue?
Current main proves the failure: setup writes gateways/native-setup-draft.json and migration requires that same entry to be a directory; the reporter supplies matching logs and a successful file-removal workaround, but this read-only review ran no reproduction or tests.
Is this the best way to solve the issue?
The existing PR's exact-name draft handling is safer than skipping every file because it retains bounded inventory, fingerprint consistency, and rejection of unexpected or unsafe entries.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning medium; reviewed against d096d5381c9f.
Label changes
Label changes:
P0: The supported Store migration path blocks an ordinary user and requires log inspection and manual file movement to recover.impact:ux-release-blocker: Retry cannot overcome the app-created draft collision, and the current UI provides no effective in-product recovery.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.Label justifications:
P0: The supported Store migration path blocks an ordinary user and requires log inspection and manual file movement to recover.impact:ux-release-blocker: Retry cannot overcome the app-created draft collision, and the current UI provides no effective in-product recovery.Evidence reviewed
What I checked:
src/OpenClaw.Connection/Migration/MigrationInventory.cs:157, d096d5381c9f)src/OpenClaw.SetupEngine/NativeGatewaySetupService.cs:214, d096d5381c9f)docs/ONBOARDING_WIZARD.md:328, d096d5381c9f)src/OpenClaw.Connection/Migration/MigrationInventory.cs, 92f47c6e6345)src/OpenClaw.Connection/Migration/MigrationInventory.cs:157, 5a59535216ee)src/OpenClaw.SetupEngine/NativeGatewaySetupService.cs:214, dba81213371c)Likely related people:
src/OpenClaw.Connection/Migration/MigrationInventory.cs)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 14, 2026, 12:35 PM ET / 16:35 UTC.
shanselman commentedon Oct 28, 2026
Hi! I'm a Copilot triage agent helping with maintenance (not Scott). This looks fixed by #1675 (fix(migration): Store migration blocked for Native Gateway users and correction releases), merged 2026-10-16 in 4244a48 and shipped in MSIX 2026.10.4 and later. Migration now accepts the known Gateway setup files such as native-setup-draft.json. Unrecognized extra files are still rejected on purpose, so migration can't copy something it doesn't understand. If you still see this on 2026.10.4 or newer, please reopen with the file name it reports and we'll take another look. Thank you for the clear report!