Skip to content

Adopt: keep legacy extra_model_paths.yaml install-scoped#1105

Open
Kosinkadink wants to merge 1 commit into
mainfrom
adopt-extra-model-paths-install-scoped
Open

Adopt: keep legacy extra_model_paths.yaml install-scoped#1105
Kosinkadink wants to merge 1 commit into
mainfrom
adopt-extra-model-paths-install-scoped

Conversation

@Kosinkadink

Copy link
Copy Markdown
Member

Summary

During Legacy Desktop → Desktop 2.0 adoption, the legacy extra_model_paths.yaml (the file ComfyUI auto-loads from the source dir, and which the Storage tab shows read-only) is now treated as install-local rather than being merged into the global shared model dirs.

Previously the desktop-managed extra_models_config.yaml was the only model-paths file carried into settings.modelsDirs. An interim approach also dumped extra_model_paths.yaml paths into that global list — but those are often arbitrary/external paths for one specific legacy setup, so making them global would make them apply to every install (including future fresh ones), which is confusing.

What changed

  • computeModelsDirsToCarry / carryLegacySettings again feed only extra_models_config.yaml into the global modelsDirs (the user's main <basePath>/models stays shared, as before).
  • New preserveInstallExtraModelPaths ensures the legacy extra_model_paths.yaml ends up in the adopted install's source dir, so ComfyUI loads it for that install only and the Storage tab reports it:
    • left untouched when the pre-swap copy already carried it (never clobbered),
    • recovered from the reused legacy basePath in the git-clone fallback (a fresh clone ships only extra_model_paths.yaml.example),
    • no-op when there's nothing to preserve.
  • Surfaced as has_install_extra_model_paths_yaml in the adopt success telemetry.

The Storage tab already renders the install's extra_model_paths.yaml via buildExtraModelPathsView, so no UI change is needed — preserving the file is what makes that read-only row appear. Users who want those paths elsewhere can open the file and copy them out manually.

Testing

  • pnpm run typecheck (node/web/e2e/integration) — pass
  • pnpm run lint — pass
  • pnpm run build — pass
  • pnpm run test — 2193/2193 pass, including new unit tests for preserveInstallExtraModelPaths and the install-scoped computeModelsDirsToCarry behavior.

Desktop adoption now treats the legacy `extra_model_paths.yaml` (the file
ComfyUI auto-loads from the source dir and the Storage tab shows read-only)
as install-local, never merging its paths into the global shared model dirs.
This avoids one migrated install's arbitrary/external paths leaking into
every other install.

- `computeModelsDirsToCarry` / `carryLegacySettings` again feed only
  `extra_models_config.yaml` into the global `modelsDirs` (the user's main
  models stay shared, as before).
- New `preserveInstallExtraModelPaths` ensures the legacy
  `extra_model_paths.yaml` lands in the adopted install's source dir so
  ComfyUI loads it for that install and the Storage tab reports it: left
  as-is when the pre-swap copy already carried it, recovered from the reused
  basePath in the git-clone fallback, no-op otherwise.
- Surfaced as `has_install_extra_model_paths_yaml` in adopt telemetry.

The Storage tab already renders the install's extra_model_paths.yaml
(buildExtraModelPathsView), so no UI change is needed.

Amp-Thread-ID: https://ampcode.com/threads/T-019ebfcb-e545-73d8-a33d-52580e41588a
Co-authored-by: Amp <amp@ampcode.com>
@CLAassistant

CLAassistant commented Jun 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds preserveInstallExtraModelPaths(), a new exported helper that keeps extra_model_paths.yaml install-local during desktop adoption by detecting, copying, or warning about the file. It introduces EXTRA_MODEL_PATHS_YAML constant, wires the helper into the adoption flow, clarifies computeModelsDirsToCarry() docs to exclude this file from global dirs, extends adoption telemetry, and adds matching tests.

Changes

Install-local extra_model_paths.yaml preservation

Layer / File(s) Summary
Constant and computeModelsDirsToCarry doc clarification
src/main/lib/desktopAdopt.ts
Adds EXTRA_MODEL_PATHS_YAML constant and narrows the computeModelsDirsToCarry() comment to state that only extra_models_config.yaml feeds global model dirs — extra_model_paths.yaml is install-local and handled elsewhere.
preserveInstallExtraModelPaths implementation, adoption wiring, and telemetry
src/main/lib/desktopAdopt.ts
Implements the exported helper with best-effort copy logic (returns true if dest file already exists, copies from basePath otherwise, emits warnings on failure). Called early in the adoption flow with its boolean captured as hasInstallExtraModelPaths, which is then included in the comfy.desktop.adopt.succeeded telemetry payload. That's a real "path-ological" improvement!
Tests
src/main/lib/desktopAdopt.test.ts
Imports preserveInstallExtraModelPaths, extends computeModelsDirsToCarry assertions to confirm extra_model_paths.yaml dirs stay out of the global list, and adds a three-case suite covering dest-exists, dest-missing-copy-from-base, and source-absent no-op.
🚥 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch adopt-extra-model-paths-install-scoped
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch adopt-extra-model-paths-install-scoped

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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 and usage tips.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/lib/desktopAdopt.test.ts (1)

950-956: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Assert the new telemetry flag in the success payload contract.

Please extend this comfy.desktop.adopt.succeeded assertion to include has_install_extra_model_paths_yaml, or telemetry drift may slip through quietly.

🤖 Prompt for 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.

In `@src/main/lib/desktopAdopt.test.ts` around lines 950 - 956, The telemetry
assertion for the 'comfy.desktop.adopt.succeeded' event is missing a check for
the new telemetry flag has_install_extra_model_paths_yaml. Extend the
expect.objectContaining call in the assertion to include
has_install_extra_model_paths_yaml alongside the existing carried_keys check to
ensure this new flag is part of the telemetry payload contract and prevent
telemetry payload drift from going undetected.
🤖 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 57-61: The multi-line comment preceding the EXTRA_MODEL_PATHS_YAML
constant declaration is too verbose and misleadingly suggests the file carries
over globally across model directories, when the actual implementation keeps it
install-scoped. Shorten this comment to a single concise sentence that
accurately describes what the constant is and its install-local scope, removing
narrative details about history and implementation specifics.

---

Outside diff comments:
In `@src/main/lib/desktopAdopt.test.ts`:
- Around line 950-956: The telemetry assertion for the
'comfy.desktop.adopt.succeeded' event is missing a check for the new telemetry
flag has_install_extra_model_paths_yaml. Extend the expect.objectContaining call
in the assertion to include has_install_extra_model_paths_yaml alongside the
existing carried_keys check to ensure this new flag is part of the telemetry
payload contract and prevent telemetry payload drift from going undetected.
🪄 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

Run ID: e59487f6-9c5e-4c93-b769-f11eb099fa8a

📥 Commits

Reviewing files that changed from the base of the PR and between e56f94b and 33a61f9.

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

Comment on lines +57 to +61
// The other model-paths file: ComfyUI auto-loads it from the source dir and
// the launcher displays it read-only. Carried alongside EXTRA_MODELS_YAML so
// its dirs survive into v2's modelsDirs (not just the adopted ComfyUI's own
// search), including in the git-clone source fallback where it isn't copied.
const EXTRA_MODEL_PATHS_YAML = 'extra_model_paths.yaml'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Correct the EXTRA_MODEL_PATHS_YAML comment to match install-local behavior.

Line 57-61 currently implies global modelsDirs carry-over, but the implementation intentionally keeps extra_model_paths.yaml install-scoped, so this comment should be shortened and aligned to avoid future drift.

As per coding guidelines, “Write concise comments — one sentence is better than five paragraphs to justify a small change” and “Don't narrate history in comments (e.g., 'This used to do X, now it does Y'); rely on git log for that information.”

🤖 Prompt for 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.

In `@src/main/lib/desktopAdopt.ts` around lines 57 - 61, The multi-line comment
preceding the EXTRA_MODEL_PATHS_YAML constant declaration is too verbose and
misleadingly suggests the file carries over globally across model directories,
when the actual implementation keeps it install-scoped. Shorten this comment to
a single concise sentence that accurately describes what the constant is and its
install-local scope, removing narrative details about history and implementation
specifics.

Source: Coding guidelines

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants