Make the timeline agent's image generation match the ImageGenerationForm behavior. Core changes: (1) Always send model_name from project settings so tasks show in TaskPane with correct task_type. (2) Load and use the user's active style reference from project settings. (3) Include reference prompts in the system prompt context. (4) Update the agent's prompts/schemas to reflect actual available models (qwen-image/qwen-image-2512/z-image, NOT wan-2.2 for text-to-image). (5) Support reference modes (style/subject/scene/style-character) in create_task.
User notes and answers:
Complete context from research:
How settings are stored
ProjectImageSettings is in the 'settings' table: tool_id='project-image-settings', project_id scope, value is JSONB
executeCreateTask in create-task.ts passes model_name to createGenerationTask
createGenerationTask in generation.ts calls normalizeImageGenerationModelName which returns null for 'wan-2.2'
No model_name sent → resolver defaults to wan_2_2_t2i
What needs to happen
Load project image settings when building the system prompt (same place timeline state is loaded)
Default model_name to selectedTextModel from settings (fallback: 'qwen-image')
Include the user's active reference image URL in the system prompt so the LLM can use it
Fix normalizeImageGenerationModelName to accept all 3 valid models
Update prompts.ts: text-to-image models are qwen-image (default), qwen-image-2512, z-image
Update tool-schemas.ts: model enum should have qwen-image, qwen-image-2512, z-image for text-to-image
Keep wan-2.2, ltx-2.3, ltx-2.3-fast for image-to-video only
Assistant
User
Assistant
Executing batch 2. I’m reading the agent DB, prompt, and task creation paths together so the settings load, prompt context, and fallback model/reference behavior line up before I edit anything.
Assistant
I have the current surfaces. Next I’m checking the existing resource metadata and generation task input contracts so the DB hydration shape and the create_task fallback path match what the downstream resolver already accepts.
Assistant
The shape questions are resolved now. I’m moving to edits: DB helpers first, then the prompt contract, then create_task so the fallback model and saved reference only apply on the intended transfer paths.
Assistant
I’m applying the code changes now. The DB patch will mirror the app’s pointer-overrides-metadata hydration rules, and the create_task patch will keep the saved reference as an additive fallback instead of forcing by-reference generation.
Assistant
The first pass is in. I’m checking the edited files for a couple of edge cases now, especially default-model leakage into image-to-video and whether the hydrated reference defaults still match the form behavior.
Assistant
I found one real regression risk: the project’s default text-to-image model would also have been applied to image-to-video requests. I’m narrowing that fallback to the image-generation task family before I finalize this batch.
Assistant
I found a workable local verifier path: this repo has tsx, so I’m using that to at least import the edited modules and catch obvious TypeScript/module issues even though deno itself isn’t installed here.
Assistant
I’ve closed the main logic loop. I’m doing one last verification sweep with targeted searches so the batch output can point to the exact behaviors now present in each file.
Assistant
User
Assistant
Executing batch 3. I’m reading the agent loop and clips helpers end-to-end first so the new imageContext plumbing follows the existing call chain cleanly and the shot lookup uses the already-exported clip utilities instead of duplicating logic.
Assistant
I’ve got the integration points. The only non-obvious choice is the model fallback: I’m keeping it conditional on project settings existing so the no-settings path still preserves the current behavior exactly, which matches the approved trace requirement.
Assistant
I’m patching loop.ts now. The change stays additive: the loop will only do the extra shot/reference lookup when project image settings exist, and everything else in the agent flow remains on the same path.
Assistant
The loop plumbing is in. I’m checking the updated call chain now and, if the repo wiring allows it, I’ll run the whole loop.test.ts module rather than just inspect the file so the new optional imageContext argument gets exercised through the mocked dispatch path.
Assistant
The loop module test exposed the expected call-signature drift from the new optional imageContext argument. I’m updating the full-file expectation and then rerunning the whole loop.test.ts module so this batch has an actual green verification step instead of inspection-only.
Assistant
The integration path is verified now. The whole loop.test.ts module passed after I aligned its mocked executeCreateTask expectation with the new optional imageContext argument, so this batch has both the code path and the direct dispatch test covered.
Assistant
User
Assistant
This is the final validation batch, so I’m doing two things in sequence: first I’ll attempt the requested Deno check even though the binary has been missing in earlier batches, then I’ll create a short temporary verification module that exercises the exact model-fallback bug path plus the saved-reference and no-settings traces, run it together with the existing loop test, and delete the temp file afterward.
Assistant
The temporary verification module passed with the existing loop test, so the three traced scenarios are covered now. I’m deleting that temp file and then I’ll package the final verification results, including the explicit note that the requested Deno check could not run because the binary is absent here.
Assistant
Reference images
The form stores references in ProjectImageSettings.references array
Each reference has an id pointing to the 'resources' table
The selected reference for a shot is in selectedReferenceIdByShot[shotId]
When generating by-reference, the form sends style_reference_image (a URL)
The agent's executeCreateTask already handles reference_image_urls and maps to style_reference_image
What's missing: the agent doesn't know about the user's saved references. We need to:
a) Load the active reference URL from settings + resources table
b) Include it in the system prompt so the LLM knows it can use it
c) When the LLM uses style-transfer/subject-transfer, it can reference the user's active reference
Reference prompt propagation
When a reference is created from an existing generation, the original prompt should be attached
The enrichClipsWithPrompts in selectedClips.ts already fetches generation prompts
For references, need similar: load the generation that created the reference image and attach its prompt
Scope boundaries (NOT doing)
LoRAs: too complex for agent, skip for now
Hires fix: only for local generation, skip
Resolution/aspect ratio: use project defaults
Privacy settings: not relevant to task creation
Prompt expansion/automated mode: the LLM IS the prompt expander
Answers to questions:
The LLM should decide when to use the reference. Just surface it in the prompt context. Don't auto-convert.
For reference prompt loading: defer to follow-up if complex. The selected reference from settings has an ID pointing to the resources table. Resources may have a generation_id or source metadata. Check resources table schema.
Use 'none' as the fallback shot key. If selected clips have a shot_id, use that for per-shot reference lookup.
code
Batch framing:
- Execute batch 1 of 4.
- Actionable task IDs for this batch: ['T1', 'T3']
- Already completed task IDs available as dependency context: []
Actionable tasks for this batch:
[
{
"id": "T1",
"description": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
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": "Do the AgentProjectImageSettings and ResolvedReference types include all fields needed by downstream consumers (db.ts, create-task.ts, prompts.ts) without pulling in unnecessary fields?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the updated model enum clearly separate text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast)? Is style-character-transfer added to task_type enum?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Compile, validate, and trace. (1) Run Deno type check on the edge function to verify no type errors. (2) Mentally trace text-to-image flow: settings load \u2192 system prompt with preferred model \u2192 LLM omits model \u2192 executeCreateTask defaults to selectedTextModel \u2192 normalizeImageGenerationModelName succeeds \u2192 resolver maps to visible task_type. (3) Trace reference flow: loadActiveReference \u2192 system prompt shows URL+mode \u2192 LLM calls style-character-transfer \u2192 executeCreateTask resolves reference_mode and passes strength params. (4) Trace fallback (no settings): loadProjectImageSettings returns null \u2192 no extra queries \u2192 model defaults to undefined \u2192 existing wan_2_2_t2i behavior preserved. (5) Verify existing agent behaviors (image-to-video, duplicate, timeline editing) are unaffected by reading through the changes. Fix any issues found.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: Settings MUST be loaded from projects.settings JSONB column (keyed by 'project-image-settings'), NOT a standalone settings table. Query: supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle()",
"FLAG-002: Reference hydration MUST merge pointer overrides with resource metadata defaults. Pointer fields (referenceMode, strengths, etc.) take priority. See useHydratedReferences.ts:86-109 for the canonical pattern.",
"FLAG-003: style-character-transfer task type and reference_mode schema field must both be added so the agent can express all reference modes the resolver supports.",
"FLAG-004: Shot context must be derived from selected clips via findShotForGenerations() for per-shot reference lookup, falling back to 'none' key.",
"normalizeImageGenerationModelName in generation.ts must accept 'qwen-image', 'qwen-image-2512', and 'z-image' \u2014 verify it does before relying on it. If it doesn't handle these, that's a separate issue outside this plan's scope but worth flagging.",
"No new Supabase queries when project has no image settings (loadProjectImageSettings returns null \u2192 all downstream skipped).",
"System prompt additions for reference context must stay concise (<150 tokens) to avoid bloating the LLM context.",
"Existing agent behaviors (image-to-video with wan-2.2, duplicate, timeline editing) must remain unaffected \u2014 all new code paths are additive.",
"The resources table metadata JSONB for style-reference resources is assumed to contain styleReferenceImage (URL), referenceMode, and strength fields matching StyleReferenceMetadata \u2014 verify this assumption when implementing loadActiveReference.",
"resolveClipGenerationIds and findShotForGenerations must be importable from ./tools/clips.ts \u2014 check exports exist."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Do the AgentProjectImageSettings and ResolvedReference types include all fields needed by downstream consumers (db.ts, create-task.ts, prompts.ts) without pulling in unnecessary fields?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does loadProjectImageSettings query projects.settings (JSONB column) \u2014 NOT a standalone settings table? Does loadActiveReference correctly apply pointer overrides over resource metadata defaults (not the other way around)?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the updated model enum clearly separate text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast)? Is style-character-transfer added to task_type enum?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does the model guide in the system prompt remove wan-2.2 from text-to-image entirely? Is the reference context block concise and actionable for the LLM?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does executeCreateTask correctly fall back to imageContext.defaultModelName when args.model is absent? Does it pass mode-specific reference params (strengths, subject_description, etc.) through to createGenerationTask when using the active reference?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Is imageContext threaded through the full call chain: runAgentLoop \u2192 processToolCalls \u2192 executeToolCall \u2192 executeCreateTask? Are resolveClipGenerationIds and findShotForGenerations properly imported and used for shot context derivation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Does Deno type check pass with zero errors? Do the three trace scenarios (text-to-image, reference, no-settings fallback) all produce correct outcomes?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "Execution guidance:\n\n1. Read before writing: Every file is small (74-439 lines). Read each file fully before making changes \u2014 the plan references approximate line numbers that may have drifted.\n\n2. Parallel work: T1 (types) and T3 (schemas) have no dependencies and can be done simultaneously. T2 and T4 depend only on T1. T5 depends on T1 and T3. T6 is the integration point that depends on T2, T4, and T5.\n\n3. Key gotcha \u2014 settings query: The most critical detail is FLAG-001. The research notes said settings table but the real storage is projects.settings JSONB column. The plan corrected this. Double-check by grepping for existing project-image-settings usage patterns in the codebase if uncertain.\n\n4. Key gotcha \u2014 reference hydration order: Pointer fields override resource metadata, not the reverse. The pattern in useHydratedReferences.ts:86-109 is the reference implementation. The nullish coalescing order must be pointer.field ?? metadata.field.\n\n5. Key gotcha \u2014 clips.ts exports: The plan assumes resolveClipGenerationIds and findShotForGenerations are exported from clips.ts. Verify this \u2014 if they're not exported, add exports rather than duplicating logic.\n\n6. Deno specifics: These are Supabase Edge Functions using Deno. Imports use URL-style or import maps. Type checking may use deno check or a project-specific command \u2014 look for existing scripts or deno.json config.\n\n7. Scope discipline: Do NOT touch normalizeImageGenerationModelName in generation.ts \u2014 the plan relies on it already handling the three valid model names. If it doesn't, flag it but don't fix it in this PR.\n\n8. No test files to run: This is a Supabase Edge Function without a test suite visible in the plan. T7 validation is type checking + manual flow tracing. The executor should write a minimal script that imports the new functions and verifies types compile, then delete it.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add AgentProjectImageSettings and ResolvedReference types to types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add loadProjectImageSettings and loadActiveReference to db.ts",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Wire settings loading into the agent loop (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 4: Fix tool schema model enum and add reference_mode (tool-schemas.ts)",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Fix system prompt model guide and add reference context (prompts.ts)",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Handle style-character-transfer and default model/reference in create-task.ts",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 7: Thread imageContext through executeToolCall (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Compile and trace validation",
"finalize_task_ids": [
"T7"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 8 plan steps are covered. Steps 3 and 7 are both loop.ts changes and are combined into T6 to avoid splitting a single file's changes across tasks. Step 8 (validation) maps to T7.",
"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, T3]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC1, 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/make-the-timeline-agent-s-20260406-0602/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":"Implemented batch 1 tasks T1 and T3 in the timeline agent. Added the new image-settings/reference types, updated the create_task schema for current model availability, added style-character-transfer and reference_mode support, and checkpointed the batch update. Verification was limited to source inspection because deno is not installed in this environment.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/types.ts","reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",".megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_1.json"],"commands_run":["sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts","rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","rg -n "StyleReferenceMetadata|reference_mode|style-character|subject_description|in_this_scene|style_reference_strength|subject_strength" reigh-app/src reigh-app/supabase/functions/create-task -g '!/node_modules/'","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts","sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts","sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts","rg -n "selectedTextModel|generationSource|selectedReferenceIdByShot|selectedLorasByCategory|references:" reigh-app/src -g '!/node_modules/'","sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/db.ts","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts","sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts","deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts","test -w .megaplan/plans/make-the-timeline-agent-s-20260406-0602 && echo writable","ls -l .megaplan/plans/make-the-timeline-agent-s-20260406-0602"],"deviations":["Could not run the planned Deno verification command because deno is not installed in this environment."],"task_updates":[{"task_id":"T1","status":"done","executor_notes":"Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/types.ts"],"commands_run":["sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts","rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'","sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts","sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts","sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts","sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts","sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts","deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"]},{"task_id":"T3","status":"done","executor_notes":"Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added style-character-transfer, and exposed an explicit reference_mode override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"],"commands_run":["sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts","deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC1","executor_note":"The new settings/reference types are intentionally narrow: they cover selected text model, reference pointers, shot selection, and the resolved reference fields needed by db.ts, create-task.ts, and prompts.ts, without pulling in unrelated project image settings like LoRAs or prompt state."},{"sense_check_id":"SC3","executor_note":"The schema now separates text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast) in the description, and style-character-transfer is present in the task_type enum."}]}
Make the timeline agent's image generation match the ImageGenerationForm behavior. Core changes: (1) Always send model_name from project settings so tasks show in TaskPane with correct task_type. (2) Load and use the user's active style reference from project settings. (3) Include reference prompts in the system prompt context. (4) Update the agent's prompts/schemas to reflect actual available models (qwen-image/qwen-image-2512/z-image, NOT wan-2.2 for text-to-image). (5) Support reference modes (style/subject/scene/style-character) in create_task.
User notes and answers:
Complete context from research:
How settings are stored
ProjectImageSettings is in the 'settings' table: tool_id='project-image-settings', project_id scope, value is JSONB
executeCreateTask in create-task.ts passes model_name to createGenerationTask
createGenerationTask in generation.ts calls normalizeImageGenerationModelName which returns null for 'wan-2.2'
No model_name sent → resolver defaults to wan_2_2_t2i
What needs to happen
Load project image settings when building the system prompt (same place timeline state is loaded)
Default model_name to selectedTextModel from settings (fallback: 'qwen-image')
Include the user's active reference image URL in the system prompt so the LLM can use it
Fix normalizeImageGenerationModelName to accept all 3 valid models
Update prompts.ts: text-to-image models are qwen-image (default), qwen-image-2512, z-image
Update tool-schemas.ts: model enum should have qwen-image, qwen-image-2512, z-image for text-to-image
Keep wan-2.2, ltx-2.3, ltx-2.3-fast for image-to-video only
Reference images
The form stores references in ProjectImageSettings.references array
Each reference has an id pointing to the 'resources' table
The selected reference for a shot is in selectedReferenceIdByShot[shotId]
When generating by-reference, the form sends style_reference_image (a URL)
The agent's executeCreateTask already handles reference_image_urls and maps to style_reference_image
What's missing: the agent doesn't know about the user's saved references. We need to:
a) Load the active reference URL from settings + resources table
b) Include it in the system prompt so the LLM knows it can use it
c) When the LLM uses style-transfer/subject-transfer, it can reference the user's active reference
Reference prompt propagation
When a reference is created from an existing generation, the original prompt should be attached
The enrichClipsWithPrompts in selectedClips.ts already fetches generation prompts
For references, need similar: load the generation that created the reference image and attach its prompt
Scope boundaries (NOT doing)
LoRAs: too complex for agent, skip for now
Hires fix: only for local generation, skip
Resolution/aspect ratio: use project defaults
Privacy settings: not relevant to task creation
Prompt expansion/automated mode: the LLM IS the prompt expander
Answers to questions:
The LLM should decide when to use the reference. Just surface it in the prompt context. Don't auto-convert.
For reference prompt loading: defer to follow-up if complex. The selected reference from settings has an ID pointing to the resources table. Resources may have a generation_id or source metadata. Check resources table schema.
Use 'none' as the fallback shot key. If selected clips have a shot_id, use that for per-shot reference lookup.
code
Batch framing:
- Execute batch 2 of 4.
- Actionable task IDs for this batch: ['T2', 'T4', 'T5']
- Already completed task IDs available as dependency context: ['T1', 'T3']
Actionable tasks for this batch:
[
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.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": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added style-character-transfer, and exposed an explicit reference_mode override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Could not run the planned Deno verification command because deno is not installed in this environment.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_1.json, reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: 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/prompts.ts, reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.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 SC4 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.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC2",
"task_id": "T2",
"question": "Does loadProjectImageSettings query projects.settings (JSONB column) \u2014 NOT a standalone settings table? Does loadActiveReference correctly apply pointer overrides over resource metadata defaults (not the other way around)?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does the model guide in the system prompt remove wan-2.2 from text-to-image entirely? Is the reference context block concise and actionable for the LLM?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does executeCreateTask correctly fall back to imageContext.defaultModelName when args.model is absent? Does it pass mode-specific reference params (strengths, subject_description, etc.) through to createGenerationTask when using the active reference?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added , and exposed an explicit override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted , but is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Compile, validate, and trace. (1) Run Deno type check on the edge function to verify no type errors. (2) Mentally trace text-to-image flow: settings load \u2192 system prompt with preferred model \u2192 LLM omits model \u2192 executeCreateTask defaults to selectedTextModel \u2192 normalizeImageGenerationModelName succeeds \u2192 resolver maps to visible task_type. (3) Trace reference flow: loadActiveReference \u2192 system prompt shows URL+mode \u2192 LLM calls style-character-transfer \u2192 executeCreateTask resolves reference_mode and passes strength params. (4) Trace fallback (no settings): loadProjectImageSettings returns null \u2192 no extra queries \u2192 model defaults to undefined \u2192 existing wan_2_2_t2i behavior preserved. (5) Verify existing agent behaviors (image-to-video, duplicate, timeline editing) are unaffected by reading through the changes. Fix any issues found.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: Settings MUST be loaded from projects.settings JSONB column (keyed by 'project-image-settings'), NOT a standalone settings table. Query: supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle()",
"FLAG-002: Reference hydration MUST merge pointer overrides with resource metadata defaults. Pointer fields (referenceMode, strengths, etc.) take priority. See useHydratedReferences.ts:86-109 for the canonical pattern.",
"FLAG-003: style-character-transfer task type and reference_mode schema field must both be added so the agent can express all reference modes the resolver supports.",
"FLAG-004: Shot context must be derived from selected clips via findShotForGenerations() for per-shot reference lookup, falling back to 'none' key.",
"normalizeImageGenerationModelName in generation.ts must accept 'qwen-image', 'qwen-image-2512', and 'z-image' \u2014 verify it does before relying on it. If it doesn't handle these, that's a separate issue outside this plan's scope but worth flagging.",
"No new Supabase queries when project has no image settings (loadProjectImageSettings returns null \u2192 all downstream skipped).",
"System prompt additions for reference context must stay concise (<150 tokens) to avoid bloating the LLM context.",
"Existing agent behaviors (image-to-video with wan-2.2, duplicate, timeline editing) must remain unaffected \u2014 all new code paths are additive.",
"The resources table metadata JSONB for style-reference resources is assumed to contain styleReferenceImage (URL), referenceMode, and strength fields matching StyleReferenceMetadata \u2014 verify this assumption when implementing loadActiveReference.",
"resolveClipGenerationIds and findShotForGenerations must be importable from ./tools/clips.ts \u2014 check exports exist."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Do the AgentProjectImageSettings and ResolvedReference types include all fields needed by downstream consumers (db.ts, create-task.ts, prompts.ts) without pulling in unnecessary fields?",
"executor_note": "The new settings/reference types are intentionally narrow: they cover selected text model, reference pointers, shot selection, and the resolved reference fields needed by db.ts, create-task.ts, and prompts.ts, without pulling in unrelated project image settings like LoRAs or prompt state.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does loadProjectImageSettings query projects.settings (JSONB column) \u2014 NOT a standalone settings table? Does loadActiveReference correctly apply pointer overrides over resource metadata defaults (not the other way around)?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the updated model enum clearly separate text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast)? Is style-character-transfer added to task_type enum?",
"executor_note": "The schema now separates text-to-image models (, , ) from image-to-video models (, , ) in the description, and is present in the task_type enum.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does the model guide in the system prompt remove wan-2.2 from text-to-image entirely? Is the reference context block concise and actionable for the LLM?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does executeCreateTask correctly fall back to imageContext.defaultModelName when args.model is absent? Does it pass mode-specific reference params (strengths, subject_description, etc.) through to createGenerationTask when using the active reference?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Is imageContext threaded through the full call chain: runAgentLoop \u2192 processToolCalls \u2192 executeToolCall \u2192 executeCreateTask? Are resolveClipGenerationIds and findShotForGenerations properly imported and used for shot context derivation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Does Deno type check pass with zero errors? Do the three trace scenarios (text-to-image, reference, no-settings fallback) all produce correct outcomes?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "Execution guidance:\n\n1. : Every file is small (74-439 lines). Read each file fully before making changes \u2014 the plan references approximate line numbers that may have drifted.\n\n2. : T1 (types) and T3 (schemas) have no dependencies and can be done simultaneously. T2 and T4 depend only on T1. T5 depends on T1 and T3. T6 is the integration point that depends on T2, T4, and T5.\n\n3. : The most critical detail is FLAG-001. The research notes said table but the real storage is JSONB column. The plan corrected this. Double-check by grepping for existing usage patterns in the codebase if uncertain.\n\n4. : Pointer fields override resource metadata, not the reverse. The pattern in useHydratedReferences.ts:86-109 is the reference implementation. The nullish coalescing order must be .\n\n5. : The plan assumes resolveClipGenerationIds and findShotForGenerations are exported from clips.ts. Verify this \u2014 if they're not exported, add exports rather than duplicating logic.\n\n6. : These are Supabase Edge Functions using Deno. Imports use URL-style or import maps. Type checking may use or a project-specific command \u2014 look for existing scripts or deno.json config.\n\n7. : Do NOT touch normalizeImageGenerationModelName in generation.ts \u2014 the plan relies on it already handling the three valid model names. If it doesn't, flag it but don't fix it in this PR.\n\n8. : This is a Supabase Edge Function without a test suite visible in the plan. T7 validation is type checking + manual flow tracing. The executor should write a minimal script that imports the new functions and verifies types compile, then delete it.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add AgentProjectImageSettings and ResolvedReference types to types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add loadProjectImageSettings and loadActiveReference to db.ts",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Wire settings loading into the agent loop (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 4: Fix tool schema model enum and add reference_mode (tool-schemas.ts)",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Fix system prompt model guide and add reference context (prompts.ts)",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Handle style-character-transfer and default model/reference in create-task.ts",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 7: Thread imageContext through executeToolCall (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Compile and trace validation",
"finalize_task_ids": [
"T7"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 8 plan steps are covered. Steps 3 and 7 are both loop.ts changes and are combined into T6 to avoid splitting a single file's changes across tasks. Step 8 (validation) maps to T7.",
"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":"Implemented batch 2 tasks T2, T4, and T5. The timeline agent now has DB helpers for project image settings and active reference hydration, the system prompt accepts preferred-model and saved-reference context, and create_task supports style-character-transfer plus project-default model/reference fallback behavior for image-generation tasks. Verification was limited to source inspection because deno is not installed and a local tsx import check was blocked by sandbox IPC restrictions.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/db.ts","reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",".megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_2.json"],"commands_run":["sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/utils.ts","rg -n 'resources.*metadata|Tables\]\["resources"\]|styleReferenceImage|generation_id' reigh-app/src reigh-app/supabase/functions -g '!/node_modules/'","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts","rg -n '\["project-image-settings"\]|project-image-settings' reigh-app/src reigh-app/supabase/functions -g '!/node_modules/'","rg -n 'selectedReferenceIdByShot|references\?' reigh-app/src/shared/components/ImageGenerationForm -g '!/node_modules/'","sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts","sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts","sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","rg -n '"tsx"|"typescript"|"deno"' package.json reigh-app/package.json deno.json deno.jsonc reigh-app/deno.json reigh-app/deno.jsonc -g '!/node_modules/'","test -x ./node_modules/.bin/tsx && echo tsx-present","./node_modules/.bin/tsx --eval "await import('./supabase/functions/ai-timeline-agent/db.ts'); await import('./supabase/functions/ai-timeline-agent/prompts.ts'); await import('./supabase/functions/ai-timeline-agent/tools/create-task.ts'); console.log('tsx-import-ok')"","./node_modules/.bin/tsx --eval "(async () => { await import('./supabase/functions/ai-timeline-agent/db.ts'); await import('./supabase/functions/ai-timeline-agent/prompts.ts'); await import('./supabase/functions/ai-timeline-agent/tools/create-task.ts'); console.log('tsx-import-ok'); })().catch((error) => { console.error(error); process.exit(1); })"","rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts","rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","git diff -- reigh-app/supabase/functions/ai-timeline-agent/db.ts reigh-app/supabase/functions/ai-timeline-agent/prompts.ts reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"],"deviations":["deno is not installed in this environment, so the planned Deno verification command could not be run.","A follow-up tsx import check was attempted, but the sandbox denied the IPC pipe creation that tsx uses, so no automated module import verification was available."],"task_updates":[{"task_id":"T2","status":"done","executor_notes":"Added loadProjectImageSettings() against projects.settings and loadActiveReference() against resources, with hydration ordered as pointer override first and resource metadata/defaults second to match the form behavior. Verified the query shape and override order by rereading the patched code and cross-checking against the app's hydration pattern; deno is unavailable here, and a follow-up tsx import check was blocked by sandbox IPC restrictions.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/db.ts"],"commands_run":["sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts","sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts","sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts","sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts","sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts","sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts","sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts","rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts"]},{"task_id":"T4","status":"done","executor_notes":"Expanded the system prompt contract to accept defaultModel and activeReference, replaced the text-to-image model guide with the current Qwen/Z-Image set, and added a concise saved-reference context plus style-character-transfer guidance/example. Verified by rereading the rendered prompt source that wan-2.2 is only listed under image-to-video and that the new reference block stays short and actionable; deno is unavailable here, and a tsx import check was blocked by sandbox IPC restrictions.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"],"commands_run":["sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts","rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"]},{"task_id":"T5","status":"done","executor_notes":"Updated executeCreateTask() to support style-character-transfer, accept an imageContext, fall back to the project default model only for the image-generation family, honor reference_mode overrides, and use the saved active reference plus its mode-specific params when no transfer reference URL is provided. Verified by reading the control flow after the patch, including the narrowed model fallback to avoid leaking Qwen defaults into image-to-video; deno is unavailable here, and a tsx import check was blocked by sandbox IPC restrictions.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"],"commands_run":["sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts","rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC2","executor_note":"loadProjectImageSettings() now reads projects.settings['project-image-settings'], not the standalone settings table, and loadActiveReference() resolves pointer values before metadata/defaults (pointer.field ?? metadata.field ?? fallback) for each hydrated reference field."},{"sense_check_id":"SC4","executor_note":"The system prompt now lists only qwen-image, qwen-image-2512, and z-image under text-to-image, keeps wan-2.2 only under image-to-video, and adds a compact saved-reference block with URL, mode, and only the relevant reference params."},{"sense_check_id":"SC5","executor_note":"executeCreateTask() now falls back to imageContext.defaultModelName only for text-to-image and transfer tasks when args.model is absent, and when it uses imageContext.activeReference it forwards the saved strength/description/scene fields through params to createGenerationTask()."}]}
Make the timeline agent's image generation match the ImageGenerationForm behavior. Core changes: (1) Always send model_name from project settings so tasks show in TaskPane with correct task_type. (2) Load and use the user's active style reference from project settings. (3) Include reference prompts in the system prompt context. (4) Update the agent's prompts/schemas to reflect actual available models (qwen-image/qwen-image-2512/z-image, NOT wan-2.2 for text-to-image). (5) Support reference modes (style/subject/scene/style-character) in create_task.
User notes and answers:
Complete context from research:
How settings are stored
ProjectImageSettings is in the 'settings' table: tool_id='project-image-settings', project_id scope, value is JSONB
executeCreateTask in create-task.ts passes model_name to createGenerationTask
createGenerationTask in generation.ts calls normalizeImageGenerationModelName which returns null for 'wan-2.2'
No model_name sent → resolver defaults to wan_2_2_t2i
What needs to happen
Load project image settings when building the system prompt (same place timeline state is loaded)
Default model_name to selectedTextModel from settings (fallback: 'qwen-image')
Include the user's active reference image URL in the system prompt so the LLM can use it
Fix normalizeImageGenerationModelName to accept all 3 valid models
Update prompts.ts: text-to-image models are qwen-image (default), qwen-image-2512, z-image
Update tool-schemas.ts: model enum should have qwen-image, qwen-image-2512, z-image for text-to-image
Keep wan-2.2, ltx-2.3, ltx-2.3-fast for image-to-video only
Reference images
The form stores references in ProjectImageSettings.references array
Each reference has an id pointing to the 'resources' table
The selected reference for a shot is in selectedReferenceIdByShot[shotId]
When generating by-reference, the form sends style_reference_image (a URL)
The agent's executeCreateTask already handles reference_image_urls and maps to style_reference_image
What's missing: the agent doesn't know about the user's saved references. We need to:
a) Load the active reference URL from settings + resources table
b) Include it in the system prompt so the LLM knows it can use it
c) When the LLM uses style-transfer/subject-transfer, it can reference the user's active reference
Reference prompt propagation
When a reference is created from an existing generation, the original prompt should be attached
The enrichClipsWithPrompts in selectedClips.ts already fetches generation prompts
For references, need similar: load the generation that created the reference image and attach its prompt
Scope boundaries (NOT doing)
LoRAs: too complex for agent, skip for now
Hires fix: only for local generation, skip
Resolution/aspect ratio: use project defaults
Privacy settings: not relevant to task creation
Prompt expansion/automated mode: the LLM IS the prompt expander
Answers to questions:
The LLM should decide when to use the reference. Just surface it in the prompt context. Don't auto-convert.
For reference prompt loading: defer to follow-up if complex. The selected reference from settings has an ID pointing to the resources table. Resources may have a generation_id or source metadata. Check resources table schema.
Use 'none' as the fallback shot key. If selected clips have a shot_id, use that for per-shot reference lookup.
code
Batch framing:
- Execute batch 3 of 4.
- Actionable task IDs for this batch: ['T6']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3', 'T4', 'T5']
Actionable tasks for this batch:
[
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"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": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added loadProjectImageSettings() against projects.settings and loadActiveReference() against resources, with hydration ordered as pointer override first and resource metadata/defaults second to match the form behavior. Verified the query shape and override order by rereading the patched code and cross-checking against the app's hydration pattern; is unavailable here, and a follow-up import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts",
"sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts",
"sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added , and exposed an explicit override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted , but is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Expanded the system prompt contract to accept and , replaced the text-to-image model guide with the current Qwen/Z-Image set, and added a concise saved-reference context plus style-character-transfer guidance/example. Verified by rereading the rendered prompt source that is only listed under image-to-video and that the new reference block stays short and actionable; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "done",
"executor_notes": "Updated to support , accept an , fall back to the project default model only for the image-generation family, honor overrides, and use the saved active reference plus its mode-specific params when no transfer reference URL is provided. Verified by reading the control flow after the patch, including the narrowed model fallback to avoid leaking Qwen defaults into image-to-video; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"deno is not installed in this environment, so the planned Deno verification command could not be run.",
"A follow-up tsx import check was attempted, but the sandbox denied the IPC pipe creation that tsx uses, so no automated module import verification was available.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_2.json, reigh-app/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/prompts.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/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts, reigh-app/supabase/functions/ai-timeline-agent/prompts.ts, reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.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 SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC6",
"task_id": "T6",
"question": "Is imageContext threaded through the full call chain: runAgentLoop \u2192 processToolCalls \u2192 executeToolCall \u2192 executeCreateTask? Are resolveClipGenerationIds and findShotForGenerations properly imported and used for shot context derivation?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added loadProjectImageSettings() against projects.settings and loadActiveReference() against resources, with hydration ordered as pointer override first and resource metadata/defaults second to match the form behavior. Verified the query shape and override order by rereading the patched code and cross-checking against the app's hydration pattern; is unavailable here, and a follow-up import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts",
"sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts",
"sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added , and exposed an explicit override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted , but is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Expanded the system prompt contract to accept and , replaced the text-to-image model guide with the current Qwen/Z-Image set, and added a concise saved-reference context plus style-character-transfer guidance/example. Verified by rereading the rendered prompt source that is only listed under image-to-video and that the new reference block stays short and actionable; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "done",
"executor_notes": "Updated to support , accept an , fall back to the project default model only for the image-generation family, honor overrides, and use the saved active reference plus its mode-specific params when no transfer reference URL is provided. Verified by reading the control flow after the patch, including the narrowed model fallback to avoid leaking Qwen defaults into image-to-video; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Compile, validate, and trace. (1) Run Deno type check on the edge function to verify no type errors. (2) Mentally trace text-to-image flow: settings load \u2192 system prompt with preferred model \u2192 LLM omits model \u2192 executeCreateTask defaults to selectedTextModel \u2192 normalizeImageGenerationModelName succeeds \u2192 resolver maps to visible task_type. (3) Trace reference flow: loadActiveReference \u2192 system prompt shows URL+mode \u2192 LLM calls style-character-transfer \u2192 executeCreateTask resolves reference_mode and passes strength params. (4) Trace fallback (no settings): loadProjectImageSettings returns null \u2192 no extra queries \u2192 model defaults to undefined \u2192 existing wan_2_2_t2i behavior preserved. (5) Verify existing agent behaviors (image-to-video, duplicate, timeline editing) are unaffected by reading through the changes. Fix any issues found.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: Settings MUST be loaded from projects.settings JSONB column (keyed by 'project-image-settings'), NOT a standalone settings table. Query: supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle()",
"FLAG-002: Reference hydration MUST merge pointer overrides with resource metadata defaults. Pointer fields (referenceMode, strengths, etc.) take priority. See useHydratedReferences.ts:86-109 for the canonical pattern.",
"FLAG-003: style-character-transfer task type and reference_mode schema field must both be added so the agent can express all reference modes the resolver supports.",
"FLAG-004: Shot context must be derived from selected clips via findShotForGenerations() for per-shot reference lookup, falling back to 'none' key.",
"normalizeImageGenerationModelName in generation.ts must accept 'qwen-image', 'qwen-image-2512', and 'z-image' \u2014 verify it does before relying on it. If it doesn't handle these, that's a separate issue outside this plan's scope but worth flagging.",
"No new Supabase queries when project has no image settings (loadProjectImageSettings returns null \u2192 all downstream skipped).",
"System prompt additions for reference context must stay concise (<150 tokens) to avoid bloating the LLM context.",
"Existing agent behaviors (image-to-video with wan-2.2, duplicate, timeline editing) must remain unaffected \u2014 all new code paths are additive.",
"The resources table metadata JSONB for style-reference resources is assumed to contain styleReferenceImage (URL), referenceMode, and strength fields matching StyleReferenceMetadata \u2014 verify this assumption when implementing loadActiveReference.",
"resolveClipGenerationIds and findShotForGenerations must be importable from ./tools/clips.ts \u2014 check exports exist."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Do the AgentProjectImageSettings and ResolvedReference types include all fields needed by downstream consumers (db.ts, create-task.ts, prompts.ts) without pulling in unnecessary fields?",
"executor_note": "The new settings/reference types are intentionally narrow: they cover selected text model, reference pointers, shot selection, and the resolved reference fields needed by db.ts, create-task.ts, and prompts.ts, without pulling in unrelated project image settings like LoRAs or prompt state.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does loadProjectImageSettings query projects.settings (JSONB column) \u2014 NOT a standalone settings table? Does loadActiveReference correctly apply pointer overrides over resource metadata defaults (not the other way around)?",
"executor_note": " now reads , not the standalone settings table, and resolves pointer values before metadata/defaults () for each hydrated reference field.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the updated model enum clearly separate text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast)? Is style-character-transfer added to task_type enum?",
"executor_note": "The schema now separates text-to-image models (, , ) from image-to-video models (, , ) in the description, and is present in the task_type enum.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does the model guide in the system prompt remove wan-2.2 from text-to-image entirely? Is the reference context block concise and actionable for the LLM?",
"executor_note": "The system prompt now lists only , , and under text-to-image, keeps only under image-to-video, and adds a compact saved-reference block with URL, mode, and only the relevant reference params.",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does executeCreateTask correctly fall back to imageContext.defaultModelName when args.model is absent? Does it pass mode-specific reference params (strengths, subject_description, etc.) through to createGenerationTask when using the active reference?",
"executor_note": " now falls back to only for text-to-image and transfer tasks when is absent, and when it uses it forwards the saved strength/description/scene fields through to .",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Is imageContext threaded through the full call chain: runAgentLoop \u2192 processToolCalls \u2192 executeToolCall \u2192 executeCreateTask? Are resolveClipGenerationIds and findShotForGenerations properly imported and used for shot context derivation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Does Deno type check pass with zero errors? Do the three trace scenarios (text-to-image, reference, no-settings fallback) all produce correct outcomes?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "Execution guidance:\n\n1. : Every file is small (74-439 lines). Read each file fully before making changes \u2014 the plan references approximate line numbers that may have drifted.\n\n2. : T1 (types) and T3 (schemas) have no dependencies and can be done simultaneously. T2 and T4 depend only on T1. T5 depends on T1 and T3. T6 is the integration point that depends on T2, T4, and T5.\n\n3. : The most critical detail is FLAG-001. The research notes said table but the real storage is JSONB column. The plan corrected this. Double-check by grepping for existing usage patterns in the codebase if uncertain.\n\n4. : Pointer fields override resource metadata, not the reverse. The pattern in useHydratedReferences.ts:86-109 is the reference implementation. The nullish coalescing order must be .\n\n5. : The plan assumes resolveClipGenerationIds and findShotForGenerations are exported from clips.ts. Verify this \u2014 if they're not exported, add exports rather than duplicating logic.\n\n6. : These are Supabase Edge Functions using Deno. Imports use URL-style or import maps. Type checking may use or a project-specific command \u2014 look for existing scripts or deno.json config.\n\n7. : Do NOT touch normalizeImageGenerationModelName in generation.ts \u2014 the plan relies on it already handling the three valid model names. If it doesn't, flag it but don't fix it in this PR.\n\n8. : This is a Supabase Edge Function without a test suite visible in the plan. T7 validation is type checking + manual flow tracing. The executor should write a minimal script that imports the new functions and verifies types compile, then delete it.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add AgentProjectImageSettings and ResolvedReference types to types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add loadProjectImageSettings and loadActiveReference to db.ts",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Wire settings loading into the agent loop (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 4: Fix tool schema model enum and add reference_mode (tool-schemas.ts)",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Fix system prompt model guide and add reference context (prompts.ts)",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Handle style-character-transfer and default model/reference in create-task.ts",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 7: Thread imageContext through executeToolCall (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Compile and trace validation",
"finalize_task_ids": [
"T7"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 8 plan steps are covered. Steps 3 and 7 are both loop.ts changes and are combined into T6 to avoid splitting a single file's changes across tasks. Step 8 (validation) maps to T7.",
"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":"Implemented batch 3 task T6. The agent loop now loads project image settings, derives shot context from selected clips when settings exist, resolves the active reference, builds an imageContext bag, passes the preferred model and active reference into the system prompt, and threads that same context through runAgentLoop -> processToolCalls -> executeToolCall -> executeCreateTask. I also updated the existing loop unit test to match the new optional imageContext argument and verified the whole loop.test.ts module passes.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/loop.ts","reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts",".megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_3.json"],"commands_run":["sed -n '1,460p' reigh-app/supabase/functions/ai-timeline-agent/loop.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/clips.ts","rg -n "executeToolCall\(|processToolCalls\(|buildTimelineAgentSystemPrompt\(|loadTimelineState\(|executeCreateTask\(" reigh-app/supabase/functions/ai-timeline-agent -g '!/node_modules/'","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts","cat reigh-app/package.json","./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts","rg -n "loadProjectImageSettings|loadActiveReference|resolveClipGenerationIds|findShotForGenerations|imageContext|defaultModel|activeReference" reigh-app/supabase/functions/ai-timeline-agent/loop.ts","sed -n '1,130p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"],"deviations":[],"task_updates":[{"task_id":"T6","status":"done","executor_notes":"Threaded imageContext through runAgentLoop -> processToolCalls -> executeToolCall -> executeCreateTask, loaded project image settings from the loop, derived shot context from selected clips via resolveClipGenerationIds() and findShotForGenerations(), and passed the preferred model plus active reference into both the system prompt and tool execution path. Verified the integration with a full run of supabase/functions/ai-timeline-agent/loop.test.ts under the edge Vitest config after updating its mocked executeCreateTask expectation for the new optional argument.","files_changed":["reigh-app/supabase/functions/ai-timeline-agent/loop.ts","reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"],"commands_run":["sed -n '1,460p' reigh-app/supabase/functions/ai-timeline-agent/loop.ts","sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/clips.ts","rg -n "executeToolCall\(|processToolCalls\(|buildTimelineAgentSystemPrompt\(|loadTimelineState\(|executeCreateTask\(" reigh-app/supabase/functions/ai-timeline-agent -g '!/node_modules/'","sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts","cat reigh-app/package.json","./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts","rg -n "loadProjectImageSettings|loadActiveReference|resolveClipGenerationIds|findShotForGenerations|imageContext|defaultModel|activeReference" reigh-app/supabase/functions/ai-timeline-agent/loop.ts","sed -n '1,130p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC6","executor_note":"imageContext now flows through runAgentLoop -> processToolCalls -> executeToolCall -> executeCreateTask, and the loop imports and uses resolveClipGenerationIds() plus findShotForGenerations() to compute the selected-shot context before resolving the active reference."}]}
Make the timeline agent's image generation match the ImageGenerationForm behavior. Core changes: (1) Always send model_name from project settings so tasks show in TaskPane with correct task_type. (2) Load and use the user's active style reference from project settings. (3) Include reference prompts in the system prompt context. (4) Update the agent's prompts/schemas to reflect actual available models (qwen-image/qwen-image-2512/z-image, NOT wan-2.2 for text-to-image). (5) Support reference modes (style/subject/scene/style-character) in create_task.
User notes and answers:
Complete context from research:
How settings are stored
ProjectImageSettings is in the 'settings' table: tool_id='project-image-settings', project_id scope, value is JSONB
executeCreateTask in create-task.ts passes model_name to createGenerationTask
createGenerationTask in generation.ts calls normalizeImageGenerationModelName which returns null for 'wan-2.2'
No model_name sent → resolver defaults to wan_2_2_t2i
What needs to happen
Load project image settings when building the system prompt (same place timeline state is loaded)
Default model_name to selectedTextModel from settings (fallback: 'qwen-image')
Include the user's active reference image URL in the system prompt so the LLM can use it
Fix normalizeImageGenerationModelName to accept all 3 valid models
Update prompts.ts: text-to-image models are qwen-image (default), qwen-image-2512, z-image
Update tool-schemas.ts: model enum should have qwen-image, qwen-image-2512, z-image for text-to-image
Keep wan-2.2, ltx-2.3, ltx-2.3-fast for image-to-video only
Reference images
The form stores references in ProjectImageSettings.references array
Each reference has an id pointing to the 'resources' table
The selected reference for a shot is in selectedReferenceIdByShot[shotId]
When generating by-reference, the form sends style_reference_image (a URL)
The agent's executeCreateTask already handles reference_image_urls and maps to style_reference_image
What's missing: the agent doesn't know about the user's saved references. We need to:
a) Load the active reference URL from settings + resources table
b) Include it in the system prompt so the LLM knows it can use it
c) When the LLM uses style-transfer/subject-transfer, it can reference the user's active reference
Reference prompt propagation
When a reference is created from an existing generation, the original prompt should be attached
The enrichClipsWithPrompts in selectedClips.ts already fetches generation prompts
For references, need similar: load the generation that created the reference image and attach its prompt
Scope boundaries (NOT doing)
LoRAs: too complex for agent, skip for now
Hires fix: only for local generation, skip
Resolution/aspect ratio: use project defaults
Privacy settings: not relevant to task creation
Prompt expansion/automated mode: the LLM IS the prompt expander
Answers to questions:
The LLM should decide when to use the reference. Just surface it in the prompt context. Don't auto-convert.
For reference prompt loading: defer to follow-up if complex. The selected reference from settings has an ID pointing to the resources table. Resources may have a generation_id or source metadata. Check resources table schema.
Use 'none' as the fallback shot key. If selected clips have a shot_id, use that for per-shot reference lookup.
code
Batch framing:
- Execute batch 4 of 4.
- Actionable task IDs for this batch: ['T7']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6']
Actionable tasks for this batch:
[
{
"id": "T7",
"description": "Compile, validate, and trace. (1) Run Deno type check on the edge function to verify no type errors. (2) Mentally trace text-to-image flow: settings load \u2192 system prompt with preferred model \u2192 LLM omits model \u2192 executeCreateTask defaults to selectedTextModel \u2192 normalizeImageGenerationModelName succeeds \u2192 resolver maps to visible task_type. (3) Trace reference flow: loadActiveReference \u2192 system prompt shows URL+mode \u2192 LLM calls style-character-transfer \u2192 executeCreateTask resolves reference_mode and passes strength params. (4) Trace fallback (no settings): loadProjectImageSettings returns null \u2192 no extra queries \u2192 model defaults to undefined \u2192 existing wan_2_2_t2i behavior preserved. (5) Verify existing agent behaviors (image-to-video, duplicate, timeline editing) are unaffected by reading through the changes. Fix any issues found.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"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": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added loadProjectImageSettings() against projects.settings and loadActiveReference() against resources, with hydration ordered as pointer override first and resource metadata/defaults second to match the form behavior. Verified the query shape and override order by rereading the patched code and cross-checking against the app's hydration pattern; is unavailable here, and a follow-up import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts",
"sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts",
"sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added , and exposed an explicit override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted , but is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Expanded the system prompt contract to accept and , replaced the text-to-image model guide with the current Qwen/Z-Image set, and added a concise saved-reference context plus style-character-transfer guidance/example. Verified by rereading the rendered prompt source that is only listed under image-to-video and that the new reference block stays short and actionable; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "done",
"executor_notes": "Updated to support , accept an , fall back to the project default model only for the image-generation family, honor overrides, and use the saved active reference plus its mode-specific params when no transfer reference URL is provided. Verified by reading the control flow after the patch, including the narrowed model fallback to avoid leaking Qwen defaults into image-to-video; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "done",
"executor_notes": "Threaded through , loaded project image settings from the loop, derived shot context from selected clips via and , and passed the preferred model plus active reference into both the system prompt and tool execution path. Verified the integration with a full run of under the edge Vitest config after updating its mocked expectation for the new optional argument.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"
],
"commands_run": [
"sed -n '1,460p' reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/clips.ts",
"rg -n "executeToolCall\(|processToolCalls\(|buildTimelineAgentSystemPrompt\(|loadTimelineState\(|executeCreateTask\(" reigh-app/supabase/functions/ai-timeline-agent -g '!'",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts",
"cat reigh-app/package.json",
"./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|resolveClipGenerationIds|findShotForGenerations|imageContext|defaultModel|activeReference" reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"sed -n '1,130p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_3.json, reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/supabase/functions/ai-timeline-agent/db.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts, reigh-app/supabase/functions/ai-timeline-agent/loop.ts, reigh-app/supabase/functions/ai-timeline-agent/prompts.ts, reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.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 SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC7",
"task_id": "T7",
"question": "Does Deno type check pass with zero errors? Do the three trace scenarios (text-to-image, reference, no-settings fallback) all produce correct outcomes?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add AgentProjectImageSettings and ResolvedReference types to types.ts (~line 87). AgentProjectImageSettings has selectedTextModel?, references? (array of {id, resourceId, referenceMode?, styleReferenceStrength?, subjectStrength?, subjectDescription?, inThisScene?, inThisSceneStrength?}), selectedReferenceIdByShot? (Record<string, string|null>). ResolvedReference has url, referenceMode, and optional strength/scene fields. See plan Step 1 for exact shapes.",
"depends_on": [],
"status": "done",
"executor_notes": "Added minimal agent-side contracts for project image settings, reference pointers, and resolved references. Verified the shapes cover the downstream fields called out in the plan without adding unrelated settings fields; attempted deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts, but deno is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/types.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"rg -n "AgentProjectImageSettings|ResolvedReference|referenceMode|styleReferenceStrength|subjectStrength|inThisSceneStrength|selectedReferenceIdByShot|project-image-settings" reigh-app/supabase/functions reigh-app/src/tools -g '!/node_modules/'",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/shared/components/ImageGenerationForm/types.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/types.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Add loadProjectImageSettings() and loadActiveReference() to db.ts. (1) loadProjectImageSettings queries supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle(), extracts data?.settings?.['project-image-settings']. Returns AgentProjectImageSettings | null. (2) loadActiveReference takes (supabaseAdmin, settings, shotId?) \u2014 looks up selectedReferenceIdByShot[shotId ?? 'none'], finds matching pointer in settings.references by pointer.id, fetches resource metadata from resources table, hydrates with pointer overrides (pointer fields take priority over metadata defaults per FLAG-002). Returns ResolvedReference | null. If no selected reference ID, returns null immediately (no extra queries). See plan Step 2.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added loadProjectImageSettings() against projects.settings and loadActiveReference() against resources, with hydration ordered as pointer override first and resource metadata/defaults second to match the form behavior. Verified the query shape and override order by rereading the patched code and cross-checking against the app's hydration pattern; is unavailable here, and a follow-up import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"sed -n '1,140p' reigh-app/src/features/resources/hooks/useResources.ts",
"sed -n '1,180p' reigh-app/src/shared/types/imageGeneration.ts",
"sed -n '70,130p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useHydratedReferences.ts",
"sed -n '1,260p' reigh-app/src/domains/media-lightbox/hooks/useReferences.ts",
"sed -n '1,220p' reigh-app/src/shared/components/ImageGenerationForm/hooks/useProjectImageSettings.ts",
"sed -n '1,320p' reigh-app/supabase/functions/ai-timeline-agent/db.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|project-image-settings|styleReferenceStrength|subjectStrength|inThisSceneStrength|pointer\." reigh-app/supabase/functions/ai-timeline-agent/db.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Update tool-schemas.ts (plan Step 4): (1) Fix model enum at ~line 55-59 to ['qwen-image', 'qwen-image-2512', 'z-image', 'wan-2.2', 'ltx-2.3', 'ltx-2.3-fast'] with description clarifying text-to-image vs image-to-video models. (2) Add 'style-character-transfer' to task_type enum at ~line 36-47. (3) Add reference_mode field with enum ['style', 'subject', 'style-character', 'scene'] and description about overriding reference mode.",
"depends_on": [],
"status": "done",
"executor_notes": "Updated the create_task schema to reflect the live text-to-image and image-to-video model split, added , and exposed an explicit override. Verified the enum and descriptions align with the planned modality separation by rereading the schema; attempted , but is not installed in this environment.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"commands_run": [
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,180p' reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts",
"deno check reigh-app/supabase/functions/ai-timeline-agent/types.ts reigh-app/supabase/functions/ai-timeline-agent/tool-schemas.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Update prompts.ts (plan Step 5): (1) Expand buildTimelineAgentSystemPrompt signature to accept defaultModel? and activeReference? (ResolvedReference|null). (2) Fix model guide at ~line 72-74: text-to-image lists qwen-image (default), qwen-image-2512, z-image; image-to-video lists wan-2.2 (default), ltx-2.3, ltx-2.3-fast. Remove wan-2.2 from text-to-image entirely. (3) If defaultModel provided, append preferred model line. (4) If activeReference provided, append concise reference context block (<150 tokens) with URL and mode. (5) Add style-character-transfer to task guide at ~line 77-84. (6) Add style-character-transfer example alongside existing examples at ~line 86-88.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Expanded the system prompt contract to accept and , replaced the text-to-image model guide with the current Qwen/Z-Image set, and added a concise saved-reference context plus style-character-transfer guidance/example. Verified by rereading the rendered prompt source that is only listed under image-to-video and that the new reference block stays short and actionable; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/prompts.ts",
"rg -n "text-to-image:|image-to-video:|style-character-transfer|Saved project reference available|Preferred text-to-image model" reigh-app/supabase/functions/ai-timeline-agent/prompts.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Update create-task.ts (plan Step 6): (1) Add 'style-character-transfer' to SUPPORTED_CREATE_TASK_TYPES set at ~line 12. (2) Add 'style-character-transfer': 'style-character' to TASK_TYPE_TO_REFERENCE_MODE at ~line 24. (3) Add style-character-transfer to TASK_TYPES_REQUIRING_PROMPT and TASK_TYPES_REQUIRING_REFERENCE_IMAGE sets. (4) Update executeCreateTask signature to accept imageContext? param with defaultModelName? and activeReference?. (5) Default model_name: asTrimmedString(args.model) ?? imageContext?.defaultModelName ?? undefined at ~line 124. (6) Support reference_mode override from args, falling back to TASK_TYPE_TO_REFERENCE_MODE mapping. (7) When transfer task has no reference_image_urls but imageContext.activeReference exists, use it as fallback. (8) When using active reference, pass its mode-specific params (style_reference_strength, subject_strength, subject_description, in_this_scene, in_this_scene_strength) through to createGenerationTask.",
"depends_on": [
"T1",
"T3"
],
"status": "done",
"executor_notes": "Updated to support , accept an , fall back to the project default model only for the image-generation family, honor overrides, and use the saved active reference plus its mode-specific params when no transfer reference URL is provided. Verified by reading the control flow after the patch, including the narrowed model fallback to avoid leaking Qwen defaults into image-to-video; is unavailable here, and a import check was blocked by sandbox IPC restrictions.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"commands_run": [
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts",
"sed -n '1,260p' reigh-app/supabase/functions/create-task/resolvers/imageGeneration.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts",
"rg -n "style-character-transfer|defaultModelName|reference_mode|activeReference|reference_image_urls" reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Wire everything through loop.ts (plan Steps 3 and 7 combined): (1) After loadTimelineState at ~line 306, call loadProjectImageSettings(supabaseAdmin, projectId). (2) Derive shot context: get clipGenerationIds via resolveClipGenerationIds from selected clips, then call findShotForGenerations if any exist. Import both from ./tools/clips.ts. (3) Resolve active reference via loadActiveReference(supabaseAdmin, imageSettings, clipShotId ?? undefined). (4) Pass defaultModel and activeReference to buildTimelineAgentSystemPrompt. (5) Create imageContext bag {defaultModelName, activeReference}. (6) Add imageContext param to executeToolCall at ~line 152 and thread through to executeCreateTask at ~line 177. (7) Update processToolCalls to accept and forward imageContext. (8) Pass imageContext from runAgentLoop to processToolCalls at ~line 373.",
"depends_on": [
"T2",
"T4",
"T5"
],
"status": "done",
"executor_notes": "Threaded through , loaded project image settings from the loop, derived shot context from selected clips via and , and passed the preferred model plus active reference into both the system prompt and tool execution path. Verified the integration with a full run of under the edge Vitest config after updating its mocked expectation for the new optional argument.",
"files_changed": [
"reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"
],
"commands_run": [
"sed -n '1,460p' reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"sed -n '1,260p' reigh-app/supabase/functions/ai-timeline-agent/tools/clips.ts",
"rg -n "executeToolCall\(|processToolCalls\(|buildTimelineAgentSystemPrompt\(|loadTimelineState\(|executeCreateTask\(" reigh-app/supabase/functions/ai-timeline-agent -g '!'",
"sed -n '1,220p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts",
"cat reigh-app/package.json",
"./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts",
"rg -n "loadProjectImageSettings|loadActiveReference|resolveClipGenerationIds|findShotForGenerations|imageContext|defaultModel|activeReference" reigh-app/supabase/functions/ai-timeline-agent/loop.ts",
"sed -n '1,130p' reigh-app/supabase/functions/ai-timeline-agent/loop.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Compile, validate, and trace. (1) Run Deno type check on the edge function to verify no type errors. (2) Mentally trace text-to-image flow: settings load \u2192 system prompt with preferred model \u2192 LLM omits model \u2192 executeCreateTask defaults to selectedTextModel \u2192 normalizeImageGenerationModelName succeeds \u2192 resolver maps to visible task_type. (3) Trace reference flow: loadActiveReference \u2192 system prompt shows URL+mode \u2192 LLM calls style-character-transfer \u2192 executeCreateTask resolves reference_mode and passes strength params. (4) Trace fallback (no settings): loadProjectImageSettings returns null \u2192 no extra queries \u2192 model defaults to undefined \u2192 existing wan_2_2_t2i behavior preserved. (5) Verify existing agent behaviors (image-to-video, duplicate, timeline editing) are unaffected by reading through the changes. Fix any issues found.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: Settings MUST be loaded from projects.settings JSONB column (keyed by 'project-image-settings'), NOT a standalone settings table. Query: supabaseAdmin.from('projects').select('settings').eq('id', projectId).maybeSingle()",
"FLAG-002: Reference hydration MUST merge pointer overrides with resource metadata defaults. Pointer fields (referenceMode, strengths, etc.) take priority. See useHydratedReferences.ts:86-109 for the canonical pattern.",
"FLAG-003: style-character-transfer task type and reference_mode schema field must both be added so the agent can express all reference modes the resolver supports.",
"FLAG-004: Shot context must be derived from selected clips via findShotForGenerations() for per-shot reference lookup, falling back to 'none' key.",
"normalizeImageGenerationModelName in generation.ts must accept 'qwen-image', 'qwen-image-2512', and 'z-image' \u2014 verify it does before relying on it. If it doesn't handle these, that's a separate issue outside this plan's scope but worth flagging.",
"No new Supabase queries when project has no image settings (loadProjectImageSettings returns null \u2192 all downstream skipped).",
"System prompt additions for reference context must stay concise (<150 tokens) to avoid bloating the LLM context.",
"Existing agent behaviors (image-to-video with wan-2.2, duplicate, timeline editing) must remain unaffected \u2014 all new code paths are additive.",
"The resources table metadata JSONB for style-reference resources is assumed to contain styleReferenceImage (URL), referenceMode, and strength fields matching StyleReferenceMetadata \u2014 verify this assumption when implementing loadActiveReference.",
"resolveClipGenerationIds and findShotForGenerations must be importable from ./tools/clips.ts \u2014 check exports exist."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Do the AgentProjectImageSettings and ResolvedReference types include all fields needed by downstream consumers (db.ts, create-task.ts, prompts.ts) without pulling in unnecessary fields?",
"executor_note": "The new settings/reference types are intentionally narrow: they cover selected text model, reference pointers, shot selection, and the resolved reference fields needed by db.ts, create-task.ts, and prompts.ts, without pulling in unrelated project image settings like LoRAs or prompt state.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does loadProjectImageSettings query projects.settings (JSONB column) \u2014 NOT a standalone settings table? Does loadActiveReference correctly apply pointer overrides over resource metadata defaults (not the other way around)?",
"executor_note": " now reads , not the standalone settings table, and resolves pointer values before metadata/defaults () for each hydrated reference field.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the updated model enum clearly separate text-to-image models (qwen-image, qwen-image-2512, z-image) from image-to-video models (wan-2.2, ltx-2.3, ltx-2.3-fast)? Is style-character-transfer added to task_type enum?",
"executor_note": "The schema now separates text-to-image models (, , ) from image-to-video models (, , ) in the description, and is present in the task_type enum.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does the model guide in the system prompt remove wan-2.2 from text-to-image entirely? Is the reference context block concise and actionable for the LLM?",
"executor_note": "The system prompt now lists only , , and under text-to-image, keeps only under image-to-video, and adds a compact saved-reference block with URL, mode, and only the relevant reference params.",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does executeCreateTask correctly fall back to imageContext.defaultModelName when args.model is absent? Does it pass mode-specific reference params (strengths, subject_description, etc.) through to createGenerationTask when using the active reference?",
"executor_note": " now falls back to only for text-to-image and transfer tasks when is absent, and when it uses it forwards the saved strength/description/scene fields through to .",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Is imageContext threaded through the full call chain: runAgentLoop \u2192 processToolCalls \u2192 executeToolCall \u2192 executeCreateTask? Are resolveClipGenerationIds and findShotForGenerations properly imported and used for shot context derivation?",
"executor_note": " now flows through , and the loop imports and uses plus to compute the selected-shot context before resolving the active reference.",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Does Deno type check pass with zero errors? Do the three trace scenarios (text-to-image, reference, no-settings fallback) all produce correct outcomes?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "Execution guidance:\n\n1. : Every file is small (74-439 lines). Read each file fully before making changes \u2014 the plan references approximate line numbers that may have drifted.\n\n2. : T1 (types) and T3 (schemas) have no dependencies and can be done simultaneously. T2 and T4 depend only on T1. T5 depends on T1 and T3. T6 is the integration point that depends on T2, T4, and T5.\n\n3. : The most critical detail is FLAG-001. The research notes said table but the real storage is JSONB column. The plan corrected this. Double-check by grepping for existing usage patterns in the codebase if uncertain.\n\n4. : Pointer fields override resource metadata, not the reverse. The pattern in useHydratedReferences.ts:86-109 is the reference implementation. The nullish coalescing order must be .\n\n5. : The plan assumes resolveClipGenerationIds and findShotForGenerations are exported from clips.ts. Verify this \u2014 if they're not exported, add exports rather than duplicating logic.\n\n6. : These are Supabase Edge Functions using Deno. Imports use URL-style or import maps. Type checking may use or a project-specific command \u2014 look for existing scripts or deno.json config.\n\n7. : Do NOT touch normalizeImageGenerationModelName in generation.ts \u2014 the plan relies on it already handling the three valid model names. If it doesn't, flag it but don't fix it in this PR.\n\n8. : This is a Supabase Edge Function without a test suite visible in the plan. T7 validation is type checking + manual flow tracing. The executor should write a minimal script that imports the new functions and verifies types compile, then delete it.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add AgentProjectImageSettings and ResolvedReference types to types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add loadProjectImageSettings and loadActiveReference to db.ts",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Wire settings loading into the agent loop (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 4: Fix tool schema model enum and add reference_mode (tool-schemas.ts)",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Fix system prompt model guide and add reference context (prompts.ts)",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Handle style-character-transfer and default model/reference in create-task.ts",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 7: Thread imageContext through executeToolCall (loop.ts)",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Compile and trace validation",
"finalize_task_ids": [
"T7"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All 8 plan steps are covered. Steps 3 and 7 are both loop.ts changes and are combined into T6 to avoid splitting a single file's changes across tasks. Step 8 (validation) maps to T7.",
"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":"Batch 4 validation is complete. deno check could not be run because deno is not installed in this environment, so Deno zero-error typecheck confirmation is unavailable. For functional verification, I created a temporary edge Vitest module that reproduced the original text-to-image model fallback bug, the saved-reference style-character path, and the no-settings fallback path, ran it together with the existing loop.test.ts module, got 10/10 tests passing, and then deleted the temporary file. I also confirmed by source inspection that normalizeImageGenerationModelName() accepts qwen-image, qwen-image-2512, and z-image, and that the loop/prompt/create-task wiring matches the three expected traces while leaving image-to-video, duplicate, and timeline-edit paths untouched.","files_changed":[".megaplan/plans/make-the-timeline-agent-s-20260406-0602/execution_batch_4.json"],"commands_run":["deno check reigh-app/supabase/functions/ai-timeline-agent/loop.ts","./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts supabase/functions/ai-timeline-agent/tools/verify-batch-4.test.ts","rg -n "normalizeImageGenerationModelName|IMAGE_GENERATION_MODELS|qwen-image-2512|z-image" reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","rg -n "defaultModelName|loadProjectImageSettings|loadActiveReference|reference_mode|style-character-transfer" 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/prompts.ts"],"deviations":["The requested Deno type check could not be completed because deno is not installed in this environment."],"task_updates":[{"task_id":"T7","status":"done","executor_notes":"Attempted the requested Deno type check, but deno is not installed in this environment. For functional verification, created a temporary edge Vitest module that reproduced the original text-to-image model fallback bug, the saved-reference style-character path, and the no-settings fallback path; ran it together with the existing loop.test.ts module and all 10 tests passed, then deleted the temporary file. Also confirmed by source inspection that normalizeImageGenerationModelName() accepts qwen-image, qwen-image-2512, and z-image, and that the loop/create-task/prompt wiring now matches the expected flows without touching unrelated image-to-video, duplicate, or timeline-edit branches.","files_changed":[],"commands_run":["deno check reigh-app/supabase/functions/ai-timeline-agent/loop.ts","./node_modules/.bin/vitest run --config config/testing/vitest.edge.config.ts supabase/functions/ai-timeline-agent/loop.test.ts supabase/functions/ai-timeline-agent/tools/verify-batch-4.test.ts","rg -n "normalizeImageGenerationModelName|IMAGE_GENERATION_MODELS|qwen-image-2512|z-image" reigh-app/supabase/functions/ai-timeline-agent/tools/generation.ts","rg -n "defaultModelName|loadProjectImageSettings|loadActiveReference|reference_mode|style-character-transfer" 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/prompts.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC7","executor_note":"The Deno type check could not be completed because deno is missing in this environment, so zero-error Deno validation is not available. The three behavioral traces were covered by a temporary verification module plus the existing loop test: text-to-image now sends model_name from imageContext.defaultModelName, the reference flow uses loadActiveReference() plus style-character params, and the no-settings path leaves model_name undefined and skips downstream reference lookups."}]}
[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, T4, T5]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC2, SC4, 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/make-the-timeline-agent-s-20260406-0602/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: [T6]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC6]
- 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/make-the-timeline-agent-s-20260406-0602/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.
[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: [T7]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC7]
- 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/make-the-timeline-agent-s-20260406-0602/execution_batch_4.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.