Skip to content

fix(adopt): restore Legacy Desktop settings from workspace#1281

Merged
Kosinkadink merged 2 commits into
mainfrom
fix/legacy-adopt-settings-path
Jul 18, 2026
Merged

fix(adopt): restore Legacy Desktop settings from workspace#1281
Kosinkadink merged 2 commits into
mainfrom
fix/legacy-adopt-settings-path

Conversation

@Kosinkadink

Copy link
Copy Markdown
Member

Summary

  • read Legacy Desktop's comfy.settings.json from the canonical <basePath>/user/default workspace path and back up that same file
  • preserve CPU installs by deriving --cpu from the persisted selectedDevice when the settings entry is absent
  • repair records already adopted with generated default args before startup auto-launch, while preserving launch and path settings edited in Desktop 2.0

Root cause

Legacy Desktop stores frontend and launch settings under its ComfyUI workspace. The adoption flow instead looked for comfy.settings.json in the Electron config directory, so it silently migrated an empty settings object. For CPU installations this dropped --cpu, then launched a CPU-only Torch environment through the CUDA path.

Safety

  • canonical workspace settings take precedence; a decoy config-directory file is ignored
  • explicit cpu: false is preserved
  • already-adopted records are changed only when their launch args still exactly match the generated defaults from the broken migration
  • v2-edited input/output paths and launch args are not overwritten
  • malformed or transiently unreadable settings are retried on the next startup

Validation

  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test (188 files, 2812 tests)

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: da65ab40-0c47-42b5-84c3-e87d98e59cf3

📥 Commits

Reviewing files that changed from the base of the PR and between 7a151ae and 37c5f2d.

📒 Files selected for processing (2)
  • src/main/lib/desktopAdopt.test.ts
  • src/main/lib/desktopAdopt.ts

📝 Walkthrough

Walkthrough

Startup now awaits IPC registration and maintenance. Desktop adoption reads legacy settings from the legacy workspace, preserves CPU selection, versions adopted settings, and reconciles eligible installation records without overwriting user-edited launch arguments.

Changes

Adopted settings lifecycle

Layer / File(s) Summary
Legacy settings ingestion and adoption
src/main/lib/desktopAdopt.ts, src/main/lib/desktopAdopt.test.ts
Legacy settings are read from basePath/user/default, backed up from that location, and used to derive CPU-aware launch arguments and versioned adoption metadata.
Adopted installation reconciliation
src/main/lib/desktopAdopt.ts, src/main/lib/desktopAdopt.test.ts
Version-mismatched standalone installations are reconciled conditionally, preserving edited launch arguments and covering missing, malformed, and generated-default settings.
Awaited startup maintenance
src/main/lib/ipc/index.ts, src/main/index.ts
IPC registration returns and awaits migration plus adopted-settings reconciliation before later startup initialization proceeds.

Sequence Diagram(s)

sequenceDiagram
  participant MainStartup
  participant IPCRegister
  participant AdoptedSettings
  participant Installations
  MainStartup->>IPCRegister: await register()
  IPCRegister->>IPCRegister: migrateDefaults()
  IPCRegister->>AdoptedSettings: reconcileAdoptedSettings()
  AdoptedSettings->>Installations: update adopted records
  IPCRegister-->>MainStartup: startup maintenance complete
Loading

Possibly related PRs

Suggested reviewers: deepme987, maanilverma

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/legacy-adopt-settings-path
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/legacy-adopt-settings-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested review from MaanilVerma and deepme987 July 18, 2026 06:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/lib/desktopAdopt.ts`:
- Around line 957-972: Update the adoption logic around the
launchArgs/inputDir/outputDir patching so eligible default inputDir and
outputDir values are repaired independently of the existing.launchArgs ===
generatedDefaultArgs check. Keep launchArgs replacement restricted to generated
defaults, while allowing each path override to apply when its corresponding
existing path still matches the basePath default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: aa8824fe-9db2-4704-95cf-3b55e1a0d60c

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab9a19 and 7a151ae.

📒 Files selected for processing (4)
  • src/main/index.ts
  • src/main/lib/desktopAdopt.test.ts
  • src/main/lib/desktopAdopt.ts
  • src/main/lib/ipc/index.ts

Comment thread src/main/lib/desktopAdopt.ts
@Kosinkadink
Kosinkadink merged commit b9cb529 into main Jul 18, 2026
12 checks passed
@Kosinkadink
Kosinkadink deleted the fix/legacy-adopt-settings-path branch July 18, 2026 07:10
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
@Kosinkadink

Copy link
Copy Markdown
Member Author

Follow-up from the affected user's supplied configuration files: NVIDIA was selected and Comfy.Server.LaunchArgs was empty, so this specific CUDA crash was not caused by losing or restoring a legacy --cpu setting. The settings-path fix in this PR remains valid independently. The incident's immediate mismatch was an adopted CPU-only Torch build with an NVIDIA selection; follow-up fix: #1287

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants