Correlate legacy Model Manager completion events with the active batch
Problem
The v4 legacy Model Manager sends a batch_id with an installation request, but its batch-done event handler does not compare the received ID with the active request. An unrelated completion can hide Stop and invoke completion handling against an in-progress install context. The Custom Nodes Manager already checks this correlation.
The handler is unchanged from the manager-v4 base. Review consensus accepts this as a separate correctness fix from UI escaping.
Required behavior
- Only completion belonging to the active model batch may finalize that batch's controls/context and show its result.
- Preserve successful and failed completion behavior for the matching batch.
- Keep unrelated node/model batches and stale completions from clearing the active model operation.
- Check the in-progress event path as well as completion for the same ownership assumption; use the existing batch identifier rather than introducing another tracking mechanism.
Validation
- Playwright with the actual legacy UI: start batch A, deliver a nonempty completion for batch B, and verify that A's controls and context remain in progress. Then deliver A's completion and verify the correct terminal state. Establish Red/Green on the previous handler.
- Cover success, failure and stale completion, retaining the ordinary single-batch installation path.
- Use overlapping real backend batches to verify the actual event payload and routing when feasible; distinguish controlled-event tests from end-to-end delivery.
This case is distinct from the user's v3 multi-tab report where a tab never received a WebSocket completion. No shared root cause has been established. Retain that missed-event/reconnect investigation separately; batch filtering alone does not recover a missing event.
Source: Comfy-Org/ComfyUI-Manager