You are the autonomous megaplan runner for this single run.
Project: /Users/user_c042661f/Documents/reigh-workspace
Idea: Produce a migration plan document for moving reigh-worker's execution backend from Wan2GP to VibeComfy. The two relevant repos live side-by-side in this workspace at ./reigh-worker (current consumer of Wan2GP) and ./vibecomfy (the target replacement). The plan must:
Audit the current reigh-worker → Wan2GP integration: every task type that goes through Wan2GP today, the memory-profile system (lowvram/medvram/highvram/profiled/etc.), model-loading/unloading lifecycle, queue/dispatch shape, error paths, telemetry, and any worker-orchestrator coupling.
Audit VibeComfy's current capabilities: ready_templates, VibeWorkflow IR, validation, embedded local execution, RunPod execution path, and any gaps relative to Wan2GP feature set (especially memory profiles — VibeComfy may not have an equivalent and may need one built).
Identify feature-parity gaps that need to be closed in VibeComfy before reigh-worker can cut over (this likely includes a memory-profile abstraction modeled on Wan2GP's, equivalents for every task type, and any model-management lifecycle Wan2GP provides today).
Propose a sprint-by-sprint migration plan, where each sprint is at most 2 weeks of work. Sprints should be sequenced so that risk is incrementally retired (e.g. shadow / dual-run / canary task types before full cutover) and each sprint has a concrete shippable outcome. Cover: parity work in VibeComfy, an adapter/shim layer in reigh-worker, dual-execution + comparison harness, per-task-type cutover order with selection rationale, rollback plan, telemetry/observability changes, and final Wan2GP removal.
Call out open questions, assumptions, and decision points the user still needs to resolve, plus risks and mitigations.
Important context to weave in:
reigh-worker uses Wan2GP today as its in-process execution backend across multiple task types (image gen, video gen, edits, etc.).
The "memory profiles" feature from Wan2GP is non-negotiable — full parity required before cutover.
VibeComfy is a Python toolkit around ComfyUI workflows with a VibeWorkflow IR, ready_templates, and both embedded-local and RunPod execution. Migration should preserve reigh-worker's external behavior (queue contracts, output shapes, latency SLOs).
The orchestrator (./reigh-worker-orchestrator) provisions GPU workers; coordinate any worker-image / runtime changes with that.
Output mode: doc / metaplan. The deliverable is the plan document itself, not code changes.
Output path: docs/migration-vibecomfy.md (relative to project dir).
Execution mode: auto-approve (configured in raw_config — pass empty AUTO_APPROVE_FLAG)
Robustness: standard (NOT in raw_config — pass --robustness standard)
1. Role & Mission
Your job is to drive the megaplan workflow through the CLI until the run finishes or a defined breakpoint requires the outer conversation.
Always follow these priorities, in order:
The latest user direction relayed through notes or resume messages.
The live CLI state from megaplan status --plan <name>.
The workflow and breakpoint rules in this template.
Your own memory of earlier turns.
Always do these things:
Operate through the megaplan CLI only. Do not call workers or agents directly.
Use the launcher prefix PYENV_VERSION=3.11.11 megaplan ... for every CLI call (bare python is broken on this machine).
Keep the outer conversation clean. Do not ask for routine confirmation.
Use next_step and valid_next for routing. If memory and CLI state disagree, trust CLI state.
Follow orchestrator_guidance after gate unless you have a concrete reason to disagree after checking plan artifacts or repository evidence yourself.
Treat user notes as authoritative.
Never do these things:
Do not run the workflow manually outside the CLI.
Do not skip required phases for the selected robustness level.
Do not emit a breakpoint unless one of the breakpoint rules below says to.
2. Startup
Run: PYENV_VERSION=3.11.11 megaplan init --project-dir [REDACTED] --robustness standard --mode metaplan --output docs/migration-vibecomfy.md "<the idea text above, condensed but complete>"
Capture the returned plan name.
Output PLAN_NAME: <name> on its own line immediately after init and before any BREAKPOINT: or COMPLETE:.
Run PYENV_VERSION=3.11.11 megaplan status --plan <name>.
From then on, use that plan name for every command.
After every later resume:
Read state, next_step, and valid_next.
If notes_count > 0, read the full notes array before acting.
Treat all notes as context.
3. Phase Routing (standard robustness)
init -> prep -> plan -> critique -> gate
Then follow the gate decision tree:
gate_unset (state critiqued, valid_next includes gate): run gate.
gate_iterate (recommendation ITERATE): run revise, then loop critique → gate.
gate_escalate (recommendation ESCALATE): stop with BREAKPOINT: GATE_ESCALATE.
gate_proceed_blocked (recommendation PROCEED but preflight blocked): inspect preflight_results and revise; only break with BREAKPOINT: GATE_BLOCKED if the blocker truly needs the user.
gate_proceed (state gated): run finalize.
After gated: run finalize, then execute, then review.
If review returns needs_rework, loop finalize→execute→review (CLI caps at 3 rework cycles).
4. After Every Phase
Run PYENV_VERSION=3.11.11 megaplan status --plan <name> and re-read state, next_step, valid_next, notes, and orchestrator_guidance before choosing the next command.
5. Breakpoints
Use only for: GATE_ESCALATE, GATE_BLOCKED, EXECUTE_APPROVAL (n/a here, auto-approve), PHASE_ESCALATE, EXECUTE_ESCALATE. Format:
Retry a failed non-execute phase once with --fresh. If it fails again with the same error, retry again with --fresh. If still failing, BREAKPOINT: PHASE_ESCALATE.
Cap execute at 3 consecutive no-progress attempts → BREAKPOINT: EXECUTE_ESCALATE.
review needs_rework is normal — don't break out, just loop.
8. Execution Details
After gated: PYENV_VERSION=3.11.11 megaplan finalize --plan <name>.
For per-batch execution if the briefing requests it, use --batch N with global 1-indexed numbering and poll progress between batches.
10. Completion Format
code
COMPLETE: megaplan run finished
Plan: <name>
Final state: <state>
Summary: <outcome>
Artifacts: <key files or reports — include the final docs/migration-vibecomfy.md path>
Follow-up: <only if something remains>
Run autonomously to completion. Do not stop for routine confirmations.
Assistant
I'll start by initializing the megaplan run with the provided idea and configuration.
Assistant
PLAN_NAME: produce-a-migration-plan-20260505-0555
Assistant
Gate says ITERATE. Let me run revise.
Assistant
Codex worker timed out. Per safeguards, retry once.
Assistant
Per safeguards, retry once more with --fresh.
Assistant
Codex timed out again. Retry with --fresh.
Assistant
Gate says PROCEED. Now run finalize.
Assistant
I'll wait for the execute to complete using Monitor on the megaplan status.
Assistant
Execute is running in background. Will be notified by the monitor when state transitions out of execute.
User
You are extending an existing migration plan document. Don't rewrite it — augment it with a missing technical layer it currently lacks.
The doc
/Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md (~830 lines, 89KB) plans the migration of reigh-worker from Wan2GP to VibeComfy as its execution backend. It has good plumbing/sequencing coverage (sprint plan, two adapter seams, memory profiles, cutover cohorts) but stops at gap-enumeration for the actual rendering recipe. Read it before you do anything else so your edits dovetail with existing structure.
What's missing
Two related gaps the user has flagged:
Per-task-type template mapping triage — for each runtime task type in reigh-worker, classify into:
NATIVE — runnable today against an existing vibecomfy/ready_templates/** template with at most parameter wiring.
ADAPT — close to an existing template but needs concrete edits (added/removed nodes, swapped LoRA loaders, added control rails, output shape change). Spell out what edits.
NEW — no usable template exists; a new one must be authored. Spell out which model family / which existing ComfyUI workflow to base it on / what it needs to accept and emit.
Control + LoRA sophistication coverage — the doc lists these as gaps but doesn't say how the migration recreates them. Fill in:
LoRA stacking and key sanitization — Wan2GP uses a key-tolerance patch (reigh-worker/source/models/wgp/wgp_patches.py:384-483), Qwen LoRA directory/parser/inpainting patches, and LoRA caching. What is the equivalent VibeComfy mechanism? Is it a VibeComfy patch on LoraLoader nodes? Multiple LoRAs with weights? How are mismatched keys handled (sanitizer node vs pre-load filter)? Walk one concrete example — e.g. a Qwen LoRA workflow — through the new path.
Control rails (Canny / Depth / DWPose / Flow / Uni3C) — which are pre-processed before workflow build vs realised inside the workflow as ControlNet nodes? What does the VibeComfy IR look like with a control rail bolted on? How does the Uni3C cache (reigh-worker/source/models/wgp/model_ops.py:234-260) get reproduced — is it a VibeComfy session-scoped cache, a patch, or runtime-managed outside the IR?
Travel continuity / VACE guidance — travel_segment chains segments where each segment's last frames seed the next. The doc identifies the seam (context["task_queue"], _handle_travel_segment_via_queue_impl) but doesn't pin which template a travel_segment uses, how flows in, or how stitch () works. Pin this.
Assistant
I'll start by reading the existing doc and the investigation surfaces in parallel.
Assistant
Now I have the full doc. Let me investigate VibeComfy mechanics, key reigh-worker WGP files, and look at a sample template.
Assistant
Acknowledged. Now let me look at the LoRA, Uni3C, travel, and patch surfaces.
Assistant
I have enough context. Now let me check task_types catalog and a few last spots, then write the patch.
Assistant
No Uni3C in ready_templates. Now let me check controlnet templates for Wan 2.2:
Assistant
I now have enough material. Let me locate the insertion points in the doc and write the patches.
Assistant
Now I will insert Section 1A before Section 2 (i.e., at line 259 where ## 2. Audit VibeComfy capabilities starts).
Assistant
Now Section 3A. Find where Section 3 ends (Section 4 starts at line 525, but with Section 1A inserted, the line numbers shifted). Let me locate by anchor.
Assistant
Now patch Section 5 to surface dispositions, and Section 9 with new risks/questions.
Assistant
Now patch Section 9 — add new open questions and risks.
Assistant
Update the Table of Contents to reflect new sections.
Assistant
Let me verify the structure is intact.
Assistant
Structure is clean. Sections 1A, 3A inserted in the right places, and TOC updated.
Report:
Edits to /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md (832 → 1023 lines):
Section 3A — Control rails, LoRA stacking, and pre-processing — concrete recipes (LoRA sanitizer + Qwen worked example, per-rail Canny/Depth/DWPose/Flow/Uni3C decisions with a Wan I2V + Uni3C IR sketch, travel-continuity template pinning + video_source flow, Qwen prompt expander = pre-process).
Section 5 patched — added a Template readiness (per 1A) column with NATIVE/ADAPT/NEW per cohort, and added template-readiness clauses to each Entry gate.
Section 9 patched — 5 new open questions (Q13 Uni3C cache home, Q14 WanVideoUni3CController node availability, Q15 LTX 2.3 version-bump acceptance, Q16 Flux Klein variant choice, Q17 Wan 2.2 cocktail under kj-wrapper) and 5 new risks (Hunyuan NEW under-spec, Wan 2.2 VACE NEW fallback, Uni3C cache outside public surface, LoRA sanitizer corpus gap, custom_nodes lockfile drift).
hunyuan — only true NEW; blocks Cohort D; basis named (HunyuanVideo official Comfy workflow) but T2V-vs-I2V undecided.
wanvideo_wrapper_22_vace — flagged as ADAPT-with-NEW-fallback; blocks vace_22, inpaint_frames, join_clips_segment, Wan-family travel_segment. Q17 asks whether the kj-wrapper graph accepts the 2.2 cocktail; if not, this becomes a second NEW author task in Sprint 4.
Ambiguous evidence calls I made:
Routed ltxv (WGP ltxv_13B legacy) to ltx2_3_t2v.py as accepted version-bump divergence (Q15) — no legacy LTX template exists; alternative was a NEW.
Default Flux Klein → 4b_t2i to avoid the GGUF custom-node dependency (Q16).
Uni3C cache → reigh-worker-side runtime dict + before_run hook (Q13/Q14), since EmbeddedSession exposes no public weight-cache hook in vibecomfy/vibecomfy/runtime/session.py:35-53.
LoRA sanitizer → patch on monkeypatching comfy.utils.load_torch_file over LoraLoader* graph nodes (analogous WGP boundary), rather than introducing a new sanitizer custom node.
User
You are deepening an existing migration plan doc with concrete investigation into ambiguous decisions a prior subagent made on incomplete evidence.
The doc
/Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md — ~1023 lines. Plans the migration of reigh-worker from Wan2GP to VibeComfy. Read it first; you'll be appending into existing sections, not rewriting.
What's missing
The doc currently records 5 open questions (Q13–Q17) and 4 ambiguous decisions where the prior pass guessed because evidence was thin. The user wants the doc to do the actual investigation rather than punt with ?. For each item below, ground the answer in real code/template inspection and write the resolution into the doc — or, if it genuinely can't be resolved without runtime verification or a maintainer call, sharpen the question into something testable in Sprint 0/1 (with the exact command or file to inspect).
Items to investigate
A. Q17 / Wan 2.2 VACE — does the kj-wrapper graph accept the 2.2 cocktail?
The high-stakes one. wanvideo_wrapper_22_vace is marked ADAPT-with-NEW-fallback; if it falls back to NEW, Sprint 4 silently doubles in scope.
Action:
Read vibecomfy/ready_templates/video/wanvideo_wrapper_* (every Wan kj-wrapper template).
Read vibecomfy/ready_templates/video/wanvideo_wrapper_13b_vace* if present — that's the existing VACE basis.
Check whether the wrapper accepts Wan 2.2's high-noise/low-noise dual-model + Lightning LoRA pattern. The cocktail is described in §3 of the doc — find the WGP definition and the Comfy node structure that would replicate it.
Look at vibecomfy/blocks/ for any wan-2.2-specific blocks.
Read reigh-worker/Wan2GP/defaults/wan_2_2_vace_lightning_baseline_2_2_2.json (or the closest filename — grep first) for the actual config the worker uses today.
Output: a short subsection in §3A under "Control rails / Wan VACE" with one of three verdicts:
ADAPT confirmed — kj-wrapper accepts the cocktail; concrete patch list.
NEW confirmed — kj-wrapper does not accept it; new template basis named (which Wan 2.2 Comfy workflow), node graph sketched, target sprint reaffirmed.
Verifiable in Sprint 0 — exact command (e.g. python -c "from vibecomfy.ready_templates.video.wanvideo_wrapper_X import build; w = build(...); print(w.compile('api'))") that decides it before Sprint 4 commits.
B. Q13/Q14 / Uni3C cache home
Decision was "reigh-worker-side runtime dict + before_run hook" because () had no public weight-cache hook.
Assistant
I'll start by reading the migration doc to understand the current state, then investigate each item.
Assistant
The file is large; let me read it in chunks and explore the investigation surface in parallel.
Assistant
Critical: there's NO wanvideo_wrapper_22_vace* template. Let me read more of the doc and explore the Wan VACE 2.2 question.
Assistant
Now let me look at the key files for the investigation in parallel.
Assistant
Now let me look at the wanvideo_wrapper templates, lock file, and the wgp_patches sanitizer.
Assistant
Uni3C IS referenced in 2.2 controlnet workflows. Let me look at them.
Assistant
The 22 5b controlnet uses WanVideoControlnetLoader (a different ControlNet path, not Uni3C). Let me check the 13b vace template for sampler structure & whether it can host the 2.2 cocktail (multi-LoRA + dual model + lightning).
Assistant
Critical: the 13b vace template has THREE separate sampler chains (single-stage WanVideo samplers with steps=1) but no LoRA loader, no WanVideoLoraSelectMulti, and no model-switching mid-sampler. Let me check the 21_14b_t2v template that DOES have LoRA multi to confirm the pattern.
Assistant
This 22 s2v template uses WanVideoSetLoRAs (one applies all LoRAs to one model). Single ModelLoader, single WanVideoSampler — no high-noise/low-noise dual-model split.
Now let me check the wan2.2 cocktail config and what defines a "cocktail" — is it really dual-model or just lightning LoRAs.
Assistant
Confirmed the 2.2 cocktail uses dual models (URLs=HIGH, URLs2=LOW) plus model switching at threshold + lightning LoRAs. Let me check Comfy 2.2 native workflow patterns to know if there's a known kj-wrapper graph that does this.
Assistant
Confirmed: NO 14B Wan 2.2 VACE workflow in the corpus. There is no template path for vace_14B_cocktail_2_2. Let me check the kj-wrapper README/source for whether WanVideoModelLoader supports a second model_2/low_noise input.
Assistant
ALL 22 templates use a SINGLE WanVideoModelLoader and SINGLE WanVideoSampler (the 5B "TI2V" model is unified, not dual). The cocktail's HIGH/LOW dual-model phase-switch pattern is NOT represented in any existing kj-wrapper ready template. Let me check the 21 14b i2v template which is the closest 14B basis.
Assistant
All single-loader/single-sampler. The kj wrapper uses WanVideoSetLoRAs to apply LoRAs to one model. To do dual-model HIGH/LOW phase switch, you need either:
Two WanVideoModelLoader nodes feeding into something like a model-switch sampler/composite
A multi-stage chain with two samplers
Now look at remaining items: ltxv config, flux defaults, ltx2_3_t2v, flux templates.
Assistant
So WGP flux task type is Flux.1 Dev 12B (not Flux Klein!). Flux Klein is a totally different model (Black Forest Labs newer release). This is a real divergence; let me verify the 4b_t2i template for what it loads.
Assistant
Flux Klein's UNETLoader uses flux-2-klein-base-4b.safetensors — confirmed Klein is a different model from FLUX.1 Dev that WGP flux task ships. Let me also check vibecomfy patches and runtime/run.py briefly.
Assistant
ComfyUI-WanVideoWrapper checkout exists. Let me check whether it has Uni3C controller or WanVideoVACE 2.2 nodes.
Assistant
Excellent! WanVideoUni3C_ControlnetLoader and WanVideoUni3C_embeds exist. Let me check the loader and dual-model patterns:
Assistant
Critical findings:
WanVideoSampler takes a single model input, not high+low models. There's NO native dual-model phase-switch sampler. To replicate the cocktail's HIGH/LOW switch, you'd need TWO WanVideoSampler chains (with the second one taking the latent from the first as samples for v2v continuation), each with its own WanVideoModelLoader.
uni3c_embeds is an OPTIONAL input on WanVideoSampler (not "controlnet"). The Section 3A IR sketch was wrong about the slot name.
WanVideoUni3C_ControlnetLoader loads from models/controlnet/ — Comfy's standard folder. It has no built-in caching across runs (it just calls load_torch_file each invocation).
Now let me check a couple of patches files for hooks and check qwen template for LoRA stack:
Assistant
Confirmed: VibeComfy has NO public hook surface (no before_run, no run hook, no session-attached cache primitive). Patches are pure graph mutations. Section 3A's "before_run hook" approach was speculative.
Now I have enough evidence. Let me make all the edits to the doc.
Assistant
Now I have all the evidence I need. Let me make the edits.
Edit 1: Q17 — Wan 2.2 VACE verdict (NEW confirmed)
Assistant
Edit 2: Q13/Q14 — Uni3C cache, real custom node names
Assistant
Edit 3: Q15 ltxv — verify version-bump escalation. Now let me check whether LTX 2.3 vs LTX 0.9.8 13B is materially divergent.
The key data:
WGP ltxv_13B: LTX-Video 0.9.8 13B (Lightricks) — Wan2GP/defaults/ltxv_13B.json:4-9. The doc says "It is recommended to keep the number of steps to 30."
VibeComfy ltx2_3_t2v.py:51-52: LTX 2.3 22B (ltx-2.3-22b-dev.safetensors) with distilled LoRA. Step count via custom sigmas — "1.0, 0.99375, ..." — about 8 steps.
These are different generations of LTX (0.9.8 vs 2.3), different sizes (13B vs 22B), different sampling, different VAE. This is materially different. Let me update the LTX row.
Assistant
Edit 4: Q16 Flux — expand Flux row to per-variant and document divergence
Assistant
Edit 5: LoRA sanitizer — keep the monkeypatch decision but cite real key examples and consider the alternative
Assistant
Now I need to fix the next paragraph since I introduced "Multiple LoRAs" and the original "Multiple LoRAs with weights." follows:
Assistant
Edit 6: Update §9 open questions — close Q13/Q14/Q15/Q16/Q17 and add new risks
Assistant
Edit 7: Update §9 Risks — adjust Wan 2.2 VACE risk now confirmed NEW
Assistant
Edit 8: Update §1A flux row was already replaced with NEW; let me also update the §1A wan_2_2_t2i row reference. And I need to look at §1A vace_22 row which needs updating with the NEW template name.
Assistant
Also update inpaint_frames and join_clips_segment to reference NEW:
Assistant
Update travel_segment row similarly to point to the new NEW template for the Wan family path.
Assistant
Now update the disposition counts.
Assistant
Let me verify the final doc by spot-checking the modified sections compile cleanly:
Assistant
Added ~94 lines (1023 → 1117), well under the 250-line budget. Investigation complete.
Report
Closed with definitive verdicts:
A. Q17 Wan 2.2 VACE — NEW required (escalation). All existing kj-wrapper templates are single-loader/single-sampler. WanVideoSampler.INPUT_TYPES (ComfyUI-WanVideoWrapper/nodes.py:2596-2638) has no model_2/low_noise_model/switch_threshold. The HIGH/LOW dual-model phase-switch in Wan2GP/defaults/vace_fun_14B_2_2.json:7-15 cannot be expressed via widget swap. Sprint 4 must author wanvideo_wrapper_22_14b_vace_cocktail.py with two WanVideoModelLoader + two-stage WanVideoSampler chain + sigma cut-over.
B. Q13/Q14 Uni3C — both closed; no reigh-worker dict, no shim.WanVideoUni3C_ControlnetLoader and WanVideoUni3C_embeds exist in ComfyUI-WanVideoWrapper/uni3c/nodes.py:16-149. WanVideoSampler accepts uni3c_embeds (not controlnet) at nodes.py:2635. EmbeddedSession.run has zero hooks (verified). Plan: pure graph-level patch; rely on Comfy's native model_patcher cache. Documented profile-5 (cache_policy="none") caveat.
C. Q15 ltxv — NEW required. WGP loads LTX 0.9.8 13B (ltxv_13B.json:8); VibeComfy's ltx2_3_t2v.py:51-56 loads LTX 2.3 22B with a different VAE/sampler. Different model generation, not a version bump.
D. Q16 Flux — NEW required. WGP flux is FLUX.1 Dev 12B (flux.json:3-9); all flux2_klein_* templates load Flux 2 Klein (flux-2-klein-base-4b.safetensors) — different model entirely.
E. LoRA sanitizer — pre-process file rewrite chosen, monkeypatch rejected. Three concrete reasons documented (no EmbeddedSession extension point, load_torch_file is too broad, no narrow Comfy seam analogous to WGP's get_loras_preprocessor). Cited the actual key classes from wgp_patches.py:411-419,460-468.
Sharpened to Sprint-0 verifications: Q13 uni3c patch compile test, Q17 single-line guard against future kj-wrapper dual-model API, Q18 (new) two-stage trajectory parity vs Q3 thresholds, Q19 (new) module-name table generation.
New risks surfaced: two-stage sampler vs WGP single-sampler trajectory drift (Q18); profile-5 disables Comfy's controlnet cache and revives the 2-min Uni3C reload; LoRA sanitizer needs per-architecture module-name tables (Q19).
Headline finding: Q17 escalates Sprint 4 from 1 NEW (Hunyuan) to 2 NEW (Hunyuan + Wan 2.2 VACE cocktail). Sprint 5 adds 2 more NEW (LTX 0.9.8 13B + FLUX.1 Dev 12B). Total NEW templates rose from 1 to 4 (5 with deferred Flux variants). Disposition row counts in §1A: 16 ADAPT → 11; 1 NEW → 7. All edits in /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md.
User
You are auditing the reigh-app frontend repo to determine which task_type values it actually emits to the queue today, so a downstream migration can be scoped to only what's in production use rather than every task the worker can handle. Hunyuan, in particular, is suspected to be unused — verify.
Repos
/Users/user_c042661f/Documents/reigh-workspace/reigh-app — the frontend (Next.js / TypeScript / Supabase edge functions, judging by .nixpacksignore/.railwayignore/.nvmrc).
/Users/user_c042661f/Documents/reigh-workspace/reigh-worker — the consumer side. Its task_registry.py:1442-1511 defines 14 dispatch keys; its task_types.py:TASK_TYPE_CATALOG defines the broader task-type catalog. The migration doc at /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md §1 enumerates 35 runtime task types.
What to determine
For every task_type the worker can handle, classify it as:
USED-IN-APP — the frontend (UI buttons, edge functions, API routes, server actions, scheduled jobs) actively emits this task_type today. Cite the call site.
USED-INDIRECTLY — the frontend doesn't emit it directly, but a USED-IN-APP task type creates it as a child task. (E.g. travel_segment is a child of travel_orchestrator.)
UNUSED — no call site found in the app or its edge functions; not produced as a child by any USED task either.
AMBIGUOUS — referenced in code but behind a feature flag, dead code path, or admin-only debug surface.
For each task_type, also note which model defaults it uses if the app pins one (e.g. an edge function passes model: "wan_2_2_t2v" — that pins the model variant; affects the migration template choice).
How to find call sites
Likely search patterns (grep across the reigh-app repo):
task_type / taskType / 'travel_orchestrator' / 'magic_edit' / etc. — direct task_type literals
API route handlers: app/api/, pages/api/, or edge function dirs (supabase/functions/)
Server actions: anything calling into the queue table
Assistant
I'll audit the reigh-app repo to determine which task_types are actually emitted. Let me start by exploring the structure and the migration doc.
Assistant
Now I have a strong picture of the runtime task surface. Let me audit the reigh-app for actual usage of these task types.
Assistant
Hunyuan: only philosophy substring matches, not actual hunyuan. Let me confirm with stricter search and continue with all other task types.
Assistant
Hunyuan: zero hits confirmed. Let me focus on create-task resolvers (the place that actually defines task types emitted to the queue).
Assistant
Now let me dive into each resolver to understand the actual task_types emitted (the taskType parameter ultimately becomes the worker's task_type value). I need to find what each resolver passes for taskType.
Assistant
Image generation emits: qwen_image_style, qwen_image, qwen_image_2512, z_image_turbo, wan_2_2_t2i. Let me check more resolvers.
Assistant
Let me check the joinClips.ts for actual taskType emission and the individualTravelSegment.ts task_type, plus look for additional places that might emit task types.
Assistant
There is a generic task_types DB table with a passthrough resolver. Let me check what's in task_types and taskConfig.ts for the canonical list.
Assistant
Now let me check usage of magic_edit, flux, comfy, inpaint_frames, generate_video, t2v, i2v, i2v_22, t2v_22, vace, vace_21, ltxv, ltx2, qwen_image_hires, wan_2_2_i2v in the actual app and the create-task family routing.
Assistant
Now I have strong evidence:
wan_2_2_i2v is emitted as a task_type by travelBetweenImages turbo mode (line 315) — this is NOT in the worker registry/catalog list. It's actually... let me check.
flux, t2v, i2v, i2v_22, t2v_22, vace, vace_21, vace_22, ltxv, ltx2, qwen_image_hires, comfy, inpaint_frames, generate_video, magic_edit, hunyuan — none appear as task_type literals being emitted from app.
Let me confirm the magic_edit resolver actually outputs qwen_image_edit (we saw that in magicEdit.ts:139 — it outputs qwen_image_edit, not magic_edit!), and check wan_2_2_i2v definition.
Assistant
magic_edit family is used (lightbox hook line 230) — it routes to magicEditResolver which emits qwen_image_edit task type, not magic_edit. So the worker-side magic_edit task_type is UNUSED. Let me verify.
Assistant
That's a separate render-timeline task type going to a different worker (banodoco), not the reigh-worker queue. Not relevant.
Now let me check wan_2_2_i2v — is that a worker task type? It's not in the migration doc's catalog. Let me check the worker's task_types.py:
Assistant
OK so wan_2_2_i2v does NOT exist in the worker registry as a task type — frontend's turbo mode emits a task_type that the worker can't handle?? Let me check the actual worker handler routing:
Assistant
So wan_2_2_i2v task_type is sent only when turbo_mode === true in travel-between-images. Note: travel-between-images sets model_name: "wan_2_2_i2v_lightning_baseline_2_2_2" (a model variant string), while the resolver dispatches a wan_2_2_i2v task_type when turbo. But this is NOT in the worker's TASK_TYPE_TO_MODEL — meaning either it's a dead path, or the worker treats it as i2v_22 somehow. Let me check.
Assistant
Let me check what tasks would actually currently be sent for travel turbo_mode and inspect references to make sure this is a real production path.
Assistant
wan_2_2_i2v task_type is emitted in turbo mode. Since it's not in the worker registry, this is either dead code or routed by some other mechanism. Either way, it's emitted. Mark as AMBIGUOUS / app emits but worker doesn't handle it. Since this audit is about what the app emits (which the migration must support), but the migration scope is the worker's task types — wan_2_2_i2v itself isn't in the migration's catalog, so it's outside scope. Let me note it as a discrepancy.
Now let me look for more usage signals — inpaint_frames, flux, comfy, qwen_image_hires, extract_frame, rife_interpolate_images, generate_video, t2v, i2v, i2v_22, t2v_22, vace*, ltxv, ltx2:
Assistant
No frontend create-task path emits flux, comfy, hunyuan, inpaint_frames, generate_video, qwen_image_hires, extract_frame, t2v, t2v_22, i2v, i2v_22, vace, vace_21, vace_22, ltxv, ltx2, magic_edit, create_visualization. Let me also look at how travelBetweenImages resolver builds child tasks and whether complete_task cascade creates children:
Assistant
Good. So travel_segment, join_clips_segment, join_final_stitch, travel_stitch, individual_travel_segment are the segment types tracked. They're created by orchestrators (worker-side), with the exception of individual_travel_segment (sometimes created by the app for re-gen) and travel_stitch (created by crossfade_join family).
Now confirm migration §3/§3A/§4/§5/§9 references and gather the model variants emitted by the app:
Assistant
Now I have a complete picture. Let me also do final confirmation grep on specific items:
Assistant
Good — single_image and image_edit are stored in DB but not emitted by current frontend. Now let me write the migration doc patches. The audit results:
Confirmed: joinClips.ts emits join_clips_orchestrator. Now I have the full picture. Let me also check image-upscale — note imageUpscale.ts:80 uses "image-upscale" (with hyphen), not image_upscale. Not in the worker catalog — outside migration scope.
Let me also check flux_klein_edit, animate_character, video_enhance — those are emitted by the app but not in the worker's task_registry/TASK_TYPE_CATALOG either, so they're outside the migration scope (different worker / Replicate / etc.).
Final mapping (worker task types per the migration doc's catalog of 35):
Let me check inpaint_frames once more — since worker handler creates child WGP tasks but is itself a top-level task type:
Assistant
inpaint_frames is UNUSED in the app (0 hits). The worker has the handler but app never enqueues it.
Let me check if the orchestrator handlers create inpaint_frames:
Assistant
None of the orchestrators (travel, join, edit_video) create inpaint_frames/magic_edit/comfy/hunyuan/flux/t2v/i2v etc. as children. Confirmed UNUSED.
Now let me also check what travel orchestrator children are: it creates travel_segment and travel_stitch. Join orchestrator creates join_clips_segment + join_final_stitch. So:
travel_segment = USED-INDIRECTLY (child of travel_orchestrator)
join_clips_segment = USED-INDIRECTLY
join_final_stitch = USED-INDIRECTLY
Now I have what I need. Let me make the patches to the migration doc.
Assistant
Now patch §1A — add Required by app? column and mark UNUSED rows. The §1A table already has the rows; I'll update the header and rows. Let me also update the disposition counts paragraph at the end of §1A.
Assistant
Let me re-read the actual rows with precise text:
Assistant
Now I'll do the edits row by row to lines 346-364 (the §1A table). Let me do them as individual edits since the unique lines are small.
Assistant
Now patch the disposition counts paragraph at the end of §1A:
Assistant
Now patch §3 Parity Gap Matrix to mark Hunyuan parity row as REMOVED:
Now §3 template registry table — mark Hunyuan/UNUSED rows:
Assistant
Now patch §4 (Sprint plan) — Sprint 4 and 5:
Assistant
Now patch §5 (Cohort table) — drop UNUSED task types from each cohort:
Assistant
Now patch §9 risks — close Hunyuan-template/Flux/LTX-13B risks since UNUSED:
Assistant
Now add a new risk for "UNUSED but might revive" — but the user said only if there's evidence in app's todos/issues/feature-flag scaffolding. Let me check briefly:
Assistant
No evidence of planned revival. Skipping that risk. Let me also add a final §9 risk about "Frontend turbo-mode emits unhandled task type":
Sprint 4 NEW count: 2 → 1 (Hunyuan removed; Wan 2.2 VACE cocktail kept — required indirectly via the travel_segment/join_clips_segment/individual_travel_segment paths whose default model is wan_2_2_vace_lightning_baseline_2_2_2).
Sprint 5 NEW count: 2 → 0 (FLUX.1 Dev removed; LTX legacy 13B removed — both UNUSED).
Cohorts C and D collapse entirely as direct task types; Cohort E becomes the dominant migration cohort because production video reaches the worker exclusively through travel_orchestrator.model_name (Wan 2.2 / LTX variants), not via direct video task types.
User
You are auditing the reigh-app and reigh-worker repos for cruft, dead code, and feature scaffolding that should be deleted as part of the Wan2GP→VibeComfy migration. The user wants to bundle a cleanup pass into the migration rather than carry forward dead surface area.
Context
The migration plan lives at /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md. Read its §0A first — that section already classified 18 of 35 worker task types as UNUSED-by-app and 4 surprises (turbo-mode wan_2_2_i2v, dead magic_edit worker task type, dead qwen_image_hires, all dead vace*/t2v*/i2v* direct task types).
The user has now confirmed: delete turbo-mode travel entirely, and use this opportunity to clean up other cruft they've been carrying.
Two definite deletions (already user-approved)
Turbo-mode travel. Per §9, reigh-app/supabase/functions/create-task/resolvers/travelBetweenImages.ts:315 emits task_type: "wan_2_2_i2v" when input.turbo_mode === true, which the worker doesn't dispatch on. Trace the entire turbo_mode surface in reigh-app: UI toggles, params, resolvers, model selection branches, anything labelled turbo. Spec the deletion (frontend toggle + resolver branch + any worker-side residue).
The 18 UNUSED worker task types and their handlers. From §0A: hunyuan, flux, t2v, t2v_22, i2v, i2v_22, vace, vace_21, vace_22, ltxv, ltx2, generate_video, qwen_image_hires, magic_edit, inpaint_frames, comfy, create_visualization, extract_frame, rife_interpolate_images. For each, identify:
The handler file(s) to delete (e.g. reigh-worker/source/task_handlers/magic_edit.py).
The dispatch entries to remove from task_registry.py:1442-1511 and task_types.py:TASK_TYPE_TO_MODEL.
Friendly-name entries in display_names.py:8-39 to delete.
Any tests that exclusively cover these task types (delete) vs tests that touch them as a side-effect of broader test (just remove the assertion).
Any model-defaults files in reigh-worker/Wan2GP/defaults/ that are reachable only from these task types.
Caveat to verify per task type: is this handler reached by anything other than the app? Cron jobs, internal admin tools, the orchestrator itself, internal scripts, dev/test fixtures? If yes, classify as "keep but mark deprecated" rather than delete.
Assistant
I'll start by reading the migration doc and the key files referenced, then expand the audit.
Assistant
Now let me read sections 8 and 9 of the migration doc.
Assistant
Now I have the full picture of the migration doc. Let me start the audit. First, the turbo mode trace.
Assistant
Good, ripgrep was running in the reigh-app dir. Let me view the key turbo_mode source.
Assistant
Important - the turbo toggle is already commented out as DISABLED. Let me check what other paths can still set turboMode = true.
Assistant
Good — turbo is essentially dead UI: the toggle is commented out, no place sets turboMode true except in tests. Let me confirm AI agent tool path.
Assistant
Now let me audit the worker-side surface. Given the cwd resets between calls, use absolute paths.
Assistant
Now check the magic_edit handler and other UNUSED handler files.
Assistant
Good — rife_interpolate_images_to_video (helper) is used by travel guide; only the task_handlers/rife_interpolate.py wrapper and dispatch entry are dead.
Assistant
The defaults dir is the upstream Wan2GP submodule — Sprint 8 will already remove the whole Wan2GP/ directory, so model defaults aren't an extra cleanup target.
Assistant
Now check klein_edit / flux_klein_edit and a few feature flag patterns.
Assistant
klein_edit is actively wired in app. It's a separate flow outside the WGP migration scope.
Assistant
Now let me check important worker pieces — feature flags, env vars.
Assistant
Worker side: check pyproject scripts and feature flags.
Assistant
Both [project.scripts] and [tool.headless_wan2gp.entrypoints] duplicate ALL 5 entries — not just headless_wgp. The migration doc Q12 says only the headless_wgp is duplicate. Let me verify and check worker_startup.template.sh profile path.
Assistant
Now let me check the Sprint 8 deletion list — I need to understand which UNUSED handlers are already covered by Sprint 8 (because §8 already lists task_handlers/* via the Option A sweep).
Looking again at the §8 sweep additions list (lines 1058-1065), the §8 sweep explicitly already lists rife_interpolate.py to delete. But others (magic_edit.py, extract_frame.py, inpaint_frames.py, create_visualization.py) are NOT in the sweep list — those are the ones the user wants me to add.
I have enough context. Let me also check examples and worker matrix.
Assistant
Now I have plenty. Let me also check magicEdit.ts for vestigial magic_edit literal.
Assistant
Good. magicEdit emits only qwen_image_edit — never the literal "magic_edit". Now let me check what the existing §8 sweep additions list for rife_interpolate.py:
Looking back at the §8 block (lines 1058-1065):
task_handlers/rife_interpolate.py IS in the sweep list
task_handlers/tasks/{task_conversion.py,task_registry.py,task_types.py} IS in the sweep list (whole files retired)
So task_registry.py and task_types.py will be deleted entirely as part of the WGP migration since they ARE the WGP task surface. The "UNUSED handler" cleanup specific to §8A is really the dead handler files (magic_edit.py, extract_frame.py, inpaint_frames.py, create_visualization.py) plus their tests/examples and the display_names entries.
Let me also verify the worker's i2v_22 vs wan_2_2_i2v alignment.
Assistant
Confirmed — wan_2_2_i2v is not a worker task type. The string in app would crash if it ever fired. The toggle is commented-out, but the resolver branch isTurboMode ? "wan_2_2_i2v" : "travel_orchestrator" is dead code that would corrupt prod if some path slipped through (e.g., AI agent tool-schema still accepts it).
Now I have everything I need. Let me write the patches.
Assistant
Now let me insert §8A before §9 (line 1081). First, patch §9 to close the turbo question, patch §4 sprint table, patch §8 to add dead-handler enumerator, then insert §8A.
Patch 1: Add §8A as a new section, inserted just before ## 9. Open questions...:
Assistant
Now patch §8 to add the dead-handler enumeration in the additions section, and patch §4 + §9.
Assistant
Now patch §4 to expand Sprint 8 and add Sprint 8B:
Assistant
Now patch §9 to close the turbo-mode question and update Q12.
Assistant
Now update the open-question and risk row about wan_2_2_i2v / turbo-mode:
Assistant
Also update §0A's flagging line (line 147) to reflect closure:
Assistant
Quick sanity check that the doc parses.
Assistant
All sections present. Doc structure is good.
Report
Turbo-mode deletion (§8A.A):
~50 files touched across reigh-app/; ~250 LoC removed.
Surprise: the toggle is already commented out as DISABLED at BatchSettingsForm.tsx:532-556. Zero non-test code paths set turboMode: true. The dead task_type: "wan_2_2_i2v" resolver branch survives only because the surrounding plumbing was never deleted. The AI-timeline-agent tool-schema (tool-schemas.ts:303-306) still exposes turbo_mode as a callable parameter, so the LLM could in theory trigger it — that's the only live emission path and it points at a worker that doesn't recognize the task type.
Includes a new Supabase migration to strip the persisted JSON key from travel_settings, raw_settings, share_data.
UNUSED handler purge (§8A.B):
18 task types audited.
DELETE-NOW (Sprint 8): 18. All 18 UNUSED rows can be removed. 5 dedicated handler files: magic_edit.py (226 LoC), inpaint_frames.py (327), extract_frame.py (80), create_visualization.py (140), models/comfy/comfy_handler.py (191). Plus qwen_handler.handle_qwen_image_hires method, examples/inpaint_frames_example.py, the extract_frame entry in dispatch_manifest.py and specialized_dispatch.py.
DEPRECATE: 0. No external consumers found.
KEEP-DESPITE-UNUSED: 1 partial — rife_interpolate_images. The dispatch wrapper at task_handlers/rife_interpolate.py is dead, but the underlying rife_interpolate_images_to_video helper at media/video/travel_guide.py:38 is still consumed by travel/api.py and travel/guidance/guide_video_ops.py.
This also closes Q9 (raw comfy task fate): no longer "preserve via VibeComfy delegation", now "delete."
Top 5 additional cruft findings (§8A.C):
Q12 escalation: [tool.headless_wan2gp.entrypoints] in reigh-worker/pyproject.toml:160-165 duplicates ALL 5 entries from [project.scripts], not just headless_wgp. No consumer.
table at — zero consumers.
User
You are auditing the migration plan at /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md for functional parity completeness on travel segments, specifically the matrix of structural-control mechanisms a travel segment can apply today, and whether every combination has a concrete VibeComfy wiring.
The user's concern
A travel segment today can be configured in many ways — different model families (Wan 2.1 / Wan 2.2 / LTX), different generation modes (i2v, vace), different structural controls bolted on (Canny / Depth / DWPose / Flow / Uni3C / mask), different continuity inputs (first-frame, last-frame, video_source for inter-segment chaining), different LoRA stacks. The user wants confidence that every combination the app actually exposes today maps cleanly to a VibeComfy wiring after migration — not just the happy path.
But there's no single explicit matrix table for travel-segment-style tasks proving every (model family) × (model_type i2v|vace) × (structural control rail) × (continuity input) × (LoRA stack) combination is covered.
Your job
Build that matrix from first principles by reading the actual code, then patch the doc.
Step 1 — Enumerate the configuration surface
Read these files and emit a pre-edit reconnaissance summary:
reigh-app/supabase/functions/create-task/resolvers/travelBetweenImages.ts — every input the app exposes; full union of model_name, model_type, generationTypeMode, structural-control fields, LoRA fields, mask fields, continuity fields.
reigh-app/supabase/functions/create-task/resolvers/individualTravelSegment.ts — same for the lightbox regen path.
reigh-app/src/shared/lib/tasks/travelBetweenImages/taskTypes.ts — input type definitions (includes the three stale TODOs at :185,196,206 already flagged).
reigh-worker/source/task_handlers/travel/orchestrator.py — _derive_model_family, _apply_video_source_continuation, _apply_uni3c_config, travel_guidance_config.kind handling. The doc cites lines 38-49, 797, 842-844, 1106-1144, 1326-1328 — verify and read surrounding context.
— child-task construction.
Assistant
I'll audit the migration plan systematically. Let me start by reading the key files in parallel.
Assistant
Excellent — this is the full picture of travel guidance kinds. Now let me look at what the doc currently has for travel-segment context, and see the existing migration matrix layout.
Assistant
Now let me look at §1A travel rows, the §5 cohorts, §9, §8A, and the orchestrator's video_source/uni3c logic.
Assistant
Now let me check the orchestrator's continuation/uni3c logic, segment_queue, and the structure_guidance/lora/phase param shapes.
Assistant
Now let me check what app actually exposes — look at the model capabilities/UI types to determine what combinations are reachable.
Assistant
This is the authoritative spec — three model IDs (wan-2.2, ltx-2.3, ltx-2.3-fast), with constrained execution modes/guidance/continuation. Let me verify travelGuidance modes and check the Wan 2.2 VACE baseline JSON briefly.
Assistant
I now have enough to build the matrix. Let me cross-check ltx-2.3 non-fast (not distilled) — its supportedGuidanceModes: [] means it has NO structural control. And ltx-2.3-fast exposes pose|depth|canny|video|cameraman. Wan-2.2 exposes flow|canny|depth|raw|uni3c.
Now: Continuation strategies per model_type:
wan-2.2 + vace: guide_overlap_masked (no video_source — uses VACE in-graph)
wan-2.2 + i2v: svi_latent_chaining
ltx-2.3 + i2v: prefix_video_source
ltx-2.3-fast + i2v: prefix_video_source
Execution mode coercion: uni3c forces i2v, flow/canny/depth/raw forces vace. So Wan model_type effectively driven by guidance kind. LTX is always i2v.
Let me verify what task_type drops on wan_2_2_i2v ("turbo") — it's already in the cleanup list (§8A.A) so deleting. Resolver: task_type: travel_orchestrator for non-turbo. Good.
Let me also see the Wan 2.2 VACE baseline JSON briefly to confirm dual-model claim is right.
Assistant
Now let me check what §1A travel rows say currently and add cross-references. Also let me see lines 60-100 (TOC) and confirm it has decent room.
Assistant
Now I have enough. Let me build the matrix and apply the patches. I'll create the new subsection in §3A right after the "Travel continuity and travel_stitch" block and before "Wan 2.2 VACE cocktail — Q17 verdict".
The matrix combinations the app actually exposes today (per modelCapabilities.ts):
Axes (post-coercion):
wan-2.2 (Wan 2.2): default model wan_2_2_i2v_lightning_baseline_2_2_2. Guidance modes: none, flow, canny, depth, raw, uni3c. Continuation: VACE → guide_overlap_masked; i2v → svi_latent_chaining. Execution mode: vace forced by flow/canny/depth/raw; i2v forced by uni3c or none.
LoRA stacks: user loras array (any model); plus per-pair LoRAs; plus per-phase LoRAs (Wan only). Wan 2.2 baseline JSON ships its 4-LoRA cocktail through vace_fun_14B_2_2. LTX templates have built-in distilled LoRAs.
Combinations: roughly 6 wan + 1 ltx + 6 ltx-fast = 13 distinct guidance configurations × continuation × first/last/inter-segment. For matrix density, denormalize by guidance mode:
= 13 distinct guidance×model rows. Each with 3 continuity sub-cases (first-frame only, first+last, inter-segment via video_source). LoRA stacks orthogonal but covered by §3A.
Let me also confirm that model_type is actually free-form vs coerced — i.e., can the user pick vace on uni3c? Per resolveExecutionMode, uni3c forces i2v, so the (Wan, vace, uni3c) combo is unreachable from the app — it gets coerced.
Now let me write the patch. I'll insert the matrix at line 856 (just before "### Wan 2.2 VACE cocktail").
Assistant
Now patch with the matrix.
Assistant
Now patch §1A travel rows to cross-reference the matrix.
Assistant
Now patch the join-clips and inpaint rows similarly:
Assistant
Now patch §5 Cohort E entry/promotion gates to require every matrix row to smoke.
Assistant
Now §9 — add a new risk for the matrix coverage and an open question about vestigial ltx_hybrid/ltx_anchor cleanup.
Assistant
Now §8A.C — add the vestigial ltx_hybrid/ltx_anchor and structure_guidance/structure_videos legacy aliases as cleanup candidates.
Assistant
Let me verify the diff is sane and within 200 lines.
Assistant
Doc is untracked — that's fine, just measure delta from prior length: 1404 - 1366 = 38 lines added (well under the 200 limit; the matrix section is dense because tables don't waste lines).
Now let me sanity-check my matrix vs reality. One issue: the model_type: 'i2v' | 'vace' field at travelBetweenImages.ts:34 is forwarded to the worker without coercion — so the resolver itself doesn't apply resolveExecutionMode, only the UI layer does. That means an API caller bypassing the UI could send (wan-2.2, model_type=vace, guidance=uni3c). Let me confirm the worker re-coerces or not.
Assistant
Worker accepts model_type as travel_mode and uses it. The matrix accurately reflects what the app exposes (the spec coerces); raw API callers could in principle send arbitrary combos but that's out of the canonical app surface and outside scope. My matrix note explicitly says "the app cannot reach them" for the unreachable rows — accurate.
Matrix scope. The app's travel-segment surface is tighter than the worker's. MODEL_IDS at reigh-app/src/tools/travel-between-images/modelCapabilities.ts:4 is exactly three (wan-2.2, ltx-2.3, ltx-2.3-fast). resolveExecutionMode at modelCapabilities.ts:200-222 coerces model_type from guidance kind, so model_type: i2v|vace is not a free axis. Per-model supportedGuidanceModes at modelCapabilities.ts:48-49 caps Wan to {flow,canny,depth,raw,uni3c} and LTX-fast to {video,pose,depth,canny,cameraman}; non-distilled ltx-2.3 allows only none.
Counts.
13 reachable combinations (6 Wan-2.2, 1 ltx-2.3, 6 ltx-2.3-fast). Continuity (3 sub-cases) and LoRA stacks (4 sub-cases) are orthogonal across all rows.
7 rows resolve to existing templates with no further work beyond §3A patches (LTX rows 7-13 use ltx2_3_runexx_first_last_frame.py).
6 rows require the Sprint 4 NEW Wan 2.2 VACE cocktail template (rows 1-6).
0 holes that block migration. Every app-reachable combo maps cleanly.
4 vestigial axes flagged for cleanup: (a) travel_guidance.kind in {ltx_hybrid, ltx_anchor} — full validation + ~250 LoC of orchestrator branching, unreachable from app; (b) legacy structure_guidance / structure_videos writes (TODOs at taskTypes.ts:185,196,206); (c) Wan 2.1 model family (covered by existing vace_21 deletion); (d) mask/inpaint on travel segment (no resolver field).
You are doing two things in one pass on /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md:
Part 1. Investigate a list of abstraction-level and operational gremlins not yet audited, ground each in real code, and patch the doc with concrete dispositions.
Part 2. Bake a per-sprint opportunistic-cleanup clause into every sprint row in §4 (and corresponding language elsewhere), so cleanup isn't deferred wholesale to Sprint 8/8B but threaded through each sprint as work touches the relevant code.
Read the doc first (especially §0A, §1A, §3A, §4, §5, §8, §8A, §9). Don't re-audit things already classified there — extend it.
Part 1 — Gremlin investigation targets
For each numbered item: (a) read the cited code, (b) classify the disposition (DELETE-NOW / SPRINT-N / SPRINT-8 / SPRINT-8B / KEEP / AMBIGUOUS-with-verification), (c) cite path:line evidence, (d) write the finding into the doc.
G1 — core/params/ 13-module sprawl
Read reigh-worker/source/core/params/ end-to-end (every .py file). For each module, report:
Number of importers (rg "from source.core.params" reigh-worker/).
Number of class/function definitions vs how many are actually called.
Whether the module corresponds 1:1 to a §1A USED task type, a vestigial WGP concept, a mid-migration refactor, or a real architectural unit.
Recommendation: KEEP, MERGE-INTO-X, DELETE.
The matrix audit (§3A new subsection) just confirmed the reachable travel-segment surface is 13 combos — many of these param modules may be over-modeled. Specifically check vace.py, phase_config_parser.py, structure_guidance.py, travel_guidance.py for whether their full surface is reached by app-emitted tasks or by vestigial worker code paths (e.g. ltx_hybrid/ltx_anchor already flagged).
G2 — wgp_patches.py monkeypatch surface
Read reigh-worker/source/models/wgp/wgp_patches.py in full. Enumerate every patch (the LoRA-key tolerance at 384-483 is just one). For each:
What WGP behavior does it modify?
Does §3A or another section of the doc already plan its replacement?
Will it become dead code in Sprint 8 (whole-file delete), or does any patch need an explicit migration target before WGP removal?
Confirm: is wgp_patches.py a clean whole-file delete in Sprint 8, or are there patches whose intent has to live somewhere in VibeComfy?
G3 — Two-seam adapter unification opportunity
Assistant
I'll start by reading the doc and exploring the relevant code in parallel.
Assistant
Now I have a complete picture of the doc. Let me investigate the gremlins in parallel.
Assistant
There are 19 modules in core/params (the doc said 13 — actual count is 19). Let me dig deeper into G1.
Assistant
Now let me look at G4 (profile 1 vs 3 split), G5 (operational scaffolding), G6 (Wan2GP/defaults JSON consumers), G7 (headless_wgp external), and G8 confirmation.
Assistant
Good - headless_wgp is only referenced internally to reigh-worker. Now check the orchestrator startup template:
Assistant
Now G3 - check the seam unification picture by looking at _handle_direct_queue_task:
Assistant
Now I have enough to make my findings. Let me also confirm scripts/build_lora_sanitizer_modulemaps.py reference and quickly check the scripts dir.
Assistant
VACEConfig is reachable but only as a field on TaskConfig. Now I have enough — let me check task.py briefly and write the patches.
Assistant
lora_models, lora_parsing, structure_guidance_parsing have zero external importers — confirmed sub-helpers. Now I have all the data. Let me write the patches.
First, the per-sprint cleanup clause in §4 and a new §8A.E. Let me edit §4 sprint table rows:
Assistant
Now I need to add §8A.E (per-sprint cleanup convention + G1-G8 findings) and update §8A.C with the new gremlin findings. Let me add the new content after §8A.D:
Assistant
Now let me verify the doc is still well-formed and check size:
Assistant
Added 152 lines (1404 → 1556) — under the 250-line budget. Done.
Report
G1 — core/params/ (19 modules, 3,273 LoC, not 13):DELETE-NOW for task_metadata.py (63 LoC), lora_models.py (5), lora_parsing.py (28), structure_guidance_parsing.py (22) — all 0 external importers. MERGE-INTO-task.py for vace.py (59), generation.py (107), phase.py (122) — only used as TaskConfig fields. Sprint 6.
G2 — wgp_patches.py (678 LoC, 17 functions):CLEAN WHOLE-FILE DELETE in Sprint 8. Every patch is either WGP-internal (gone with WGP) or already has a non-monkeypatch replacement in §3/§3A. No new row needed.
G3 — Two-seam unification:AMBIGUOUS — user decision required. The split isn't purely Wan2GP-era artifact: the two seams have different timeouts (3600s vs 1800s) and different lifecycle (orchestrated runs media-prep before submit + chaining after). Files that disappear under unification: _handle_direct_queue_task (60 LoC), the short-circuit branches, possibly DIRECT_QUEUE_TASK_TYPES. Conservative default: keep both. Flagged for user before Sprint 6 kickoff.
G4 — Profile 1 vs 3:KEEP BOTH. Materially different vram_policy (high vs normal); production GPUs (80GB H100) tolerate caching pressure dev GPUs (24GB 3090/4090) cannot. Sprint 7 clause patched to make this explicit.
G6 — Wan2GP/defaults JSON:NO PORT NEEDED.grep -rln "Wan2GP/defaults" outside the submodule and this doc returns 0 source hits; only load_missing_model_definition reads them, and it dies with WGP. (G6 closes.)
G7 — headless_wgp external consumers: All references are inside . Same is true for (closes Q11 too). Sprint 8 deletion is uncoordinated.
User
You are doing a "maximize-chance-of-success" pass on /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md. The user has explicitly said: "DO WHAT WILL MAXIMISE CHANCES OF SUCCESS." Your job is to (a) resolve every hedge in the doc with the call that genuinely best maximizes migration success — not blindly aggressive, not passively conservative — and (b) add concrete success-maximization safeguards the doc currently lacks.
Read the doc end-to-end first. The migration is reigh-worker Wan2GP → VibeComfy, 9 main sprints + 1 concurrent (Sprint 8B), 14-week critical path, decision-record state as of 2026-05-05. Major prior decisions: §0A scope reduction (18 UNUSED task types out of scope), §1A triage (1 NEW template = Wan 2.2 VACE cocktail), G3 unify-the-seams in Sprint 6, G4 keep prod/dev profile split.
Part 1 — Resolve the 11 identified hedges
For each hedge, apply the call that maximizes migration success. Default behavior: when a hedge represents real ambiguity, replace with a committed call + a fallback path. When a hedge represents laziness ("verify later"), pre-resolve where you can.
H1 — Q3 thresholds (HIGHEST PRIORITY)
Currently §9 line ~1535 says "Q3 thresholds govern acceptance" but Q3 thresholds aren't concretely defined anywhere. Sprint 3 dual-run "green" is therefore subjective. Sprint 7 cohort promotion "p95 latency within threshold" is subjective.
Pin concrete thresholds in Sprint 0 deliverables and in §9 / §6 where they're referenced. Reasonable starting values (you may tune based on what's discoverable in the actual code/baselines):
VRAM: Comfy peak VRAM ≤ 1.05× WGP peak per task type per profile.
Error class: OOM rate must be 0 across the dual-run corpus before any cohort canary.
Output divergence rate (per cohort during canary): ≤ 1% of tasks above the per-frame pHash p95 threshold.
Add to Sprint 0 deliverables: "Per-task-type dual-run reference outputs (the WGP-side golden corpus) committed to scripts/dual_run_compare/golden/." Add to Sprint 3: "Comparison report fails if any threshold above is exceeded." Add to Sprint 7: "Rollback trigger fires automatically if output-divergence rate exceeds 1% over a 24h window."
H2 — Uni3C profile-5 caveat
Assistant
I'll start by reading the migration doc end-to-end.
Assistant
Now I have the full picture. Let me make all the edits. I'll work through them systematically.
Now add §11 thresholds artifact at the end of the doc.
Assistant
Now patch §6 rollback triggers to reference §11.
Assistant
Now update Sprint 3 and Sprint 7 exit criteria, and add S1 (Sprint 3.5 dry run). Also patch Sprint 0 deliverables to add golden corpus + thresholds artifact + 200GB disk.
Assistant
Now add Sprint 3.5 (S1 dry run) and Sprint 4 entry gate:
H5 — AMBIGUOUS rows pending DB queries. Specify thresholds and deadlines.
Assistant
H6 — TODO no-op fields. Update §8A.C row:
Assistant
H7 — ltx_hybrid / ltx_anchor. Update §3A and §8A.C:
Assistant
H8 — model_type resolver-raw. Add new §8A.A row:
Assistant
H9 — Pod disk sizing. Already done in Sprint 0 deliverables above. Patch the original §1 row too:
Assistant
Also resolve Q5:
Assistant
H10 — specialized_dispatch.py. Replace hedge:
Assistant
H11 — Deferred Flux variants. Consolidate rows:
Assistant
Now S6 — Status indicators on §9 risks. Convert risks table. Find and patch:
Assistant
Let me also patch §3A LoRA-key tolerance scope since H4 codified the dep-deletion command — verify that lookup doesn't conflict, and check the §8A.C [tool.headless_wan2gp.entrypoints] row already says DELETE-NOW (it does).
Let me verify the doc still parses correctly and the line count is reasonable:
Assistant
Net added: 88 lines (well under 250 budget). Let me also patch the TOC to mention §11/§12:
Assistant
All edits complete. Final report:
Resolution report
H1–H11 (one-line resolution + rationale)
H1 — Q3 thresholds: Pinned concrete numbers in new §11 (image pHash ≤0.05, SSIM ≥0.92, video per-frame pHash mean ≤0.08/p95 ≤0.12, latency ≤1.10×, VRAM ≤1.05×, OOM=0, canary divergence ≤1% over 24h auto-rollback); Sprint 0 ships migration-thresholds.yaml + golden corpus. Rationale: subjective gates were the largest hidden silent-acceptance risk; concrete numbers convert dual-run from human-review to automatable pass/fail.
H2 — Uni3C profile-5: Pinned cache_policy="lru:1" in §3 mapping table (was "none"). Rationale: preserves Uni3C functionality on every profile; avoids a profile-5 carve-out that future tasks would have to defensively check.
H4 — G5 transitive deps: Codified per-dep grep with explicit top-level-import names and zero-hit threshold; DELETE-IN-SPRINT-8 (was AUDIT-IN-SPRINT-8). Rationale: mechanical PR vs. indefinite punt.
H5 — AMBIGUOUS rows: Per-row threshold + deadline (queries must run by Sprint 7 entry); 7-day backfill window for nonzero hits, 2-week max slip past cutover. Rationale: prevents post-cutover cleanup from never landing.
H6 — TODO no-op fields: DELETE unconditionally (Sprint 8B). Rationale: silent contract bug, not a feature.
H7 — ltx_hybrid/ltx_anchor: DELETE in Sprint 6 opportunistic cleanup (verification grep already 0 hits). Rationale: ~250 LoC dead validation surface.
H8 — model_type resolver-raw: New §8A.A.1 row commits server-side validation in Sprint 8B. Rationale: trusting client coercion server-side is a footgun for AI-agent and API callers.
H9 — Pod disk: Sprint 0 baseline raised to 200 GB at worker_spawner.py:279-281,391-395; Q5 closed. Rationale: prior 50 GB caused live-test crash; one-line change prevents whole matrix from crashing.
Qwen prompt expander — already flagged as a gap. Decide pre-process vs in-workflow node and write it down.
Investigation surface
Do not guess. Read these to ground every claim:
/Users/user_c042661f/Documents/reigh-workspace/vibecomfy/ready_templates/ — full inventory (the doc cites 50 templates from find vibecomfy/ready_templates -name '*.py'). Catalog them by modality/family.
/Users/user_c042661f/Documents/reigh-workspace/vibecomfy/vibecomfy/workflow.py, vibecomfy/runtime/session.py, vibecomfy/blocks/ — confirm patch + IR mechanics.
/Users/user_c042661f/Documents/reigh-workspace/vibecomfy/docs/authoring.md — patch vs template rule (changes handles → new template; decorates handles → patch).
/Users/user_c042661f/Documents/reigh-workspace/reigh-worker/source/task_handlers/tasks/task_types.py (TASK_TYPE_CATALOG) and task_registry.py:1442-1511 (the 14 dispatch keys) — full task surface.
reigh-worker/source/task_handlers/travel/segments/segment_queue.py and _handle_travel_segment_via_queue_impl in task_registry.py — travel mechanics.
The doc's existing Section 3 "Parity gaps" table and Section 5 "Per-task-type cutover order" — slot your new content alongside, don't duplicate.
Output
Edit docs/migration-vibecomfy.md directly to add (preferred placement in parens):
A new section "1A. Task-type → VibeComfy template triage" between Sections 1 and 2, containing one table with columns: task_type | disposition (NATIVE/ADAPT/NEW) | target template path or basis | concrete edits required | control rails | LoRA handling | cohort/sprint. Include every runtime task type from TASK_TYPE_CATALOG ∪ the 14 dispatch keys.
A new section "3A. Control rails, LoRA stacking, and pre-processing — concrete recipes" after Section 3. Subsections:
LoRA stacking + key sanitization (with one worked Qwen example)
Control rails (Canny/Depth/DWPose/Flow/Uni3C) — pre-process vs in-workflow per rail, with a small VibeWorkflow IR sketch for one Wan+Uni3C example
Travel continuity and travel_stitch — pinned template choice, how continue_video_path and per-segment last-frame seeding flow into the chosen template, and stitch mechanics
Qwen prompt expander placement decision
Patch Section 5 — for any task type whose disposition is ADAPT or NEW, add a column or an inline note pointing into 1A so the cutover cohort table reflects template readiness, not just queue-seam readiness.
Patch Section 9 (Risks/Open questions) — add any new risks or open questions surfaced by your investigation (e.g. a NEW template you can't fully spec without the maintainer's input, or a ComfyUI custom-node dependency not in custom_nodes.lock).
Rules
Cite every claim with a file path and line number, in the existing doc's style.
If ready_templates/ doesn't have a usable basis for a task type, say so explicitly and mark the row NEW with the model family and target sprint.
Don't invent VibeComfy APIs. If you need to reference a method, grep for it first.
Don't move existing sections; insert new ones at the indicated points.
Keep prose tight — the doc already runs long. Tables over paragraphs where possible.
Don't fabricate template names. Use the actual filenames from vibecomfy/ready_templates/.
The user explicitly cares about LoRA + control sophistication, so don't gloss over it.
When done, return a short report (under 250 words) summarizing: how many task types in each disposition bucket, the highest-risk NEW templates, and any decisions you had to make where the evidence was ambiguous.
EmbeddedSession
vibecomfy/vibecomfy/runtime/session.py:35-53
Action:
Re-read vibecomfy/vibecomfy/runtime/session.py end-to-end (not just :35-53). Check for before_run, lifecycle hooks, model_cache, keep_loaded, mmap_residency, or any session-scoped cache primitive.
Read vibecomfy/vibecomfy/runtime/run.py for the surrounding API.
Check whether the kj-wrapper's WanVideoUni3CController node exists in custom_nodes.lock (reigh-worker/custom_nodes.lock? or workspace root — grep) and which custom node provides it (likely ComfyUI-WanVideoWrapper).
Output: tighten the decision in §3A. Either:
Confirm the reigh-worker side cache — explicit recipe: how does the cached Uni3C tensor get injected into the workflow each run? Show the connection point.
VibeComfy-side hook exists — name the hook, recipe to use it.
Custom-node-managed — WanVideoUni3CController may already cache weights internally; verify by reading the custom node source if present in vibecomfy/custom_nodes/.
C. Q15 / ltxv legacy → ltx2_3_t2v.py version-bump
WGP runs ltxv_13B today; subagent routed to ltx2_3_t2v.py as accepted divergence.
Action:
Read reigh-worker/Wan2GP/defaults/ltxv*.json for the exact model id WGP uses.
Read vibecomfy/ready_templates/video/ltx* for what's actually available.
Determine: is LTX 2.3 a drop-in for LTX 13B output-wise, or does it materially change resolution / framerate / quality / VRAM? If it's a real divergence, this should be a NEW (revert to 13B basis) or a documented behavior change with user sign-off.
Output: in §1A row for ltxv, replace the Q15 placeholder with the verdict. If output materially diverges, escalate to NEW with explicit user-decision risk in §9.
Read reigh-worker/source/models/wgp/wgp_patches.py:384-483 — what kinds of mismatches does it tolerate? (key prefix differences, double_blocks vs single_blocks, etc.)
Read vibecomfy/blocks/ and vibecomfy/vibecomfy/workflow.py for any patch primitive that wraps node-internal calls (vs node-graph mutation).
Decide: is monkeypatching comfy.utils.load_torch_file actually the cleanest seam, or should the sanitizer live as a pre-processing step that rewrites the LoRA file once before the workflow runs?
Output: in §3A LoRA subsection, replace the placeholder with a chosen mechanism, the alternative considered, and why. Show one cite from wgp_patches.py:384-483 for the kinds of keys being tolerated so the new mechanism's coverage is concrete.
Investigation surface (all under /Users/user_c042661f/Documents/reigh-workspace/)
vibecomfy/ready_templates/ — full template inventory
If evidence still doesn't decide it, write a Sprint-0/1 verification step with the exact command/file/assertion that will decide it.
Don't move existing sections. Append into §3A subsections, edit specific §1A rows, and update §9 if any open question can be closed or a new one needs adding.
Tables and bullet lists over paragraphs.
Don't invent VibeComfy APIs. Grep before referencing.
Keep total added prose under ~250 lines.
When done, return a short report (under 250 words): which of A–E you closed with a definitive verdict, which became sharper Sprint-0 verifications, any new risks surfaced, and the headline finding (probably whether Q17 escalates Sprint 4 or not).
Look for the queue table name (likely tasks or generation_tasks) — find every INSERT into it
.env, feature-flag config, A/B-test definitions for hidden surfaces
Scheduled jobs / cron handlers
Also look for the model field separately — the app may pass model variants like t2v_22, qwen_image_edit, wan_2_2_t2i, flux, ltxv, etc., and that disambiguates which template the migration actually needs.
Specifically for Hunyuan: grep for hunyuan, Hunyuan, hyvid (case-insensitive). If zero hits in reigh-app, mark UNUSED with a definitive cite ("0 occurrences in reigh-app/").
Insert a new section "0A. Production-usage audit (reigh-app call sites)" between Goals/Non-Goals and §1 (after "Authoritative Paths" makes sense). Contains:
One table: task_type | usage (USED-IN-APP / USED-INDIRECTLY / UNUSED / AMBIGUOUS) | call site (path:line) | model variants pinned by app | notes.
A short callout listing every UNUSED task type, with explicit citation that grep returned zero hits.
A short callout for AMBIGUOUS rows describing the gating condition.
Patch §1A (template triage table) to add a Required by app? column derived from this audit. Mark UNUSED rows so they can be skipped from the migration entirely.
Patch §4 (Sprint plan) and §5 (Per-task-type cutover order) to drop UNUSED task types from the migration scope. Specifically:
If Hunyuan is UNUSED, remove it from Sprint 4's NEW-template list and update the headline finding (the doc currently says "Sprint 4 doubles: 2 NEW = Hunyuan + Wan 2.2 VACE"). After the patch, Sprint 4 should reflect the reduced scope.
Same treatment for any other UNUSED task type that was driving NEW work.
Patch the "NEW template count" tally in §3 / §3A wherever it appears.
Patch §9 (Risks/open questions) — close any risk that was specifically about an UNUSED task type. Add a new risk if "UNUSED today but a planned feature might revive it" applies (only if you find evidence in the app's todos/issues/feature-flag scaffolding).
Rules
Cite every USED-IN-APP claim with path:line.
Cite every UNUSED claim with the exact grep that returned zero hits, e.g. rg -i "hunyuan|hyvid" reigh-app/ → 0 hits.
Don't guess. If the call site is unclear (e.g. the app builds task_type dynamically from a config), trace it.
Don't move existing sections. Insert §0A; edit columns/rows in §1A; patch tally numbers in §3/§3A/§4/§5/§9 in place.
Keep added prose tight. Tables over paragraphs.
Don't fabricate model variants — only list ones the app actually pins.
When done, return a short report (under 250 words):
Headline scope reduction: how many NEW templates fall away after this audit? What's the revised Sprint 4 / Sprint 5 NEW count?
Any task types that surprised you (used but you'd expect unused, or vice versa).
Surprises
magic_edit (worker task type) is dead. The app's family: "magic_edit" resolver (magicEdit.ts:139) writes task_type: "qwen_image_edit", never "magic_edit". The Replicate Flux Kontext handler in the worker is unreachable from the app.
Every vace* and t2v*/i2v* direct task type is dead. The Wan I2V/VACE Lightning models reach the worker only via travel_orchestrator's model_name payload, not as standalone task types.
Frontend emits wan_2_2_i2v (turbo mode, travelBetweenImages.ts:315) that the worker registry doesn't define — flagged as a new §9 risk; out of migration scope but worth a frontend follow-up.
qwen_image_hires is also dead — what looked like a hires variant is implemented as hires_* payload params on qwen_image_edit, not a separate task type.
Files modified
/Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md — added §0A; patched §1A (added "Required by app?" column + 35 rows; updated disposition counts paragraph); patched §3 parity gap matrix Hunyuan row; patched §3 missing-template gates Hunyuan paragraph; patched §3 template registry table with strikethroughs for UNUSED rows; patched §4 Sprint 4 and Sprint 5 rows; patched §5 cohort table (Cohorts C and D removed; A, B, E narrowed); patched §9 risks (closed Hunyuan, Flux, LTX-13B; added new turbo-mode wan_2_2_i2v discrepancy risk).
Special handling for rife_interpolate_images: it's listed UNUSED but the doc says RIFE stays under reigh-worker/source/media/ for use by other handlers. Don't delete the underlying RIFE helper; only delete the dispatch entry if it's truly unreachable.
Then go hunting for additional cruft
Specifically look for, in both repos:
Feature flags / toggles that are effectively dead
Env vars / process.env.* references that are never set in any deployed config (.env, .env.local, Railway, supabase config) and always evaluate to one branch.
Boolean flags in app config that have only one production value across all callers.
A/B test scaffolding (anything looking like a variant selector) where only one variant is wired up.
experimental_* / legacy_* / _deprecated / _v1 / _old / _new symbols where the alternative version is also present.
Dead code markers
TODO / FIXME / XXX / HACK comments older than ~6 months that reference no-longer-relevant work (cite git blame).
Functions/components/files with zero callers (use grep for symbol uniqueness).
Imports that are unused (lower priority — linters find these).
WGP/Wan2GP code paths that are already dead (e.g. profiles never set, model defs not in any used registry).
Pre-Comfy ComfyUI scaffolding (comfy_utils.py, comfy_handler.py raw path) that's about to be replaced — flag as "consolidate into Sprint 2 refactor" rather than delete now.
Vendored modules in reigh-worker/source/runtime/wgp_ports/vendor_imports.py whose downstream consumers are all in UNUSED task handlers.
Unused entries in pyproject.toml console scripts, package.json scripts, dependency pins for libraries no in-scope task type uses.
Domain-specific things to check (from prior audits)
family: "klein_edit" and flux_klein_edit worker task type — referenced in §0A note 121 as outside this migration's catalog. Is it used? If yes, when? If not, candidate for deletion.
magicEdit.ts writes task_type: "qwen_image_edit" — does it have a vestigial branch that emits the literal "magic_edit" anywhere? Probably not, but check.
Memory-profile entries (--wgp-profile 0, 2, 4 if defined but nothing references them in any used task path).
model_phase / modelCapabilities.ts enum values that no task type consumes (e.g. legacy Wan 2.1 entries if Wan 2.2 is the only baseline).
Rules
Cite every claim. Format: path:line for code, rg -i 'pattern' path/ followed by hit count for absence.
Don't auto-delete code. This is an audit + migration-doc patch, not a code-edit pass. The user wants the deletion plan written down so they can review and the migration executor can run it.
Distinguish "delete now" from "delete in Sprint 8". Cruft tied to the migration (UNUSED task handlers, WGP vendor modules) belongs in Sprint 8. Cruft unrelated to the migration (dead feature flags, ancient TODOs) can be a separate "Sprint 8B / Concurrent cleanup" stream that doesn't block the migration.
Conservative on ambiguity. If you're not sure whether something is dead, mark it AMBIGUOUS with the verification step (e.g. "grep production logs for X over 30 days").
Read before recommending deletion. Don't just grep — open the file enough to confirm the claim.
New section "8A. Bundled cleanup scope (cruft & dead code)" between §8 and §9. Subsections:
A. Turbo-mode travel removal — full deletion spec: frontend toggle, resolver branch, params, any worker residue. Cite every file:line.
B. UNUSED task-type handler removal — table with one row per UNUSED task type: task_type | handler file(s) to delete | dispatch entries | display name entry | tests to update | default JSON to delete | external consumers (verified absent) | disposition (DELETE-NOW / DEPRECATE / KEEP-DESPITE-UNUSED).
C. Additional cruft — table with one row per finding: category | path:line | evidence of deadness | disposition (DELETE-NOW / SPRINT-8 / SPRINT-8B / AMBIGUOUS) | verification step (for AMBIGUOUS).
D. Out-of-scope cruft — anything that looks like cruft but you decided NOT to delete (e.g. RIFE helpers used by other handlers, vendored libs that have a non-WGP consumer, etc.). Brief table.
Patch §8 (Final Wan2GP removal) to add the UNUSED handler files and dispatch entries to the deletion enumeration. Don't duplicate — point at §8A B.
Patch §4 (Sprints) to either expand Sprint 8 to "Wan2GP removal + UNUSED handler purge" (still 1 week if scope fits) or add a parallel "Sprint 8B: Concurrent cleanup" if the cruft adds materially. Pick whichever is honest.
Patch §9 to close the turbo-mode wan_2_2_i2v open question (now resolved: delete, not align).
Report (under 250 words)
Turbo-mode deletion: how many files touched, any surprises in what turbo_mode reaches.
UNUSED handler purge: how many DELETE-NOW vs DEPRECATE vs KEEP-DESPITE-UNUSED.
Additional cruft: top 5 highest-impact findings.
Estimated cleanup volume (LoC removed, files deleted) — rough order of magnitude.
Anything ambiguous worth a user decision.
[tool.headless_wan2gp.deprecation]
pyproject.toml:167-169
AMBIGUOUS: LEGACY_WORKER_MODEL_ALIASES in modelCapabilities.ts:176-178 — needs DB query for in-flight tasks before deletion.
Sprint 8B (turbo + cruft): ~250–300 LoC, ~50 files touched (mostly small edits), 1 new SQL migration.
Combined: ~1,300 LoC removed, ~6 files deleted outright.
Ambiguous items requiring user decision:
Whether to pre-migrate turboMode: true JSON keys (the Sprint 8B PR includes the migration, but you may prefer to leave it as a separate PR if there's concern about prod data).
Three AMBIGUOUS rows (legacy aliases, legacy timeline markers, stale TODOs) need DB queries to resolve. Recommended verification queries are inline in §8A.C.
Doc patches applied:
New ## 8A. Bundled cleanup scope section with subsections A-D between §8 and §9.
§8 gained a new "UNUSED Task-Type Handlers" subsection enumerating 5 handler-file deletions plus dispatch/display-name/test fixups (cross-references §8A.B).
§4 Sprint table: Sprint 8 retitled to "Wan2GP removal + UNUSED-handler purge"; new Sprint 8B: Concurrent cleanup row added (parallel to Sprints 4-8, not migration-blocking).
§9: Q12 closed-and-escalated; the wan_2_2_i2v risk-table row closed as "delete (§8A.A)"; §0A flag updated to point at §8A.A.
reigh-worker/source/core/params/travel_guidance.py, structure_guidance.py, vace.py, phase_config.py, phase.py, lora.py — typed param shapes (the doc lists these in the closure-sweep; they're authoritative for what fields can flow through).
reigh-worker/Wan2GP/defaults/wan_2_2_vace_lightning_baseline_2_2_2.json and the Wan i2v Lightning baseline JSON — actual model defaults for both supported paths.
For each travel-segment configuration axis, list every accepted value and where it's defined. Axes I expect:
Model family (Wan 2.1, Wan 2.2, LTX) — via _derive_model_family
model_type — i2v vs vace per travelBetweenImages.ts
New subsection in §3A: "Travel-segment configuration matrix" — one denormalized table with columns: model_family | model_type | generation mode | control rail | LoRA stack | VibeComfy template | continuity wiring | control-rail wiring | LoRA wiring | disposition (NATIVE / ADAPT / NEW) | verified path:line. One row per combination the app actually exposes today. Then a short prose block beneath listing the holes (combos with no clean mapping) and how each is resolved.
Patch §1A rows for travel_segment, individual_travel_segment, travel_orchestrator, travel_stitch, join_clips_segment, join_final_stitch to cross-reference the new matrix subsection.
Patch §5 Cohort E entry conditions to require that every row of the new matrix has a passing smoke before Cohort E promotion — not just "at least one parent-to-child travel smoke."
Patch §9 to add any new risks/open questions surfaced by holes in the matrix. If a vestigial combo is found that's safe to delete, add it to §8A.B (or §8A.C if it's broader cruft).
Rules
Cite every claim path:line.
Don't invent app inputs — if a field isn't in the resolvers, it's not exposed. If the worker handles a kind/mode the app never sends, that's vestigial.
The matrix should be denormalized enough to be useful. If a single template covers many cells with identical wiring, the rows can collapse, but the disposition column should still show every combo distinctly.
Total combinations expressible in app today (rough count).
How many map to existing templates / patches with no further work.
How many require the Sprint 4 NEW Wan 2.2 VACE cocktail.
How many holes you found (combos with no clean mapping) — list them tersely.
How many vestigial combos surfaced as cleanup candidates.
Anything that surprised you.
individualTravelSegment.ts
modelCapabilities.ts
travel_guidance.py
orchestrator.py
task_registry.py
§1A rows for travel_orchestrator, travel_segment, individual_travel_segment, travel_stitch, join_clips_segment, join_final_stitch — appended cross-reference to the matrix.
§5 Cohort E promotion gate now requires every matrix row to smoke (with named minimum: rows 1, 4, 6, 8, 9 across all three continuity sub-cases) before promotion, replacing the prior "at least one parent-to-child travel smoke" bar.
§8A.C — added two new rows for the vestigial ltx_hybrid/ltx_anchor worker code and the legacy structure_guidance/structure_videos write aliases.
Surprises. (i) ltx_hybrid and ltx_anchor are fully validated and orchestrated in the worker with no app-side reachability — substantial dead branch. (ii) model_type is structurally coerced in the UI but the resolver passes it raw — API-bypass callers could in theory send unreachable combos; not in scope but worth a future contract assertion. (iii) Three TODO fields in taskTypes.ts (chain_segments, structure_guidance, stitch_config) are accepted by the public request type but never read by the resolver — a small but documented gap.
The migration plan currently preserves both _handle_direct_queue_task (direct queue seam) and context["task_queue"] (nested-handler seam) through cutover. Read reigh-worker/source/task_handlers/tasks/task_registry.py:1331-1344, 1436-1438, 1442-1511, 1544-1562 and the _handle_* site that constructs context["task_queue"]. After Wan2GP removal:
Are both seams still needed, or is the split a Wan2GP-era artifact?
Could Sprint 6 or Sprint 8B unify them — i.e. orchestrated handlers also use _handle_direct_queue_task semantics — deleting one seam?
If yes, list the files/code that disappear.
This may be a YES-ambitious / NO-keep-both decision that needs user sign-off; flag accordingly. Don't recommend changes that would slip Sprint 6.
G4 — Profile-1 vs Profile-3 production/dev split
Today prod = --wgp-profile 1 (worker_startup.template.sh:463), dev = --wgp-profile 3 (start_worker.bat:14, scripts/live_test/{main,smoke}.py:27). With VibeComfy's MemoryProfile overlay, can the prod/dev split converge or is it still load-bearing? Check what each profile materially differs in (it's documented in §3 mapping); decide whether the post-migration baseline keeps both or drops to one. If the split is still needed, why? Cite the differences.
G5 — Operational scaffolding sweep
Audit:
reigh-worker-orchestrator/gpu_orchestrator/runpod/worker_startup.template.sh end-to-end for stale env-var setup, profile-flag plumbing, and Wan2GP-era boilerplate beyond the 3 already-flagged touchpoints (lines 174, 267-292, 463).
reigh-worker/Dockerfile (if exists) or nixpacks.toml / Railway config — install steps tied to Wan2GP submodule, transitive deps that came in only via WGP (look for transformers, mmgp, model-download steps).
reigh-worker/requirements.txt or pyproject.toml dependencies — flag any pin reachable only through WGP code.
Logger noise suppression for mmgp at reigh-worker/source/core/log/core.py:57-64 and :108-113 — verify it's vestigial after WGP removal.
For each finding, propose deletion in Sprint 8 vs concurrent Sprint 8B vs earlier.
G6 — Wan2GP/defaults/*.json data migration
Submodule deletion implies the entire reigh-worker/Wan2GP/defaults/ directory goes away. But are any JSONs the source of truth for values VibeComfy templates need at runtime? Specifically check whether any of these get read (not imported as Python) by reigh-worker code post-migration — sigma schedules, LoRA multipliers, sampler step counts, default prompts. If yes, that data must be ported into a reigh-worker-owned location before Sprint 8 deletion.
Cite specific file consumers if any (rg -n 'Wan2GP/defaults' reigh-worker/source/).
G7 — headless_wgp external consumer check
The doc enumerates root headless_wgp.py + entrypoint shim + 2 console-script entries for deletion. Verify nothing outside reigh-worker/source/ imports these names:
Check reigh-worker-orchestrator/, vibecomfy/, any debug script, any documentation snippet that hardcodes the entry point name.
If anything outside reigh-worker still references it, the deletion needs a coordinated rename/migration in that consumer first.
G8 — Frontend AMBIGUOUS rows pending
The doc has three §8A.C AMBIGUOUS rows needing DB queries (LEGACY_WORKER_MODEL_ALIASES, three legacy_* timeline-domain markers, three taskTypes.ts TODOs) plus a fourth surfaced today (chain_segments/structure_guidance/stitch_config no-op fields). Don't run DB queries (you can't), but for each: write the exact query that would resolve it, the threshold for "safe to delete," and which sprint it slots into once resolved.
Part 2 — Per-sprint opportunistic cleanup
After Part 1 patches land, edit §4 (Sprint table) and §8A.D (or add a new subsection §8A.E "Per-sprint opportunistic cleanup") to add a uniform clause across every sprint row:
Opportunistic cleanup: while touching , delete any §8A.B/§8A.C item whose code path the sprint is already inside, and flag any newly-discovered cruft into §8A.C with path:line + verification step.
For each sprint, populate the <areas> placeholder with the specific files/dirs the sprint touches. Make this a real deliverable — add to the sprint's exit criteria a line: "any in-flight cleanup items the sprint touched are either landed or explicitly punted with a §8A.C entry."
This is so cleanup is threaded through the migration rather than concentrated at the end. The Sprint 8 / 8B work remains the closure sweep; per-sprint cleanup picks up the easy wins as they're encountered.
Rules
Cite every claim with path:line.
For G3, don't auto-recommend the ambitious option — surface the trade-off; the user decides.
Don't move existing sections. Append into §8A.C, §8A.D as needed; add §8A.E if the per-sprint clause needs a home; edit §4 rows in place.
Keep total added prose ≤ 250 lines.
Tables/bullets over paragraphs.
Report (under 300 words)
For each of G1–G8: one-line verdict (DELETE-NOW / SPRINT-N / KEEP / AMBIGUOUS-with-query) + the headline finding.
Total LoC / file count surfaced for cleanup beyond what the doc already had.
Single most surprising finding.
Whether G3 (seam unification) is worth user attention or kept conservative.
Whether the per-sprint cleanup clause materially shifts any sprint's exit criteria.
CLEAN.
reigh-worker/
headless_model_management
G8 — Frontend AMBIGUOUS: 6 rows now have explicit SQL/grep queries + thresholds + sprint slots. Subagent cannot run DB queries; PR author runs at PR time and pastes result.
Most surprising finding:core/params/ is 19 modules totaling 3,273 LoC, not the 13 modules the prompt assumed; 14 of 19 have zero external importers, half of which are pure dead code (no internal aggregator, no TaskConfig field). The smaller lora_*/structure_guidance_parsing files exist only because someone broke up lora.py/structure_guidance.py and left the orphan splits behind.
G3 worth user attention: Yes — surfaced as AMBIGUOUS, explicit "user decides" before Sprint 6 kickoff. Conservative default is keep both; the unification is structurally cleaner but adds a non-trivial dispatcher refactor to an already-heavy sprint.
Per-sprint cleanup clause shifts exit criteria? Yes, materially: every sprint now has a hard exit criterion "any in-flight cleanup items the sprint touched are either landed or explicitly punted with a §8A.C entry." Sprint 8 inherits a shorter closure-sweep list because per-sprint clauses absorb the easy wins. Sprint 6 inherits the largest opportunistic surface (core/params/ 4 deletions + 3 merges + travel orchestration files).
Doc grew 152 lines (1404 → 1556), under the 250-line budget.
§9 line ~1536 hedges "Uni3C-using tasks are not supported under MINIMUM profile, OR use cache_policy="lru:1"." Pick cache_policy="lru:1" (preserves functionality with a tiny cache footprint). Patch §3 mapping table and §3A subsection.
H3 — Hunyuan inconsistency
§9 line ~632 says "worker handler stays installed for backwards compatibility"; §8A.B says DELETE-NOW. Reconcile to DELETE. The §0A audit confirmed 0 frontend hits; carrying forward dead code violates the user's stated cleanup preference. If Hunyuan is ever revived, a fresh template authoring is the right approach anyway.
H4 — §G5 "probably droppable" transitive deps
List in §G5 (gradio, dashscope, s3tokenizer, chumpy, smplfitter, taichi, flash-linear-attention, gguf, insightface, facexlib, wetext) is concrete; disposition is hedged. Commit removal in Sprint 8 with a per-dep verification command: for each dep, the deletion only proceeds if rg "^(import|from) <dep>" reigh-worker/source/ vibecomfy/vibecomfy/ returns 0 hits outside WGP-bound code (which is being deleted). Codify the command and the threshold.
H5 — AMBIGUOUS §8A.C rows pending DB queries
For each AMBIGUOUS row (LEGACY_WORKER_MODEL_ALIASES, three legacy_* timeline-domain markers, three taskTypes.ts TODOs, plus the new chain_segments/structure_guidance/stitch_config no-op fields):
Specify the verification query (already there for most).
Specify the deletion threshold: if query returns ≤ N hits, delete unconditionally. If > N, file a follow-up issue and migrate then delete in a separate PR within 2 weeks of cutover.
Specify the deadline: verification queries must run no later than the start of Sprint 7 (so the cleanup PRs don't slip past cutover).
For thresholds, use these defaults:
Frontend LEGACY_WORKER_MODEL_ALIASES and timeline markers: delete if 0 in-flight tasks reference them; if > 0, set 7-day migration window then delete.
TODO no-op fields: delete unconditionally (they don't do anything; the request type accepting them silently is a contract bug, not a feature).
H6 — TODO no-op fields (chain_segments, structure_guidance, stitch_config)
Delete unconditionally in Sprint 8B. Per H5, they literally don't do anything. Patch §8A.A or §8A.C accordingly.
Verification already shows 0 hits. Commit to deletion in Sprint 6 opportunistic cleanup. Patch §8A.C from AMBIGUOUS to DELETE-NOW. Update §3A line ~886 from "Disposition: vestigial; verify with rg" to "Disposition: DELETE in Sprint 6 (verified 0 hits)."
H8 — model_type resolver-raw
Frontend coerces but resolver passes raw. Commit a Sprint 8B contract-assertion deliverable: server-side resolver rejects model_type values not in the per-model_idsupportedGuidanceModes set. Add as a new §8A.A or §8A.C row with "DELETE-NOW (Sprint 8B): add server-side model_type validation in travelBetweenImages.ts resolver."
H9 — Pod disk sizing
Line ~362 says "dual-run may need a larger Sprint 0 baseline." Memory note says 50 GB is too small for WAN 14B alone. Commit a larger Sprint 0 baseline disk size — propose 200 GB based on dual-stack image (WGP + Comfy + ready_templates models). Patch the Sprint 0 deliverables explicitly.
H10 — specialized_dispatch.py "consider deleting"
§8A.B line ~1128 hedges "consider deleting specialized_dispatch.py entirely." Replace with explicit DELETE-NOW in Sprint 8 (after the §8 task_registry deletion absorbs its remaining role).
H11 — Deferred Flux variants
§1A lines ~382-384 still carry flux_schnell and flux_dev_kontext rows with implementation notes ("Author ready_templates/image/flux1_schnell_t2i.py if any task-type variant maps to..."). All UNUSED per §0A. Replace with one consolidated row: "Out of scope per §0A. If reintroduced, treat as a separate project."
Part 2 — Add success-maximization safeguards
The doc has good rollback paths and per-sprint cleanup. It's missing some structural success-maximizers.
S1 — Pre-Sprint-4 dry-run gate (highest leverage — Sprint 4 is the single-template-NEW-template choke point)
Add a Sprint 0 / Sprint 3-bridging task: a small-scale dry run that authors the Wan 2.2 VACE cocktail template's two-stage sampler chain against ONE known reference output, runs it on dev hardware, and validates the per-frame pHash drift hypothesis (Q18). If the dry run shows drift exceeds the H1 video thresholds, Sprint 4 has a pre-decided fallback: keep Wan VACE on WGP indefinitely (rollback to permanent dual-stack for that family) and proceed with the rest of the migration. This converts Sprint 4 from "single point of failure" to "verified-feasible before commit."
Add as a new Sprint 3.5 item or Sprint 3 deliverable extension. Add as an entry-condition on Sprint 4: "Dry-run pHash drift ≤ H1 video thresholds; otherwise fall back per §6."
S2 — Per-sprint go/no-go gate
Currently sprints have exit criteria but no entry gates. Add to each Sprint N's row: an explicit "Entry gate: " listing what must be true before the sprint can start (e.g. Sprint 4 entry gate = "S1 dry-run green AND Sprint 3 dual-run report green for image cohort"). This prevents cascading slippage when an upstream sprint silently fails its exit criteria.
S3 — Concrete rollback PRs prepared in advance
Add to §6: "Each cohort canary in Sprint 7 has a pre-prepared rollback PR sitting in draft state, mergeable in <5 min, that flips that cohort's backend_for_task_type entries back to wgp and reverts any cohort-specific code changes. PRs land into draft during Sprint 7 setup, before promotion." This converts "rollback is documented" to "rollback is one click."
S4 — Single-source-of-truth thresholds
After H1 lands, all thresholds should live in a single Sprint 0 artifact — a migration-thresholds.yaml (or .md) — that Sprint 3 dual-run script, Sprint 7 canary triggers, and Sprint 4 dry-run all read from. Currently they'd be sprinkled across the doc. Add this as a Sprint 0 deliverable.
S5 — "Confidence to proceed" gate
Add a §11 (or extend §9) closing checklist: "Before kickoff, the user reviews this doc and explicitly checks off: thresholds (H1) are set; entry gates (S2) are credible; dry-run plan (S1) is staffed; rollback PRs (S3) have an owner; cleanup catalog (§8A) has been pre-resolved for queries that can be run now." This is the human gate that catches anything the doc missed.
S6 — Status indicators on §9 risks
Each row in §9 currently mixes open and closed risks (the closed ones are struck through). Add a column "Status" with values: OPEN / MITIGATED / ACCEPTED / CLOSED. Mitigated = mitigation is in flight; Accepted = risk acknowledged but not actively mitigated; Closed = no longer applicable. This converts the risk table from prose-with-strikethroughs into a tracker.
Rules
Cite every claim with path:line.
Don't move existing sections. Append/edit in place.
Keep added prose ≤ 250 lines net.
Tables and bullets over paragraphs.
For each H1-H11 resolution, add a brief decision rationale ("Decision (2026-05-05): X. Rationale: maximizes success because Y").
If you find a NEW hedge while editing that's not in H1-H11, resolve it the same way and report it.
Report (under 350 words)
Per H1-H11: one-line resolution + the rationale.
Per S1-S6: did the safeguard land cleanly, or did it require restructuring something?
Any NEW hedges surfaced beyond H1-H11.
Top 3 things that meaningfully change the migration's risk profile after this pass.
Anything you flagged as needing user attention that you couldn't fully resolve yourself.
H11 — Flux variants: Consolidated three rows into one OUT-OF-SCOPE row. Rationale: removes Sprint 5 scope-creep temptation.
S1–S6 safeguards
S1 dry run: Landed cleanly as new "Sprint 3.5" row in §4; Sprint 4 entry gate references it; pre-decided fall-back to permanent dual-stack documented in §6. No restructuring.
S2 entry gates: Landed as a one-line "Entry gate (S2):" prefix on every Sprint N row 0–8. No restructuring.
S3 pre-staged rollback PRs: Landed as a new subsection in §6 with per-cohort PR table, ownership, weekly rebase. Sprint 7 entry gate now requires drafts current. No restructuring.
S4 single-source-of-truth thresholds: Landed as §11 + Sprint 0 deliverable migration-thresholds.yaml. All consumer scripts (Sprint 3 dual-run, Sprint 3.5 dry run, Sprint 7 canary) read from it. No restructuring.
S5 confidence checklist: Landed as §12. Sprint 0 entry gate now requires §12 sign-off. No restructuring.
S6 risk status indicators: Landed as new "Status" column on every §9 risk row (OPEN / MITIGATED / ACCEPTED / CLOSED). Required converting strikethrough rows to CLOSED rows for consistency.
New hedges surfaced
The pre-existing Q9 ("long-term fate of raw comfy task type") is technically still hedged: §8A.B §8A.C now both list it as DELETE-NOW Sprint 8 (refactor target empty per §0A), and §9 risk row was patched to reference that. Q9's "Default stance" cell still reads "Preserve via VibeComfy delegation" — superseded but not edited because Q9 is functionally closed via §8A.B. Flagged for user attention if they want Q9 marked CLOSED in the Open Questions table the way Q12–Q17 are.
Top 3 risk-profile changes
Sprint 3.5 dry run gate (S1) eliminates Sprint 4's single-point-of-failure status. Wan 2.2 VACE cocktail feasibility is now verified on a single shot before two weeks of template authoring; if the dry run fails §11 thresholds, fall-back to permanent dual-stack is pre-decided rather than discovered late.
§11 thresholds turn dual-run/canary from human-review into automation. Sprint 7 auto-rollback wiring + pre-staged rollback PRs (S3) means a divergence event that would have required a war-room before is now a sub-5-minute automated revert.
Per-sprint entry gates (S2) plus §12 confidence checklist convert "we'll figure it out" into "kickoff is blocked until X." Sprint 0 has a hard gate; Sprint 4 has a hard gate; Sprint 7 has a hard gate. Cascading silent slippage is the failure mode this most directly addresses.
Items needing user attention
Q9 status: technically should now be CLOSED in the Open Questions table given §0A + §8A.B make comfy task type a delete, but I left Q9's row as-is to avoid contradicting Q9's own text mid-doc. User may want to rewrite Q9 row to CLOSED.
§12 owners: the confidence checklist lists named-owner requirements (S1 staffing, S3 rollback PR ownership) without naming actual humans — those need to be filled in at kickoff.
migration-thresholds.yaml actual numbers: §11 uses the table values you supplied as starting points. Sprint 0 should validate the WGP-side baseline matches them; if WGP p95 baseline numbers come in such that 1.10× would require Comfy to beat WGP, the threshold needs widening to 1.15× or similar — flag this at Sprint 0 review.
File modified: /Users/user_c042661f/Documents/reigh-workspace/docs/migration-vibecomfy.md (1579 → 1667 lines, net +88).