Switching the preserve flag on/off did not retrigger the AutoTuner: the per-LoRA
merge flags (preserve, and already conflict_mode/key_filter) were missing from the
cache keys that gate re-execution.
- New _per_lora_merge_signature(lora_stack): order-independent hash of
(name, conflict_mode, key_filter, preserve), strength-independent.
- LoRAAutoTuner.IS_CHANGED: embed the signature (it only hashed id(lora_stack),
which is content-blind and id-reuse-fragile) so ComfyUI re-invokes the node.
- LoRAMergeSelector.IS_CHANGED: it hashed no stack content at all — add the
signature so a replayed config re-runs when the flags change.
- In-node at_cache_key stack_fp: add preserve (it already had conflict_mode/key_filter).
- Persistent memory_settings (3 sites): add per_lora_flags so settings_hash misses
on toggle instead of replaying a stale ranking. The merge was always correct
(replayed against the live stack); only the ranking could be stale.
- Community shared RANKING is computed without these flags (heuristic, analysis-based)
— skip it when the stack sets any per-LoRA flag and tune locally; analysis caches
(preserve-independent) and uploads are unaffected.
Analysis caches stay keyed on file identity only (conflict/cosine don't depend on
these flags) — correct to keep sharing. 8 new tests (PreserveCacheAwarenessTests); 307 pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>