mirror of
https://github.com/Comfy-Org/desktop.git
synced 2026-11-04 23:47:43 +00:00
[GH-ISSUE #1406] Detect and migrate unsafe existing basePath locations (inside app bundle / updater cache / OneDrive) #402
Labels
No labels
area: desktop-app
Bounty
bug
bug-cop:answered
bug-cop:response-received
component: installer
component: preload
custom node
dependencies
Design
documentation
duplicate
enhancement
expected
frontend
good first issue
installation
Low-Priority
performance
Planned
platform: cross-platform
platform: windows
Potential Bug
Potential Bug
pull-request
question
refactor
Release
stale
User Support
V1
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/desktop#402
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @benceruleanlu on GitHub (Nov 19, 2025).
Original GitHub issue: https://github.com/Comfy-Org/desktop/issues/1406
Originally assigned to: @benceruleanlu on GitHub.
Summary
We’ve added validation in
PathHandlers.tsso new installs cannot choose paths inside the app bundle, updater cache, or OneDrive. However, existing installs may still have theirbasePathset to locations we now consider unsafe (e.g.D:\Apps\ComfyUI\configunder the app install root), which can lead to data loss on update (see #1395).Right now, the startup/validation path only checks that
basePathis accessible, not that it’s safe according to the new rules.Current behavior
New installs go through the Install screen and
VALIDATE_INSTALL_PATH, which usesevaluatePathRestrictions()insrc/handlers/pathHandlers.tsand blocks:path.dirname(app.getPath('exe'))(the app install root)process.resourcesPathLOCALAPPDATA/Programs/comfyui-electronLOCALAPPDATA/comfyui-electron-updaterandLOCALAPPDATA/@comfyorgcomfyui-electron-updater)process.env.OneDrive)Existing installs load their base path from desktop config and only check for accessibility:
src/main-process/comfyInstallation.ts:There is no check that
basePathitself passes the new restriction rules. If an older install choseD:\Apps\ComfyUI\configas the base path, we still happily run from there.Problem
D:\Apps\ComfyUI\config), updates can delete or partially wipe their user data.Desired behavior
basePathis in an unsafe location (inside app bundle, updater cache, or OneDrive), we should:Proposed solution
Reuse the restriction logic for existing installs
evaluatePathRestrictions()or equivalent into a reusable helper accessible from the main process (or add a main-process wrapper that calls the same logic asVALIDATE_INSTALL_PATH).ComfyInstallation.validate():basePathis accessible, call the restriction checker onbasePath.isInsideAppInstallDirorisInsideUpdaterCacheorisOneDriveis true, treat this as an unsafe configuration.Surface an explicit validation error/state for unsafe base paths
InstallValidation.basePathsemantics to distinguish:"OK"– accessible and safe"error"– inaccessible (current behavior)"warning"or a separate flag (e.g.unsafeBasePath) for “accessible but unsafe location”.Offer a guided migration to a safe location
GET_SYSTEM_PATHS.defaultInstallPath).InstallLocationPicker.vue) andvalidateInstallPathflow.ComfyConfigManager.createComfyDirectories,ComfyServerConfig.setBasePathInDefaultConfig, etc.) to prepare the new base path.user,input,output.custom_nodesand any other user data directories.basePathand re-create theComfyInstallationwith the new base path.Hard-stop running on unsafe base paths going forward
Edge cases / considerations
Tasks
VALIDATE_INSTALL_PATH.ComfyInstallation.validate()to call this helper on the storedbasePath.InstallValidation/ maintenance UI to represent and display an "unsafe base path" condition.Related: #1395 (config deleted when updating due to basePath inside app install root).
┆Issue is synchronized with this Notion page by Unito
@dosubot[bot] commented on GitHub (Nov 19, 2025):
To detect and migrate unsafe basePath locations for existing installs, you’ll want to refactor the path restriction logic currently used in the
VALIDATE_INSTALL_PATHIPC handler insrc/handlers/pathHandlers.tsinto a shared helper function. This logic already checks for unsafe locations like the app bundle, updater cache, and OneDrive, but is only accessible via IPC and not directly from the main process. Refactoring it will let you call it fromComfyInstallation.validate()after confirming basePath accessibility, so you can explicitly detect and flag unsafe configurations for existing installs as well see code.Once you have the shared helper, update the validation flow in
ComfyInstallation.validate()(insrc/main-process/comfyInstallation.ts) to call this helper after checking accessibility. If the basePath is unsafe, set a new validation state (like"warning"or anunsafeBasePathflag) instead of"OK", and surface this to the frontend so the maintenance UI can prompt the user to migrate their data see code.This approach will let you block startup on unsafe basePaths, guide users to a safe location using the existing Install Location Picker, and (optionally) migrate key subdirectories like
user,input,output, andcustom_nodesto the new basePath. This matches the planned fixes and recommendations discussed in #1395 and related issues.To reply, just mention @dosu.
Docs are dead. Just use Dosu.