Fix LoRA passthrough: form hardcodes loras:[] instead of passing selectedLoras, and agent needs to pass project LoRAs too
User notes and answers:
Full submission chain for LoRAs:
useImageGenForm.ts:421 has loraManager.selectedLoras (ActiveLora[])
useFormSubmission.ts:58 calls useTaskParamsBuilder — currently does NOT pass selectedLoras
useTaskParamsBuilder.ts:33 calls buildSubmissionTaskParams — no LoRA param
submissionTaskPlan.ts:77 calls buildBatchTaskParams — no LoRA param
buildBatchTaskParams.ts:75 hardcodes loras: []
Fix chain: thread selectedLoras through each layer. Convert at buildBatchTaskParams level:
ActiveLora[] → PathLoraConfig[] via loras.map(l => ({path: l.path, strength: l.strength}))
For useTaskParamsBuilder, it uses refs (generationSourceRef, selectedTextModelRef). We should also use a ref for selectedLoras since it can change. OR just add selectedLoras to the props directly since it's already in useFormSubmission's scope via promptConfig.
useFormSubmission.ts gets promptConfig from useImageGenForm which includes selectedTextModelRef. We need to also get selectedLoras. Looking at useFormSubmission props:
promptConfig includes generationSourceRef, selectedTextModelRef
We need to add selectedLoras or a selectedLorasRef
For the agent side: loadProjectImageSettings already loads settings with selectedLorasByCategory. The agent just needs to extract the right category's LoRAs based on the effective model and pass them as loras in the params to createGenerationTask. The params field gets spread into the input via legacyInput in buildImageGenerationInput.
code
Batch framing:
- Execute batch 1 of 4.
- Actionable task IDs for this batch: ['T1', 'T4']
- Already completed task IDs available as dependency context: []
Actionable tasks for this batch:
[
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to .\n\n2. In : Add to the object in the call (around lines 350-360).\n\n3. In : Destructure from . Create ref: Pass to and to .\n\n4. In : Add to . Accept it in and include in returned object.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In : Add to : \n\n2. In (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string and numeric , drop malformed entries.\n - Legacy fallback: If is absent but exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
Assistant
User
Assistant
Inspecting the batch-2 form and agent paths first so the ref threading and agent param merge land in the right seams. After that I’ll patch both chains and run full-file verification on the touched areas.
Assistant
The batch-2 seams are clear: selectedLorasRef needs to be consumed inside both submission callbacks, and the agent task builder needs LoRA-category selection layered on top of the existing reference params. I’m patching those now, then I’ll verify the generation.ts passthrough and run the relevant full-file tests.
Assistant
I have enough context to edit. Next changes are mechanical but need to stay consistent with the staged plan: selectedLorasRef.current will be read inside the callbacks without joining dependency arrays, and the agent will merge LoRAs into params without touching generation.ts.
Assistant
The edits are in verification now. I’ve started the full-file frontend and edge test runs plus eslint on the touched files; I’m waiting on those results before I checkpoint the batch.
Assistant
Lint surfaced exactly the issue the plan anticipated: selectedLorasRef is a mutable ref that should not be a callback dependency, but the hook rule flags it mechanically. I’m fixing that with explicit exhaustive-deps suppressions at the two planned ref-read sites, then I’ll re-run lint and the same full-file tests.
Assistant
Verification is clean now: eslint passes, the targeted frontend tests pass, and the targeted edge test passes. I’m writing the batch-2 checkpoint next, including the explicit note that full typecheck is still deferred because T3 hasn’t landed yet.
Assistant
User
Assistant
Inspecting the remaining form-chain boundary now. This batch is the single conversion seam: submissionTaskPlan.ts should be the only place that maps ActiveLora[] into PathLoraConfig[], and buildBatchTaskParams.ts should stop hardcoding loras: [].
Assistant
The existing tests are in the right spots: submissionTaskPlan.test.ts can assert the one-time ActiveLora[] -> PathLoraConfig[] mapping, and buildBatchTaskParams.test.ts should catch the loras passthrough at the lower boundary. I’m patching both files and then I’ll run those full modules plus the adjacent form submission test file.
Assistant
The boundary patch is in place. I’m verifying it with linting and the full form submission test modules now so the conversion stays centralized in submissionTaskPlan.ts and the lower helper simply passes loras through.
Assistant
The code path is fine; the failing module is stale test scaffolding. useFormSubmission.test.ts still builds promptConfig without the now-required selectedLoras, so the managed and queued flows are invoking the new mapping seam with undefined. I’m updating that fixture and re-running the same full verification set.
Assistant
I’ve patched the stale fixture and restarted the exact same verification set. Waiting on eslint plus the full frontend module run now.
Assistant
{"task_updates":[{"task_id":"T3","status":"done","executor_notes":"Implemented the only ActiveLora[] -> PathLoraConfig[] conversion in submissionTaskPlan.ts, then updated buildBatchTaskParams.ts to accept loras input and pass it through instead of hardcoding an empty array. Verification passed with eslint plus full-file Vitest runs for , , , and . A stale fixture was updated during verification because it was still missing the now-required input.","files_changed":["reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts","reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.test.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks//buildBatchTaskParams.test.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.test.ts src/shared/components/ImageGenerationForm/hooks//buildBatchTaskParams.test.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts","npx vitest run --config config/testing/vitest.config.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.test.ts src/shared/components/ImageGenerationForm/hooks//buildBatchTaskParams.test.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.test.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC3","executor_note":"Yes. The mapping now happens exactly once in , and no longer hardcodes ; it accepts input and passes them through."}]}
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[]
Prior batch deviations (address if applicable):
None
Batch-scoped sense checks:
[
{
"id": "SC1",
"task_id": "T1",
"question": "Does FormSubmissionPromptConfig now include selectedLoras: ActiveLora[], and does useFormSubmission create a ref that stays current? Verify the ref update pattern matches generationSourceRef.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does normalizeProjectImageSettings handle both primary (selectedLorasByCategory) and legacy (selectedLorasByTextModel) formats, with proper validation (string path, numeric strength) and dedup by path?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to FormSubmissionPromptConfig.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts: Add selectedLoras: loraManager.selectedLoras to the promptConfig object in the useFormSubmission({...}) call (around lines 350-360).\n\n3. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts: Destructure selectedLoras from promptConfig. Create ref: const selectedLorasRef = useRef(selectedLoras); selectedLorasRef.current = selectedLoras; Pass selectedLorasRef to useTaskParamsBuilder and to buildSubmissionRuntimeContext.\n\n4. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts: Add selectedLorasRef: MutableRefObject<ActiveLora[]> to SubmissionRuntimeContext. Accept it in buildSubmissionRuntimeContext and include in returned object.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Phase 1 Steps 4-5: Thread selectedLorasRef through both managed and automated submission paths.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts (Step 4): Add selectedLorasRef: MutableRefObject<ActiveLora[]> to UseTaskParamsBuilderProps. Import ActiveLora. Destructure from props, read selectedLorasRef.current inside the callback and pass to buildSubmissionTaskParams context. Do NOT add to useCallback deps \u2014 same ref pattern as generationSourceRef.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts (Step 5): Destructure selectedLorasRef from context. Read selectedLorasRef.current inside the callback and pass selectedLoras: selectedLorasRef.current to buildSubmissionTaskParams.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Phase 1 Step 6: Convert ActiveLora[] to PathLoraConfig[] at submissionTaskPlan boundary and replace hardcoded loras:[] in buildBatchTaskParams.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to SubmissionTaskContext. At the call site to buildBatchTaskParams (line 77-91), convert: loras: context.selectedLoras.map(l => ({ path: l.path, strength: l.strength })).\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts: Import PathLoraConfig from @/domains/lora/types/lora. Add loras: PathLoraConfig[] to BuildBatchTaskParamsInput. Replace hardcoded loras: [] at line 75 with loras: input.loras.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts",
"reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In reigh-app/supabase/functions/ai-timeline-agent/types.ts: Add to AgentProjectImageSettings: selectedLorasByCategory?: Partial<Record<'qwen' | 'z-image', Array<{ path: string; strength: number }>>>;\n\n2. In reigh-app/supabase/functions/ai-timeline-agent/db.tsnormalizeProjectImageSettings (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If value.selectedLorasByCategory exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string path and numeric strength, drop malformed entries.\n - Legacy fallback: If selectedLorasByCategory is absent but value.selectedLorasByTextModel exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Phase 2 Steps 8-9: Pass LoRAs through imageContext using effective model, verify generation.ts passthrough.\n\n1. In reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts: Add selectedLorasByCategory to CreateTaskImageContext (line 58-61): selectedLorasByCategory?: Partial<Record<'qwen' | 'z-image', Array<{ path: string; strength: number }>>>;\n\n2. In reigh-app/supabase/functions/ai-timeline-agent/loop.ts (line 331-336): Pass selectedLorasByCategory: imageSettings.selectedLorasByCategory into the imageContext object.\n\n3. In create-task.tsexecuteCreateTask (around line 133-167): After computing defaultModelName and activeReferenceParams:\n - Compute effective model: const effectiveModel = asTrimmedString(args.model) ?? defaultModelName ?? undefined;\n - Determine LoRA category: const loraCategory = effectiveModel?.startsWith('z-') ? 'z-image' as const : 'qwen' as const;\n - For by-reference task types (those with a reference mode), always use 'qwen' category.\n - Extract: const loras = imageContext?.selectedLorasByCategory?.[loraCategory] ?? [];\n - Build merged params: const mergedParams = { ...(activeReferenceParams ?? {}), ...(loras.length > 0 ? { loras } : {}) };\n - Pass to createGenerationTask: params: Object.keys(mergedParams).length > 0 ? mergedParams : undefined\n\n4. Step 9 (verify only): Read reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts and confirm buildImageGenerationInput at line 84-121 spreads legacyInput (from args.params) so loras flows through automatically. No changes expected.",
"depends_on": [
"T4"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Phase 3: Run TypeScript compilation and existing tests to verify all changes.\n\n1. Run npx tsc --noEmit in reigh-app/ to catch type errors across both form and agent chains.\n2. Run existing tests in the form submission directory and agent directory. Find relevant test files with glob patterns like **/formSubmission/**/*.test.*, **/buildBatchTaskParams*test*, **/ai-timeline-agent/**/*.test.*.\n3. Write a short throwaway verification script that imports the key types and confirms: (a) ActiveLora[] can be mapped to PathLoraConfig[], (b) the buildBatchTaskParams input type accepts loras, (c) SubmissionTaskContext accepts selectedLoras. Run it, confirm it passes, then delete it.\n4. If any test or type check fails, read the error, fix the code, and re-run until passing.",
"depends_on": [
"T3",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"ActiveLora type import path: verify @/domains/lora/types/lora exports both ActiveLora and PathLoraConfig \u2014 check before using",
"Ref pattern: selectedLorasRef must NOT be added to useCallback dependency arrays \u2014 match existing generationSourceRef/selectedTextModelRef pattern exactly",
"buildBatchTaskParams has TWO LoRA mechanisms: loras (PathLoraConfig[]) and additional_loras (from phaseLoraStrengths). These are independent \u2014 only fix loras passthrough, do not touch additional_loras",
"Agent edge functions have separate module resolution from frontend \u2014 use inline types for LoRA shapes in agent code, not imports from frontend domains",
"Legacy fallback: selectedLorasByTextModel is keyed by model name strings. Category mapping: model names starting with 'z-' \u2192 'z-image' category, all others \u2192 'qwen' category",
"The loras field flows through agent's createGenerationTask \u2192 params \u2192 legacyInput spread in buildImageGenerationInput. Verify this spread exists before relying on it",
"Plan assumption: loraManager.selectedLoras already returns the correct category's LoRAs for the current model \u2014 the form chain passes them through as-is without category logic",
"Plan assumption: create-task edge function accepts loras as PathLoraConfig[] format (same as frontend type) \u2014 if backend expects different format, conversion needed",
"For by-reference task types in agent, always use 'qwen' LoRA category regardless of effective model"
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does FormSubmissionPromptConfig now include selectedLoras: ActiveLora[], and does useFormSubmission create a ref that stays current? Verify the ref update pattern matches generationSourceRef.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do both useTaskParamsBuilder (managed path) and useAutomatedPromptSubmission (automated path) read selectedLorasRef.current inside their callbacks, and is selectedLorasRef NOT in any useCallback dependency array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Is the ActiveLora[] \u2192 PathLoraConfig[] conversion done exactly once in submissionTaskPlan.ts (not scattered), and does buildBatchTaskParams no longer hardcode loras: []?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does normalizeProjectImageSettings handle both primary (selectedLorasByCategory) and legacy (selectedLorasByTextModel) formats, with proper validation (string path, numeric strength) and dedup by path?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does create-task.ts compute LoRA category from the effective model (args.model override ?? defaultModelName), use 'qwen' for reference task types, and pass loras in merged params?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does npx tsc --noEmit pass cleanly and do all existing tests pass without modification (or with minimal updates if they asserted on hardcoded loras:[])?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a pure plumbing fix across two independent chains (form UI and agent). The form chain (T1-T3) must be sequential because each step adds types/props that the next step consumes. The agent chain (T4-T5) is fully independent and can be done in parallel with T1-T3.\n\nKey judgment calls:\n- The ref pattern (selectedLorasRef) is critical for correctness. Both managed and automated paths use callbacks that could capture stale closures. Follow the exact same pattern as generationSourceRef \u2014 create ref in useFormSubmission, update .current on every render, read .current inside callbacks, never add to deps.\n- The ActiveLora[] \u2192 PathLoraConfig[] conversion happens at a single point (submissionTaskPlan.ts) to keep the mapping clean. Don't be tempted to convert earlier.\n- For the agent legacy fallback, the category mapping logic (z- prefix \u2192 z-image, else qwen) must match what the frontend migration does. Read the frontend migration code if unsure about edge cases.\n- Step 9 is verify-only \u2014 if buildImageGenerationInput doesn't spread legacyInput as expected, that's a blocker that needs escalation, not a code change in generation.ts.\n- The two open questions in plan metadata (about additional_loras independence and PathLoraConfig[] format acceptance) are treated as confirmed assumptions. If either turns out wrong during execution, stop and reassess.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add selectedLoras to FormSubmissionPromptConfig types",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Pass selectedLoras from useImageGenForm to useFormSubmission",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 3: Create ref and wire both submission paths via submissionContext",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 4: Thread through managed path \u2014 useTaskParamsBuilder",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 5: Thread through automated path \u2014 useAutomatedPromptSubmission",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 6: Convert ActiveLora[] to PathLoraConfig[] and replace hardcoded loras:[]",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 7: Extend agent types and normalization with legacy fallback",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 8: Pass LoRAs through imageContext using effective model in create-task",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 9: Verify LoRA passthrough in buildImageGenerationInput (read-only)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 10: Run TypeScript compilation and existing tests",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 10 plan steps mapped to tasks. Steps 1-3 consolidated into T1 since they form a single atomic unit of type+prop+ref wiring. Steps 4-5 consolidated into T2 as parallel path threading. Steps 8-9 consolidated into T5 since step 9 is verify-only.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / prev.endimage to be safe in strict typescript. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User explicitly approved this plan at the gate checkpoint.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T1, T4]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC1, SC4]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_1.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- If a test fails and you determine the failure is pre-existing (fails without your changes too), you MUST still re-run the FULL test suite with your changes applied. Pre-existing failures do not excuse you from verifying all other tests still pass. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
{"output":"Completed batch 1 tasks T1 and T4 in reigh-app, and wrote the batch checkpoint to .megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_1.json. Verification for this batch was limited to focused code inspection plus a clean eslint run on the edited files.","files_changed":["reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts","reigh-app/supabase/functions/ai-timeline-agent/types.ts","reigh-app/supabase/functions/ai-timeline-agent/db.ts",".megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_1.json"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts","git -C reigh-app status --short","git -C reigh-app diff -- src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"],"deviations":["Did not run full TypeScript or Vitest verification in this batch. The approved plan defers end-to-end verification to T6, and batch 1 intentionally stops before T2 updates useTaskParamsBuilder to consume the newly threaded selectedLorasRef."],"task_updates":[{"task_id":"T1","status":"done","executor_notes":"Added selectedLoras: ActiveLora[] to FormSubmissionPromptConfig, passed loraManager.selectedLoras from useImageGenForm, created selectedLorasRef in useFormSubmission with selectedLorasRef.current = selectedLoras on each render, and threaded that ref into buildSubmissionRuntimeContext and the useTaskParamsBuilder call site. Verified with file inspection and a clean eslint run across all edited files.","files_changed":["reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"]},{"task_id":"T4","status":"done","executor_notes":"Extended AgentProjectImageSettings with selectedLorasByCategory and updated normalizeProjectImageSettings to parse primary category data plus legacy selectedLorasByTextModel, validate path and strength, map legacy z-* models into the z-image category, and dedupe by path within each category before returning non-empty normalized data. Verified with file inspection and the same clean eslint run.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/types.ts","reigh-app/supabase/functions/ai-timeline-agent/db.ts"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC1","executor_note":"Yes. FormSubmissionPromptConfig now includes selectedLoras: ActiveLora[], and useFormSubmission keeps a live selectedLorasRef by setting selectedLorasRef.current = selectedLoras on each render before threading it onward, matching the existing mutable-ref usage pattern."},{"sense_check_id":"SC4","executor_note":"Yes. normalizeProjectImageSettings now handles both selectedLorasByCategory and legacy selectedLorasByTextModel, keeps only entries with string path plus finite numeric strength, maps legacy z-* model keys to z-image, and dedupes each category by path."}]}
Fix LoRA passthrough: form hardcodes loras:[] instead of passing selectedLoras, and agent needs to pass project LoRAs too
User notes and answers:
Full submission chain for LoRAs:
useImageGenForm.ts:421 has loraManager.selectedLoras (ActiveLora[])
useFormSubmission.ts:58 calls useTaskParamsBuilder — currently does NOT pass selectedLoras
useTaskParamsBuilder.ts:33 calls buildSubmissionTaskParams — no LoRA param
submissionTaskPlan.ts:77 calls buildBatchTaskParams — no LoRA param
buildBatchTaskParams.ts:75 hardcodes loras: []
Fix chain: thread selectedLoras through each layer. Convert at buildBatchTaskParams level:
ActiveLora[] → PathLoraConfig[] via loras.map(l => ({path: l.path, strength: l.strength}))
For useTaskParamsBuilder, it uses refs (generationSourceRef, selectedTextModelRef). We should also use a ref for selectedLoras since it can change. OR just add selectedLoras to the props directly since it's already in useFormSubmission's scope via promptConfig.
useFormSubmission.ts gets promptConfig from useImageGenForm which includes selectedTextModelRef. We need to also get selectedLoras. Looking at useFormSubmission props:
promptConfig includes generationSourceRef, selectedTextModelRef
We need to add selectedLoras or a selectedLorasRef
For the agent side: loadProjectImageSettings already loads settings with selectedLorasByCategory. The agent just needs to extract the right category's LoRAs based on the effective model and pass them as loras in the params to createGenerationTask. The params field gets spread into the input via legacyInput in buildImageGenerationInput.
code
Batch framing:
- Execute batch 2 of 4.
- Actionable task IDs for this batch: ['T2', 'T5']
- Already completed task IDs available as dependency context: ['T1', 'T4']
Actionable tasks for this batch:
[
{
"id": "T2",
"description": "Phase 1 Steps 4-5: Thread selectedLorasRef through both managed and automated submission paths.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts (Step 4): Add selectedLorasRef: MutableRefObject<ActiveLora[]> to UseTaskParamsBuilderProps. Import ActiveLora. Destructure from props, read selectedLorasRef.current inside the callback and pass to buildSubmissionTaskParams context. Do NOT add to useCallback deps \u2014 same ref pattern as generationSourceRef.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts (Step 5): Destructure selectedLorasRef from context. Read selectedLorasRef.current inside the callback and pass selectedLoras: selectedLorasRef.current to buildSubmissionTaskParams.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Phase 2 Steps 8-9: Pass LoRAs through imageContext using effective model, verify generation.ts passthrough.\n\n1. In reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts: Add selectedLorasByCategory to CreateTaskImageContext (line 58-61): selectedLorasByCategory?: Partial<Record<'qwen' | 'z-image', Array<{ path: string; strength: number }>>>;\n\n2. In reigh-app/supabase/functions/ai-timeline-agent/loop.ts (line 331-336): Pass selectedLorasByCategory: imageSettings.selectedLorasByCategory into the imageContext object.\n\n3. In create-task.tsexecuteCreateTask (around line 133-167): After computing defaultModelName and activeReferenceParams:\n - Compute effective model: const effectiveModel = asTrimmedString(args.model) ?? defaultModelName ?? undefined;\n - Determine LoRA category: const loraCategory = effectiveModel?.startsWith('z-') ? 'z-image' as const : 'qwen' as const;\n - For by-reference task types (those with a reference mode), always use 'qwen' category.\n - Extract: const loras = imageContext?.selectedLorasByCategory?.[loraCategory] ?? [];\n - Build merged params: const mergedParams = { ...(activeReferenceParams ?? {}), ...(loras.length > 0 ? { loras } : {}) };\n - Pass to createGenerationTask: params: Object.keys(mergedParams).length > 0 ? mergedParams : undefined\n\n4. Step 9 (verify only): Read reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts and confirm buildImageGenerationInput at line 84-121 spreads legacyInput (from args.params) so loras flows through automatically. No changes expected.",
"depends_on": [
"T4"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to FormSubmissionPromptConfig.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts: Add selectedLoras: loraManager.selectedLoras to the promptConfig object in the useFormSubmission({...}) call (around lines 350-360).\n\n3. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts: Destructure selectedLoras from promptConfig. Create ref: const selectedLorasRef = useRef(selectedLoras); selectedLorasRef.current = selectedLoras; Pass selectedLorasRef to useTaskParamsBuilder and to buildSubmissionRuntimeContext.\n\n4. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts: Add selectedLorasRef: MutableRefObject<ActiveLora[]> to SubmissionRuntimeContext. Accept it in buildSubmissionRuntimeContext and include in returned object.",
"depends_on": [],
"status": "done",
"executor_notes": "Added selectedLoras: ActiveLora[] to FormSubmissionPromptConfig, passed loraManager.selectedLoras from useImageGenForm, created selectedLorasRef in useFormSubmission with selectedLorasRef.current = selectedLoras on each render, and threaded that ref into buildSubmissionRuntimeContext and the useTaskParamsBuilder call site. Verified with file inspection and a clean eslint run across all edited files.",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In : Add to : \n\n2. In (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string and numeric , drop malformed entries.\n - Legacy fallback: If is absent but exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "done",
"executor_notes": "Extended with and updated to parse primary category data plus legacy , validate and , map legacy models into the category, and dedupe by within each category before returning non-empty normalized data. Verified with file inspection and the same clean eslint run.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Did not run full TypeScript or Vitest verification in this batch. The approved plan defers end-to-end verification to T6, and batch 1 intentionally stops before T2 updates useTaskParamsBuilder to consume the newly threaded selectedLorasRef.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_1.json, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts, reigh-app/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts, reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts, reigh-app/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts, reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts, reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents",
"Advisory audit finding: Sense check SC2 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC2",
"task_id": "T2",
"question": "Do both useTaskParamsBuilder (managed path) and useAutomatedPromptSubmission (automated path) read selectedLorasRef.current inside their callbacks, and is selectedLorasRef NOT in any useCallback dependency array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does create-task.ts compute LoRA category from the effective model (args.model override ?? defaultModelName), use 'qwen' for reference task types, and pass loras in merged params?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to FormSubmissionPromptConfig.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts: Add selectedLoras: loraManager.selectedLoras to the promptConfig object in the useFormSubmission({...}) call (around lines 350-360).\n\n3. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts: Destructure selectedLoras from promptConfig. Create ref: const selectedLorasRef = useRef(selectedLoras); selectedLorasRef.current = selectedLoras; Pass selectedLorasRef to useTaskParamsBuilder and to buildSubmissionRuntimeContext.\n\n4. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts: Add selectedLorasRef: MutableRefObject<ActiveLora[]> to SubmissionRuntimeContext. Accept it in buildSubmissionRuntimeContext and include in returned object.",
"depends_on": [],
"status": "done",
"executor_notes": "Added selectedLoras: ActiveLora[] to FormSubmissionPromptConfig, passed loraManager.selectedLoras from useImageGenForm, created selectedLorasRef in useFormSubmission with selectedLorasRef.current = selectedLoras on each render, and threaded that ref into buildSubmissionRuntimeContext and the useTaskParamsBuilder call site. Verified with file inspection and a clean eslint run across all edited files.",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Phase 1 Steps 4-5: Thread selectedLorasRef through both managed and automated submission paths.\n\n1. In (Step 4): Add to . Import . Destructure from props, read inside the callback and pass to context. Do NOT add to deps \u2014 same ref pattern as .\n\n2. In (Step 5): Destructure from . Read inside the callback and pass to .",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Phase 1 Step 6: Convert ActiveLora[] to PathLoraConfig[] at submissionTaskPlan boundary and replace hardcoded loras:[] in buildBatchTaskParams.\n\n1. In : Import from . Add to . At the call site to (line 77-91), convert: .\n\n2. In : Import from . Add to . Replace hardcoded at line 75 with .",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts",
"reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In : Add to : \n\n2. In (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string and numeric , drop malformed entries.\n - Legacy fallback: If is absent but exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "done",
"executor_notes": "Extended with and updated to parse primary category data plus legacy , validate and , map legacy models into the category, and dedupe by within each category before returning non-empty normalized data. Verified with file inspection and the same clean eslint run.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Phase 2 Steps 8-9: Pass LoRAs through imageContext using effective model, verify generation.ts passthrough.\n\n1. In : Add to (line 58-61): \n\n2. In (line 331-336): Pass into the object.\n\n3. In (around line 133-167): After computing and :\n - Compute effective model: \n - Determine LoRA category: \n - For by-reference task types (those with a reference mode), always use 'qwen' category.\n - Extract: \n - Build merged params: \n - Pass to : \n\n4. Step 9 (verify only): Read and confirm at line 84-121 spreads (from ) so flows through automatically. No changes expected.",
"depends_on": [
"T4"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Phase 3: Run TypeScript compilation and existing tests to verify all changes.\n\n1. Run in to catch type errors across both form and agent chains.\n2. Run existing tests in the form submission directory and agent directory. Find relevant test files with glob patterns like , , .\n3. Write a short throwaway verification script that imports the key types and confirms: (a) ActiveLora[] can be mapped to PathLoraConfig[], (b) the buildBatchTaskParams input type accepts loras, (c) SubmissionTaskContext accepts selectedLoras. Run it, confirm it passes, then delete it.\n4. If any test or type check fails, read the error, fix the code, and re-run until passing.",
"depends_on": [
"T3",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"ActiveLora type import path: verify exports both ActiveLora and PathLoraConfig \u2014 check before using",
"Ref pattern: selectedLorasRef must NOT be added to useCallback dependency arrays \u2014 match existing generationSourceRef/selectedTextModelRef pattern exactly",
"buildBatchTaskParams has TWO LoRA mechanisms: (PathLoraConfig[]) and (from phaseLoraStrengths). These are independent \u2014 only fix passthrough, do not touch ",
"Agent edge functions have separate module resolution from frontend \u2014 use inline types for LoRA shapes in agent code, not imports from frontend domains",
"Legacy fallback: is keyed by model name strings. Category mapping: model names starting with 'z-' \u2192 'z-image' category, all others \u2192 'qwen' category",
"The field flows through agent's \u2192 \u2192 spread in . Verify this spread exists before relying on it",
"Plan assumption: loraManager.selectedLoras already returns the correct category's LoRAs for the current model \u2014 the form chain passes them through as-is without category logic",
"Plan assumption: create-task edge function accepts loras as PathLoraConfig[] format (same as frontend type) \u2014 if backend expects different format, conversion needed",
"For by-reference task types in agent, always use 'qwen' LoRA category regardless of effective model"
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does FormSubmissionPromptConfig now include selectedLoras: ActiveLora[], and does useFormSubmission create a ref that stays current? Verify the ref update pattern matches generationSourceRef.",
"executor_note": "Yes. now includes , and keeps a live by setting on each render before threading it onward, matching the existing mutable-ref usage pattern.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do both useTaskParamsBuilder (managed path) and useAutomatedPromptSubmission (automated path) read selectedLorasRef.current inside their callbacks, and is selectedLorasRef NOT in any useCallback dependency array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Is the ActiveLora[] \u2192 PathLoraConfig[] conversion done exactly once in submissionTaskPlan.ts (not scattered), and does buildBatchTaskParams no longer hardcode loras: []?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does normalizeProjectImageSettings handle both primary (selectedLorasByCategory) and legacy (selectedLorasByTextModel) formats, with proper validation (string path, numeric strength) and dedup by path?",
"executor_note": "Yes. now handles both and legacy , keeps only entries with string plus finite numeric , maps legacy model keys to , and dedupes each category by .",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does create-task.ts compute LoRA category from the effective model (args.model override ?? defaultModelName), use 'qwen' for reference task types, and pass loras in merged params?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does pass cleanly and do all existing tests pass without modification (or with minimal updates if they asserted on hardcoded loras:[])?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a pure plumbing fix across two independent chains (form UI and agent). The form chain (T1-T3) must be sequential because each step adds types/props that the next step consumes. The agent chain (T4-T5) is fully independent and can be done in parallel with T1-T3.\n\nKey judgment calls:\n- The ref pattern (selectedLorasRef) is critical for correctness. Both managed and automated paths use callbacks that could capture stale closures. Follow the exact same pattern as generationSourceRef \u2014 create ref in useFormSubmission, update .current on every render, read .current inside callbacks, never add to deps.\n- The ActiveLora[] \u2192 PathLoraConfig[] conversion happens at a single point (submissionTaskPlan.ts) to keep the mapping clean. Don't be tempted to convert earlier.\n- For the agent legacy fallback, the category mapping logic (z- prefix \u2192 z-image, else qwen) must match what the frontend migration does. Read the frontend migration code if unsure about edge cases.\n- Step 9 is verify-only \u2014 if buildImageGenerationInput doesn't spread legacyInput as expected, that's a blocker that needs escalation, not a code change in generation.ts.\n- The two open questions in plan metadata (about additional_loras independence and PathLoraConfig[] format acceptance) are treated as confirmed assumptions. If either turns out wrong during execution, stop and reassess.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add selectedLoras to FormSubmissionPromptConfig types",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Pass selectedLoras from useImageGenForm to useFormSubmission",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 3: Create ref and wire both submission paths via submissionContext",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 4: Thread through managed path \u2014 useTaskParamsBuilder",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 5: Thread through automated path \u2014 useAutomatedPromptSubmission",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 6: Convert ActiveLora[] to PathLoraConfig[] and replace hardcoded loras:[]",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 7: Extend agent types and normalization with legacy fallback",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 8: Pass LoRAs through imageContext using effective model in create-task",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 9: Verify LoRA passthrough in buildImageGenerationInput (read-only)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 10: Run TypeScript compilation and existing tests",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 10 plan steps mapped to tasks. Steps 1-3 consolidated into T1 since they form a single atomic unit of type+prop+ref wiring. Steps 4-5 consolidated into T2 as parallel path threading. Steps 8-9 consolidated into T5 since step 9 is verify-only.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
{"output":"Completed batch 2 tasks T2 and T5 in reigh-app, verified the existing generation.ts passthrough by inspection, and wrote the batch checkpoint to .megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_2.json. Verification passed for eslint, the targeted frontend Vitest module (7/7 tests), and the targeted edge Vitest module (6/6 tests).","files_changed":["reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts","reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","reigh-app/supabase/functions/ai-timeline-agent/loop.ts",".megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_2.json"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts","npx vitest run --config config/testing/vitest.config.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.test.ts","npx vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts","git -C reigh-app diff -- src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts"],"deviations":["Full TypeScript verification remains deferred to T6. This batch intentionally threads selectedLoras into buildSubmissionTaskParams before T3 extends that function's typed context and the buildBatchTaskParams boundary."],"task_updates":[{"task_id":"T2","status":"done","executor_notes":"useTaskParamsBuilder now accepts selectedLorasRef, reads selectedLorasRef.current inside its callback, and intentionally keeps that ref out of the dependency array with an explicit exhaustive-deps suppression. useAutomatedPromptSubmission now reads selectedLorasRef.current inside its queued callback and forwards it into buildSubmissionTaskParams. Verified with a clean eslint run plus full-file Vitest runs for useFormSubmission.test.ts and useAutomatedPromptSubmission.test.ts.","files_changed":["reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts","reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts","npx vitest run --config config/testing/vitest.config.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.test.ts"]},{"task_id":"T5","status":"done","executor_notes":"CreateTaskImageContext now carries selectedLorasByCategory, loop.ts passes project LoRAs into imageContext, and executeCreateTask now derives an effective model, forces the qwen LoRA category for reference task types, otherwise maps z-* models to z-image, merges any resolved loras with active reference params, and forwards the merged params to createGenerationTask. Verified by inspection that buildImageGenerationInput in generation.ts still spreads legacyInput, plus a clean eslint run and a full-file Vitest run for supabase/functions/ai-timeline-agent/loop.test.ts.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","reigh-app/supabase/functions/ai-timeline-agent/loop.ts"],"commands_run":["npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts","npx vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC2","executor_note":"Yes. Both useTaskParamsBuilder and useAutomatedPromptSubmission now read selectedLorasRef.current inside their callbacks, and selectedLorasRef is intentionally not included in either dependency array."},{"sense_check_id":"SC5","executor_note":"Yes. create-task.ts now computes effectiveModel from args.model ?? defaultModelName, forces the qwen LoRA category for reference task types, otherwise maps z-* models to z-image, and passes any resolved loras through the merged params payload."}]}
Fix LoRA passthrough: form hardcodes loras:[] instead of passing selectedLoras, and agent needs to pass project LoRAs too
User notes and answers:
Full submission chain for LoRAs:
useImageGenForm.ts:421 has loraManager.selectedLoras (ActiveLora[])
useFormSubmission.ts:58 calls useTaskParamsBuilder — currently does NOT pass selectedLoras
useTaskParamsBuilder.ts:33 calls buildSubmissionTaskParams — no LoRA param
submissionTaskPlan.ts:77 calls buildBatchTaskParams — no LoRA param
buildBatchTaskParams.ts:75 hardcodes loras: []
Fix chain: thread selectedLoras through each layer. Convert at buildBatchTaskParams level:
ActiveLora[] → PathLoraConfig[] via loras.map(l => ({path: l.path, strength: l.strength}))
For useTaskParamsBuilder, it uses refs (generationSourceRef, selectedTextModelRef). We should also use a ref for selectedLoras since it can change. OR just add selectedLoras to the props directly since it's already in useFormSubmission's scope via promptConfig.
useFormSubmission.ts gets promptConfig from useImageGenForm which includes selectedTextModelRef. We need to also get selectedLoras. Looking at useFormSubmission props:
promptConfig includes generationSourceRef, selectedTextModelRef
We need to add selectedLoras or a selectedLorasRef
For the agent side: loadProjectImageSettings already loads settings with selectedLorasByCategory. The agent just needs to extract the right category's LoRAs based on the effective model and pass them as loras in the params to createGenerationTask. The params field gets spread into the input via legacyInput in buildImageGenerationInput.
code
Batch framing:
- Execute batch 3 of 4.
- Actionable task IDs for this batch: ['T3']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T4', 'T5']
Actionable tasks for this batch:
[
{
"id": "T3",
"description": "Phase 1 Step 6: Convert ActiveLora[] to PathLoraConfig[] at submissionTaskPlan boundary and replace hardcoded loras:[] in buildBatchTaskParams.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to SubmissionTaskContext. At the call site to buildBatchTaskParams (line 77-91), convert: loras: context.selectedLoras.map(l => ({ path: l.path, strength: l.strength })).\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts: Import PathLoraConfig from @/domains/lora/types/lora. Add loras: PathLoraConfig[] to BuildBatchTaskParamsInput. Replace hardcoded loras: [] at line 75 with loras: input.loras.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts",
"reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to FormSubmissionPromptConfig.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts: Add selectedLoras: loraManager.selectedLoras to the promptConfig object in the useFormSubmission({...}) call (around lines 350-360).\n\n3. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts: Destructure selectedLoras from promptConfig. Create ref: const selectedLorasRef = useRef(selectedLoras); selectedLorasRef.current = selectedLoras; Pass selectedLorasRef to useTaskParamsBuilder and to buildSubmissionRuntimeContext.\n\n4. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts: Add selectedLorasRef: MutableRefObject<ActiveLora[]> to SubmissionRuntimeContext. Accept it in buildSubmissionRuntimeContext and include in returned object.",
"depends_on": [],
"status": "done",
"executor_notes": "Added selectedLoras: ActiveLora[] to FormSubmissionPromptConfig, passed loraManager.selectedLoras from useImageGenForm, created selectedLorasRef in useFormSubmission with selectedLorasRef.current = selectedLoras on each render, and threaded that ref into buildSubmissionRuntimeContext and the useTaskParamsBuilder call site. Verified with file inspection and a clean eslint run across all edited files.",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Phase 1 Steps 4-5: Thread selectedLorasRef through both managed and automated submission paths.\n\n1. In (Step 4): Add to . Import . Destructure from props, read inside the callback and pass to context. Do NOT add to deps \u2014 same ref pattern as .\n\n2. In (Step 5): Destructure from . Read inside the callback and pass to .",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": " now accepts , reads inside its callback, and intentionally keeps that ref out of the dependency array with an explicit exhaustive-deps suppression. now reads inside its queued callback and forwards it into . Verified with a clean eslint run plus full-file Vitest runs for and .",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In : Add to : \n\n2. In (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string and numeric , drop malformed entries.\n - Legacy fallback: If is absent but exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "done",
"executor_notes": "Extended with and updated to parse primary category data plus legacy , validate and , map legacy models into the category, and dedupe by within each category before returning non-empty normalized data. Verified with file inspection and the same clean eslint run.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Phase 2 Steps 8-9: Pass LoRAs through imageContext using effective model, verify generation.ts passthrough.\n\n1. In : Add to (line 58-61): \n\n2. In (line 331-336): Pass into the object.\n\n3. In (around line 133-167): After computing and :\n - Compute effective model: \n - Determine LoRA category: \n - For by-reference task types (those with a reference mode), always use 'qwen' category.\n - Extract: \n - Build merged params: \n - Pass to : \n\n4. Step 9 (verify only): Read and confirm at line 84-121 spreads (from ) so flows through automatically. No changes expected.",
"depends_on": [
"T4"
],
"status": "done",
"executor_notes": " now carries , passes project LoRAs into , and now derives an effective model, forces the LoRA category for reference task types, otherwise maps models to , merges any resolved with active reference params, and forwards the merged params to . Verified by inspection that in still spreads , plus a clean eslint run and a full-file Vitest run for .",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts",
"npx vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Full TypeScript verification remains deferred to T6. This batch intentionally threads selectedLoras into buildSubmissionTaskParams before T3 extends that function's typed context and the buildBatchTaskParams boundary.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_2.json, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts, reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts, reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts, reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts, reigh-app/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts, reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts, reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC3",
"task_id": "T3",
"question": "Is the ActiveLora[] \u2192 PathLoraConfig[] conversion done exactly once in submissionTaskPlan.ts (not scattered), and does buildBatchTaskParams no longer hardcode loras: []?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Phase 1 Steps 1-3: Add selectedLoras to form submission types, pass from useImageGenForm, create ref and wire submission context.\n\n1. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts: Import ActiveLora from @/domains/lora/types/lora. Add selectedLoras: ActiveLora[] to FormSubmissionPromptConfig.\n\n2. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts: Add selectedLoras: loraManager.selectedLoras to the promptConfig object in the useFormSubmission({...}) call (around lines 350-360).\n\n3. In reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts: Destructure selectedLoras from promptConfig. Create ref: const selectedLorasRef = useRef(selectedLoras); selectedLorasRef.current = selectedLoras; Pass selectedLorasRef to useTaskParamsBuilder and to buildSubmissionRuntimeContext.\n\n4. In reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts: Add selectedLorasRef: MutableRefObject<ActiveLora[]> to SubmissionRuntimeContext. Accept it in buildSubmissionRuntimeContext and include in returned object.",
"depends_on": [],
"status": "done",
"executor_notes": "Added selectedLoras: ActiveLora[] to FormSubmissionPromptConfig, passed loraManager.selectedLoras from useImageGenForm, created selectedLorasRef in useFormSubmission with selectedLorasRef.current = selectedLoras on each render, and threaded that ref into buildSubmissionRuntimeContext and the useTaskParamsBuilder call site. Verified with file inspection and a clean eslint run across all edited files.",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Phase 1 Steps 4-5: Thread selectedLorasRef through both managed and automated submission paths.\n\n1. In (Step 4): Add to . Import . Destructure from props, read inside the callback and pass to context. Do NOT add to deps \u2014 same ref pattern as .\n\n2. In (Step 5): Destructure from . Read inside the callback and pass to .",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": " now accepts , reads inside its callback, and intentionally keeps that ref out of the dependency array with an explicit exhaustive-deps suppression. now reads inside its queued callback and forwards it into . Verified with a clean eslint run plus full-file Vitest runs for and .",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts",
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.test.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Phase 1 Step 6: Convert ActiveLora[] to PathLoraConfig[] at submissionTaskPlan boundary and replace hardcoded loras:[] in buildBatchTaskParams.\n\n1. In : Import from . Add to . At the call site to (line 77-91), convert: .\n\n2. In : Import from . Add to . Replace hardcoded at line 75 with .",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionTaskPlan.ts",
"reigh-app/src/shared/components/ImageGenerationForm/lib/buildBatchTaskParams.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Phase 2 Step 7: Extend agent types and normalization with legacy selectedLorasByTextModel fallback.\n\n1. In : Add to : \n\n2. In (line 55-80): After existing normalization, add LoRA parsing:\n - Primary: If exists and is a record, parse each category key ('qwen', 'z-image'): validate array entries have string and numeric , drop malformed entries.\n - Legacy fallback: If is absent but exists (record keyed by model name), convert using category logic: models starting with 'z-' \u2192 'z-image', else 'qwen'. Merge and dedupe by path within each category.\n - Include result in returned object only if non-empty.",
"depends_on": [],
"status": "done",
"executor_notes": "Extended with and updated to parse primary category data plus legacy , validate and , map legacy models into the category, and dedupe by within each category before returning non-empty normalized data. Verified with file inspection and the same clean eslint run.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/types.ts src/shared/components/ImageGenerationForm/hooks/useImageGenForm.ts src/shared/components/ImageGenerationForm/hooks/useFormSubmission.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/submissionContext.ts supabase/functions/ai-timeline-agent/types.ts supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Phase 2 Steps 8-9: Pass LoRAs through imageContext using effective model, verify generation.ts passthrough.\n\n1. In : Add to (line 58-61): \n\n2. In (line 331-336): Pass into the object.\n\n3. In (around line 133-167): After computing and :\n - Compute effective model: \n - Determine LoRA category: \n - For by-reference task types (those with a reference mode), always use 'qwen' category.\n - Extract: \n - Build merged params: \n - Pass to : \n\n4. Step 9 (verify only): Read and confirm at line 84-121 spreads (from ) so flows through automatically. No changes expected.",
"depends_on": [
"T4"
],
"status": "done",
"executor_notes": " now carries , passes project LoRAs into , and now derives an effective model, forces the LoRA category for reference task types, otherwise maps models to , merges any resolved with active reference params, and forwards the merged params to . Verified by inspection that in still spreads , plus a clean eslint run and a full-file Vitest run for .",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [
"npx eslint src/shared/components/ImageGenerationForm/hooks/formSubmission/useTaskParamsBuilder.ts src/shared/components/ImageGenerationForm/hooks/formSubmission/useAutomatedPromptSubmission.ts supabase/functions/ai-timeline-agent/tools/create-task.ts supabase/functions/ai-timeline-agent/loop.ts",
"npx vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Phase 3: Run TypeScript compilation and existing tests to verify all changes.\n\n1. Run in to catch type errors across both form and agent chains.\n2. Run existing tests in the form submission directory and agent directory. Find relevant test files with glob patterns like , , .\n3. Write a short throwaway verification script that imports the key types and confirms: (a) ActiveLora[] can be mapped to PathLoraConfig[], (b) the buildBatchTaskParams input type accepts loras, (c) SubmissionTaskContext accepts selectedLoras. Run it, confirm it passes, then delete it.\n4. If any test or type check fails, read the error, fix the code, and re-run until passing.",
"depends_on": [
"T3",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"ActiveLora type import path: verify exports both ActiveLora and PathLoraConfig \u2014 check before using",
"Ref pattern: selectedLorasRef must NOT be added to useCallback dependency arrays \u2014 match existing generationSourceRef/selectedTextModelRef pattern exactly",
"buildBatchTaskParams has TWO LoRA mechanisms: (PathLoraConfig[]) and (from phaseLoraStrengths). These are independent \u2014 only fix passthrough, do not touch ",
"Agent edge functions have separate module resolution from frontend \u2014 use inline types for LoRA shapes in agent code, not imports from frontend domains",
"Legacy fallback: is keyed by model name strings. Category mapping: model names starting with 'z-' \u2192 'z-image' category, all others \u2192 'qwen' category",
"The field flows through agent's \u2192 \u2192 spread in . Verify this spread exists before relying on it",
"Plan assumption: loraManager.selectedLoras already returns the correct category's LoRAs for the current model \u2014 the form chain passes them through as-is without category logic",
"Plan assumption: create-task edge function accepts loras as PathLoraConfig[] format (same as frontend type) \u2014 if backend expects different format, conversion needed",
"For by-reference task types in agent, always use 'qwen' LoRA category regardless of effective model"
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does FormSubmissionPromptConfig now include selectedLoras: ActiveLora[], and does useFormSubmission create a ref that stays current? Verify the ref update pattern matches generationSourceRef.",
"executor_note": "Yes. now includes , and keeps a live by setting on each render before threading it onward, matching the existing mutable-ref usage pattern.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do both useTaskParamsBuilder (managed path) and useAutomatedPromptSubmission (automated path) read selectedLorasRef.current inside their callbacks, and is selectedLorasRef NOT in any useCallback dependency array?",
"executor_note": "Yes. Both and now read inside their callbacks, and is intentionally not included in either dependency array.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Is the ActiveLora[] \u2192 PathLoraConfig[] conversion done exactly once in submissionTaskPlan.ts (not scattered), and does buildBatchTaskParams no longer hardcode loras: []?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does normalizeProjectImageSettings handle both primary (selectedLorasByCategory) and legacy (selectedLorasByTextModel) formats, with proper validation (string path, numeric strength) and dedup by path?",
"executor_note": "Yes. now handles both and legacy , keeps only entries with string plus finite numeric , maps legacy model keys to , and dedupes each category by .",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does create-task.ts compute LoRA category from the effective model (args.model override ?? defaultModelName), use 'qwen' for reference task types, and pass loras in merged params?",
"executor_note": "Yes. now computes from , forces the LoRA category for reference task types, otherwise maps models to , and passes any resolved through the merged payload.",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does pass cleanly and do all existing tests pass without modification (or with minimal updates if they asserted on hardcoded loras:[])?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a pure plumbing fix across two independent chains (form UI and agent). The form chain (T1-T3) must be sequential because each step adds types/props that the next step consumes. The agent chain (T4-T5) is fully independent and can be done in parallel with T1-T3.\n\nKey judgment calls:\n- The ref pattern (selectedLorasRef) is critical for correctness. Both managed and automated paths use callbacks that could capture stale closures. Follow the exact same pattern as generationSourceRef \u2014 create ref in useFormSubmission, update .current on every render, read .current inside callbacks, never add to deps.\n- The ActiveLora[] \u2192 PathLoraConfig[] conversion happens at a single point (submissionTaskPlan.ts) to keep the mapping clean. Don't be tempted to convert earlier.\n- For the agent legacy fallback, the category mapping logic (z- prefix \u2192 z-image, else qwen) must match what the frontend migration does. Read the frontend migration code if unsure about edge cases.\n- Step 9 is verify-only \u2014 if buildImageGenerationInput doesn't spread legacyInput as expected, that's a blocker that needs escalation, not a code change in generation.ts.\n- The two open questions in plan metadata (about additional_loras independence and PathLoraConfig[] format acceptance) are treated as confirmed assumptions. If either turns out wrong during execution, stop and reassess.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add selectedLoras to FormSubmissionPromptConfig types",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Pass selectedLoras from useImageGenForm to useFormSubmission",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 3: Create ref and wire both submission paths via submissionContext",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 4: Thread through managed path \u2014 useTaskParamsBuilder",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 5: Thread through automated path \u2014 useAutomatedPromptSubmission",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 6: Convert ActiveLora[] to PathLoraConfig[] and replace hardcoded loras:[]",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 7: Extend agent types and normalization with legacy fallback",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 8: Pass LoRAs through imageContext using effective model in create-task",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 9: Verify LoRA passthrough in buildImageGenerationInput (read-only)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 10: Run TypeScript compilation and existing tests",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 10 plan steps mapped to tasks. Steps 1-3 consolidated into T1 since they form a single atomic unit of type+prop+ref wiring. Steps 4-5 consolidated into T2 as parallel path threading. Steps 8-9 consolidated into T5 since step 9 is verify-only.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User explicitly approved this plan at the gate checkpoint.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T2, T5]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC2, SC5]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_2.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- If a test fails and you determine the failure is pre-existing (fails without your changes too), you MUST still re-run the FULL test suite with your changes applied. Pre-existing failures do not excuse you from verifying all other tests still pass. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User explicitly approved this plan at the gate checkpoint.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T3]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC3]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/fix-lora-passthrough-form-20260406-0645/execution_batch_3.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- If a test fails and you determine the failure is pre-existing (fails without your changes too), you MUST still re-run the FULL test suite with your changes applied. Pre-existing failures do not excuse you from verifying all other tests still pass. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.