Clean up the final video badge and shot creation flow in the video editor timeline. Three issues to fix:
SHOT GROUP NOT APPEARING AFTER CREATE: createShotWithGenerationsPath in src/shared/hooks/shotCreation/shotCreationPaths.ts line 264 calls invalidateShotsQueries with refetchType:'inactive' which skips the active ShotsContext query. Same issue on line 204 for createShotWithFilesPath. Fix: remove refetchType:'inactive' so active queries refetch too.
FINAL VIDEO BADGE KEEPS REAPPEARING: dismissedShotIds in useFinalVideoAvailable.ts uses useState which resets on component remount. Move to a module-level Set (like useStaleVariants uses for dismissedAssetKeys at line 30) so it survives remounts. Also need to dismiss based on finalVideo.id (not shotId) so newer final videos for the same shot still show the badge.
BADGE SHOWS AFTER SWITCHING TO FINAL VIDEO: After applyEdit fires, the shot group recalculates. If the replaced video clip's generationId happens to match a shot image, the group re-forms and hasFinalVideo is still true (because finalVideoShotIds still includes it during the render before dismiss takes effect). The dismiss-before-switch approach was attempted but timing issues remain. Need a more robust solution - possibly check if any clip in the group is already using the final video asset, and suppress the badge in that case.
Batch framing:
- Execute batch 1 of 3.
- Actionable task IDs for this batch: ['T1', 'T2']
- Already completed task IDs available as dependency context: []
Actionable tasks for this batch:
[
{
"id": "T1",
"description": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in (lines 204 and 264). Change each call to just with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In :\n - Replace with a module-level outside the hook.\n - Add a inside the hook for re-render triggering.\n - Rename to \u2014 it now takes a and does .\n - Export (the Set) and (the callback) instead of the old /.\n\n2. In :\n - Update the destructured import: \n - Update the memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating \u2192 \u2192 \u2192 . Store in a . IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each in : skip if , skip if (final video already on timeline), otherwise add .\n c. Add , , to the memo deps.\n - Update line 548 callback: \n - Update line 549 callback: ",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
Assistant
User
Assistant
I’m verifying the API rename blast radius now. I’m checking for remaining old-name consumers and then running the relevant timeline editor test modules to confirm the callback-only plumbing still matches TimelineCanvas and the shot-group menu surface.
Assistant
The rename surface is clean so far. Search results show no remaining dismissShot or dismissedShotIds consumers under src/, and the timeline canvas/menu path is still callback-based rather than importing the hook directly.
Assistant
User
Assistant
I’m on the final verification step now. I’m running the full typecheck first, then I’ll run a one-off verification script that exercises the three fixed behaviors and remove that script afterward before doing a final diff review.
Assistant
Typecheck is clean. I’m adding a temporary verification module now that directly checks the active-shot refetch path, the module-scoped dismissal state, and the timeline-based badge suppression logic, then I’ll run it and remove it.
Assistant
Vitest’s config only picks up src/**/*.test.{ts,tsx}, so I’m relocating the temporary verification module into src/ and rerunning it there.
Assistant
The temporary verification module passed and is removed. I’m doing the final diff review now to confirm only the intended source files remain changed and to capture the final verification notes for the batch.
Assistant
The source diff is still scoped to the intended five source files plus the pre-existing .megaplan/debt.json. I’m checkpointing the final verification results now; there were no further source edits in this batch.
Assistant
{"output":"Executed batch 3 verification. npx tsc --noEmit passed cleanly, a temporary verification test module was created under , run successfully, and removed, and the final diff review confirms the intended source changes address all three bugs. Batch checkpoint written to .","files_changed":[".megaplan/plans/clean-up-the-final-video-20260406-0959/execution_batch_3.json"],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/.codex-final-video-verification.test.ts","git diff --name-only","git status --short","sed -n '196,272p' src/shared/hooks/shotCreation/shotCreationPaths.ts","sed -n '1,360p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts","sed -n '120,330p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","sed -n '576,604p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"],"deviations":[],"task_updates":[{"task_id":"T4","status":"done","executor_notes":"Ran successfully with no type errors. Wrote and ran a temporary verification test module under to exercise the three fixed behaviors, then removed it after it passed. Final review of the remaining diff shows only the intended source changes for shot invalidation, final-video dismissal persistence, and timeline-based final-video badge suppression; the only unrelated dirty file is the pre-existing .","files_changed":[],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/.codex-final-video-verification.test.ts","git diff --name-only","git status --short","sed -n '196,272p' src/shared/hooks/shotCreation/shotCreationPaths.ts","sed -n '1,360p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts","sed -n '120,330p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","sed -n '576,604p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC4","executor_note":" passed cleanly. The temporary verification module also passed and confirmed the three targeted behaviors: active shots queries refetch after invalidation, dismissed final-video ids persist in module scope and do not suppress newer final videos for the same shot, and the badge is hidden only when a current timeline clip is using the final video generation id."}]}
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": "After removing refetchType:'inactive', does the ShotsContext active query actually refetch? Confirm that invalidateShotsQueries without the filter triggers a refetch of queries with the 'shots' query key that ShotsContext uses.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does the timeline-clip-based generationId scan correctly identify when a final video is already placed on the timeline? Verify by tracing: useSwitchToFinalVideo sets generationId=finalVideo.id on the asset \u2192 the asset is assigned to a clip via meta[clipId].asset \u2192 the scan picks it up. Confirm the chain is unbroken.",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in src/shared/hooks/shotCreation/shotCreationPaths.ts (lines 204 and 264). Change each call to just invalidateShotsQueries(queryClient, selectedProjectId) with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In src/tools/video-editor/hooks/useFinalVideoAvailable.ts:\n - Replace useState<Set<string>> with a module-level const dismissedFinalVideoIds = new Set<string>() outside the hook.\n - Add a const [, forceRender] = useState(0) inside the hook for re-render triggering.\n - Rename dismissShot to dismissFinalVideo \u2014 it now takes a finalVideoId: string and does dismissedFinalVideoIds.add(finalVideoId); forceRender(n => n + 1).\n - Export dismissedFinalVideoIds (the Set) and dismissFinalVideo (the callback) instead of the old dismissedShotIds/dismissShot.\n\n2. In src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx:\n - Update the destructured import: const { finalVideoMap, dismissedFinalVideoIds, dismissFinalVideo } = useFinalVideoAvailable();\n - Update the finalVideoShotIds memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId. Store in a timelineClipGenerationIds: Set<string>. IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each [shotId, finalVideo] in finalVideoMap: skip if dismissedFinalVideoIds.has(finalVideo.id), skip if timelineClipGenerationIds.has(finalVideo.id) (final video already on timeline), otherwise add shotId.\n c. Add data?.rows, data?.meta, data?.registry?.assets to the memo deps.\n - Update line 548 callback: onShotGroupSwitchToFinalVideo={(group) => { const fv = finalVideoMap.get(group.shotId); if (fv) dismissFinalVideo(fv.id); handleSwitchToFinalVideo(group); }}\n - Update line 549 callback: onShotGroupDismissFinalVideo={(shotId) => { const fv = finalVideoMap.get(shotId); if (fv) dismissFinalVideo(fv.id); }}",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Verify no other consumers of old API: Grep for dismissShot, dismissedShotIds, and useFinalVideoAvailable across the codebase (excluding .megaplan/). Confirm only TimelineEditor.tsx and useFinalVideoAvailable.ts reference these. Check that TimelineCanvas.tsx and any context menu components receive callbacks (not the hook directly) so their prop signatures still match. If any other file imports the old names, update them.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Run npx tsc --noEmit to verify no type errors. If any failures, fix them. Then do a final review: read the changed files, confirm no out-of-scope edits, confirm the three bugs are addressed (shot invalidation, dismiss persistence, badge suppression when final video is on timeline).",
"depends_on": [
"T1",
"T2",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: When checking if final video is already on timeline, scan ACTUAL clip assets from rows+meta+registry (not just registry entries). Registry retains entries after clip removal, so scanning all registry assets would incorrectly suppress the badge after a final video clip is deleted. The correct approach: iterate data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId.",
"FLAG-002: Suppressing per-shot (not per-group) is acceptable \u2014 if the final video is on ANY group for a shot, hiding the badge on other groups of that shot is correct. The gate rationale confirms this. No action needed.",
"DEBT: final-video-badge-suppression, final-video-reminder-state, shot-group-badge-scope \u2014 all three are directly addressed by this plan's changes. Ensure the fix resolves them, not worsens them.",
"The module-level Set survives component remounts but resets on full page reload. It does NOT reset on project switch \u2014 if the user switches projects and back, old dismissals persist. This is acceptable per gate guidance but worth noting.",
"useSwitchToFinalVideo registers the asset with generationId: finalVideo.id (line 55). This is the same ID used for dismiss and timeline-presence checks. Ensure consistency \u2014 the finalVideo.id from useShotFinalVideos must match.",
"The forceRender pattern (useState counter + module Set) is simple but means only the component calling dismissFinalVideo re-renders. Since useFinalVideoAvailable is only called in TimelineEditor.tsx, this is fine."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "After removing refetchType:'inactive', does the ShotsContext active query actually refetch? Confirm that invalidateShotsQueries without the filter triggers a refetch of queries with the 'shots' query key that ShotsContext uses.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does the timeline-clip-based generationId scan correctly identify when a final video is already placed on the timeline? Verify by tracing: useSwitchToFinalVideo sets generationId=finalVideo.id on the asset \u2192 the asset is assigned to a clip via meta[clipId].asset \u2192 the scan picks it up. Confirm the chain is unbroken.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are there any other files besides TimelineEditor.tsx that import from useFinalVideoAvailable or reference dismissShot/dismissedShotIds? If TimelineCanvas or ShotGroupContextMenu receive these as props, do the prop types still match after the rename?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does npx tsc --noEmit pass cleanly? Are all three bugs addressed: (1) shot appears after creation, (2) dismiss survives remount, (3) badge hidden when final video is on timeline?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a focused 2-file fix (shotCreationPaths.ts + useFinalVideoAvailable.ts) plus a memo update in TimelineEditor.tsx. The trickiest part is T2's timeline-clip scan for FLAG-001: you MUST iterate rows\u2192meta\u2192registry to get generationIds of clips actually on the timeline, NOT scan all registry.assets entries (registry retains stale entries after clip deletion). The pattern for this scan already exists in useShotGroups.ts lines 51-58 \u2014 reuse that exact approach. The dismissFinalVideo rename is a breaking API change but only consumed in TimelineEditor.tsx (line 219, 548, 549), so the blast radius is small. T1 is fully independent and trivial \u2014 do it first for a quick win.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Remove refetchType:'inactive' from invalidateShotsQueries calls",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Move dismissed state to module-level Set keyed by finalVideo.id",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Suppress badge when final video is already on timeline",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Verify no other consumers of old API",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Run tsc --noEmit and validate",
"finalize_task_ids": [
"T4"
]
}
],
"orphan_tasks": [],
"completeness_notes": "Steps 2 and 3 are combined into T2 since they modify the same files and the same memo block. All 5 plan steps are covered.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] agent-chat-rendering: removing the duplicate assistant turn may hide message_user text if the frontend only renders assistant-role turns as chat bubbles. (flagged 1 times across 1 plans)
[DEBT] agent-chat-undo-integration: agent chat edits arrive via query invalidation/realtime polling and will bypass the undo stack because those paths are marked skiphistory. (flagged 1 times across 1 plans)
[DEBT] agent-tool-utils: agent-tool-utils: step 6 moves isrecord out of llm/messages.ts without preserving that module's current export surface for index.ts, db.ts, tool-calls.ts, and selectedclips.ts, so the refactor plan can break four existing imports unless it adds a re-export or rewires those callers. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the actual export surface in supabase/functions/ai-timeline-agent/llm/messages.ts and its consumers. step 6 says to 'remove local isrecord' from messages.ts and import it from utils.ts, but without also preserving messages.ts as an exporter or rewiring index.ts, db.ts, tool-calls.ts, and selectedclips.ts, that change would break the module graph immediately. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the render-gating cleanup plan against remotion's runtime exports in node_modules/remotion/dist/cjs/cancel-render.js:46-70. cancelrender() stores an error and throws to abort the render; it is not a benign cleanup for an abandoned delayrender handle, so step 2's instruction to call cancelrender(handle) on unmount is technically wrong and would abort preview or export with an error. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked how remotion itself acquires delay handles in node_modules/remotion/dist/cjs/iframe.js:8-18. remotion's own components create the handle synchronously with usestate(() => delayrender(...)); the plan says 'calls delayrender() on mount', which reads like an effect-time action and leaves the initial-frame blocking behavior underspecified compared with the actual library pattern. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the new useaudioparam() sketch against src/tools/video-editor/effects/compileeffect.tsx:1-2. the plan defines it in terms of interpolate(audio[binding.source], ...) but does not explicitly import interpolate into the new hook file or simplify it to straight arithmetic, so the helper's implementation contract is still looser than it needs to be. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked revised step 2.4 against src/tools/video-editor/hooks/useclipresize.ts:76-100. the plan still says to clamp audio by writing back to action.end, but the current hook treats the callback action as input data and then creates fresh row actions from it. mutating that caller-owned object is unnecessary and risks coupling the resize hook to outside references instead of using a local clampedend variable. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the no-duration-fetch decision against src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37, src/tools/video-editor/lib/config-utils.ts:17-35, and src/tools/video-editor/compositions/visualclip.tsx:114-123. the repository still derives clip length from to - from, and the final-video query still provides no duration metadata, so the revised plan still cannot prove that to: endtime - starttime is safe for shorter source media; a short final video can still be asked to play longer than its actual content. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the hand-built replacement clip against the existing insert path in src/tools/video-editor/hooks/useassetmanagement.ts:201-252,262-271 and serialization in src/tools/video-editor/hooks/usetimelinecommit.ts:210-216. the revised timelineeditor sketch still bypasses current insertion invariants such as manual-track geometry defaults and explicit cliporder updates, so replacement clips on manual visual tracks will not be initialized the same way as other inserted video clips and may serialize in a different per-track order. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the two user-visible must goals for the selection ring and locked-pane chat. they describe the right product outcomes, but they are mostly manual ui behaviors rather than code-review-verifiable gates, so they are not fully testable from the listed automated checks alone. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the revised must criterion about eliminating duplicated server-side helpers. as written, the plan could satisfy 'all import from utils.ts' for generation.ts, create-task.ts, and messages.ts and still break four existing messages.ts consumers, so the criterion is incomplete unless it also requires preserving or updating the messages.ts export surface. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the must criterion 'edge function tests (ai-generate-effect/index.test.ts) pass with updated templates' against the actual test file. since supabase/functions/ai-generate-effect/index.test.ts mocks buildgenerateeffectmessages(), this criterion can pass without validating the template edits themselves, so it is still a weak must gate as written. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the remaining must criteria against the revised verification plan. criteria like 'existing timelinecanvas.test.tsx tests pass' and 'rowstoconfig serialization ... verified by read-only inspection' are reviewable, but they are still proxy gates rather than direct evidence that resize speed math and live audio clamping behave correctly, so the criteria are improved but not fully outcome-oriented yet. (flagged 1 times across 1 plans)
[DEBT] audio-clamp-math: audio clamp math: revised step 4.2 still gives conflicting formulas for left-edge minstart, and one of them depends on clipmeta.to, so the live audio clamp is not fully specified. (flagged 1 times across 1 plans)
[DEBT] bulk-panel-tabs: text clip multi-selections would miss the position tab under the plan's stated rule. (flagged 1 times across 1 plans)
[DEBT] bulk-properties-panel: bulkclippanel still imports customeffecteditor; removing it without updating bulk mode would break the build. (flagged 1 times across 1 plans)
[DEBT] clip-drag-scroll-sync: the plan's step 3 ontick callback only shows coordinator.update() but the full clip-drag state path (snap, lateststart, ghost positions) also needs re-running during stationary-pointer scroll. (flagged 1 times across 1 plans)
[DEBT] clip-param-schema-evolution: clips with stale or partial params from a previous schema version will not be automatically normalized/backfilled when the effect schema changes. (flagged 1 times across 1 plans)
[DEBT] clip-resize-math: clip resize math: revised step 1 still leaves the source of origin.to under-specified, so the speed formula can be implemented against the wrong to value unless the plan explicitly says to use committed clip state or recompute it with getsourcetime(...). (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: silently reloading agent-originated timeline updates would discard dirty local edits. (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: if all 3 conflict retries fail, the fallback path risks discarding dirty local edits unless the executor wires it into the existing conflict dialog. (flagged 1 times across 1 plans)
[DEBT] context-menu-scope: multi-clip copy is not included despite being mentioned in the original idea. (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?: checked the revised step 6 against supabase/functions/ai-timeline-agent/llm/messages.ts:12, supabase/functions/ai-timeline-agent/index.ts:6, supabase/functions/ai-timeline-agent/db.ts:2, supabase/functions/ai-timeline-agent/tool-calls.ts:1-4, and supabase/functions/ai-timeline-agent/selectedclips.ts:1. the plan still does not account for isrecord being part of messages.ts's exported api today, so the utility extraction is incomplete unless it either re-exports isrecord from messages.ts or updates all four downstream imports. (flagged 2 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?: checked the revised audio-binding ui step against the research note and src/shared/components/ui/slider.tsx:5-17,31-52. the plan still says 'a dual-value slider or two number inputs' instead of committing to the supported path, even though the shared slider wrapper is scalar-only, so that important review note is only partially addressed. (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?: checked src/tools/video-editor/hooks/useclipresize.ts:54-73 against revised step 1. the plan now says to cache to in resizestartref, but it still never states whether that value must come from committed clip state or from a fresh getsourcetime(...) calculation. because the current resize handler computes a transient wrong to during left-edge trims before commit-time rematerialization repairs it, leaving origin.to implicit is still a correctness-sensitive ambiguity. (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?: checked revised step 4.2 against src/tools/video-editor/components/timelineeditor/timelinecanvas.tsx:483-490 and src/tools/video-editor/hooks/useclipresize.ts:56-60. the plan still gives two different formulas for audio minstart, and one of them depends on clipmeta.to, so the left-edge live-clamp requirement is not fully settled yet. (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?: checked src/tools/video-editor/hooks/usestalevariants.ts against the proposed usefinalvideoavailable state model: stale reminders are dismissed per assetkey and can clear when the asset changes, but the plan dismisses by shotid, which would hide any newer final video for the same shot for the rest of the session even though useshotfinalvideos() exposes a changing final-video id. (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?: checked the revised dismissal model against src/tools/video-editor/hooks/usestalevariants.ts:160-166 and src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:39-60. the plan still dismisses by shotid, not by final-video generation id, so if a shot gets a newer final output later in the same session the badge would remain suppressed even though useshotfinalvideos() would surface a different id; that earlier concern is still open. (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?: searched all isrecord imports from ./llm/messages.ts under supabase/functions/ai-timeline-agent/ and found four dependent files: index.ts, db.ts, tool-calls.ts, and selectedclips.ts. step 6 still lists only generation.ts, create-task.ts, and messages.ts as update targets, so it does not currently touch all locations that depend on the symbol being moved. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked supabase/functions/ai-timeline-agent/selectedclips.test.ts:1 through supabase/functions/ai-timeline-agent/selectedclips.ts:1. the supporting test infrastructure exists and would catch one of these export-chain breaks, but only after later refactors because the plan schedules the edge vitest run in step 9 rather than immediately after the step 6 export move. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked the supporting ui infrastructure for audio-binding controls. because src/shared/components/ui/slider.tsx:5-17,31-52 only supports one thumb and src/shared/components/ui/number-input.tsx:6-33 already exists as the established numeric input control, the plan should call out either numberinput usage or a new range-slider component explicitly; right now the supporting ui work is still incomplete in the plan. (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?: checked the planned test location for prompt-template changes against supabase/functions/ai-generate-effect/index.test.ts. since that suite mocks buildgenerateeffectmessages(), touching only index.test.ts still misses the supporting test infrastructure needed to validate templates.ts itself. (flagged 1 times across 1 plans)
[DEBT] drop-indicator-plumbing: dropindicator reads position.trackid without it being declared on the dropindicatorposition interface or forwarded by toindicatorposition(). (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: legacy persisted 'enhance' values might exist in storage (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no-migration assumption for enhance→upscale is under-supported (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: enhance/upscale only partially resolved — persisted values not validated (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no read-side normalization test for legacy 'enhance' values (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation grep for 'enhance' will false-fail due to video code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: grep scope too broad — hits video submode code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation scope reaches unrelated video code (flagged 1 times across 1 plans)
[DEBT] effect-layer-overlap-enforcement: the plan relies on same-track overlap being forbidden but does not explicitly specify the enforcement call (resolveoverlaps or range rejection) in the drop/create path. (flagged 1 times across 1 plans)
[DEBT] final-video-badge-suppression: final-video badge suppression: step 3's proposed timelinegenerationids scan over data.registry.assets would treat any previously registered final-video asset as 'already on the timeline', even if no current clip is using it. (flagged 1 times across 1 plans)
[DEBT] final-video-duration-handling: final-video duration handling: useshotfinalvideos() does not provide duration and the timeline uses clip.to - clip.from as truth, so the proposed in-place trim can overrun shorter source media. (flagged 1 times across 1 plans)
[DEBT] final-video-reminder-state: final-video reminder state: dismissing by shotid instead of final-video id still suppresses later final outputs for the same shot during the same session. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: checked the current callers of isrecord from llm/messages.ts. index.ts uses it to validate rawsession, db.ts uses it on db rows, tool-calls.ts uses it on parsed tool-call payloads and nested function objects, and selectedclips.ts uses it while normalizing attachments, so preserving that import contract matters to four different call paths. (flagged 2 times across 1 plans)
[DEBT] immediate-task-feedback: immediate task feedback: the plan does not cover the repo's existing optimistic-pending pattern, so it does not reliably meet the stated 'appear immediately when a task is created' behavior. with only realtime plus 5s polling, spinner appearance still depends on network/realtime latency. (flagged 1 times across 1 plans)
[DEBT] issue-detection: mid-sentence-cut detection is not implementable without transcript/profile data that the current provider doesn't expose. (flagged 1 times across 1 plans)
[DEBT] legacy-effect-lifecycle: removing customeffecteditor makes effects-table entries read-only — users can no longer edit legacy custom effects. (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: duplicate of correctness-2 — multi-drag meta patch accumulation not spelled out (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: same merge strategy concern as correctness-2/5 from the caller perspective (flagged 1 times across 1 plans)
[DEBT] optimistic-locking: plan only specifies version checking at the db write layer; the ui load/state/save path doesn't carry config_version yet. (flagged 1 times across 1 plans)
[DEBT] properties-panel-scope: crop and transition controls are not included in the bulk panel, narrowing the original idea's scope. (flagged 1 times across 1 plans)
[DEBT] realtime-subscriptions: the shared realtime system doesn't know about timeline_agent_sessions; step 7 hooks need their own channel subscription. (flagged 1 times across 1 plans)
[DEBT] registry-patch-testing: patchregistry() lacks automated regression tests — the duplicate-id bug's most likely reproduction path is covered only by pure-function tests on the assembler it delegates to, plus manual smoke testing. (flagged 1 times across 1 plans)
[DEBT] resize-hook-mutation: resize hook mutation: revised step 2.4 clamps audio by mutating action.end, even though the current resize hook builds new row objects immutably from the callback input. (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: resolve-overlaps.ts entirely lacks tests; plan only adds resolvegroupoverlaps tests (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: phase 4 blast radius covers both resolveoverlaps and resolvegroupoverlaps return shapes (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the affected edge-agent surface around llm/messages.ts. the isrecord extraction is broader than the three files listed in step 6 because messages.ts is a shared utility module for index.ts, db.ts, tool-calls.ts, and selectedclips.ts; the plan still scopes the edit as if only the local definition sites matter. (flagged 2 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the verification scope around the edge function. supabase/functions/ai-generate-effect/index.test.ts:35-46 mocks buildgenerateeffectmessages(), so adding only more index.test.ts cases still will not exercise the real templates.ts prompt content; the revised plan improves scope on the implementation side, but its test scope is still narrower than the actual risk surface. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked src/tools/video-editor/lib/resolve-overlaps.ts:139-195 at the useclipresize call site. this api only produces metapatches[clipid] for the moved clip, so revised step 3's generic 'for each clip id in overlappatches' loop is broader than the actual resize surface and adds complexity the fix does not currently need. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the existing video-drop paths in src/tools/video-editor/lib/external-drop-utils.ts:46-55,386-412 and src/tools/video-editor/hooks/useassetmanagement.ts:198-252. the broader repository pattern for video assets is not just “register then insert”; multi-generation video drops also patch registry.duration using getdroppedgenerationduration(), while useshotfinalvideos() in src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37 currently fetches no duration metadata. that means final-video replacement is broader than badge wiring alone if the new clip is expected to behave like other video assets in timing ui and resize logic. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked related asset-insertion code in src/tools/video-editor/hooks/useassetmanagement.ts:150-271 and src/tools/video-editor/lib/coordinate-utils.ts:24-33. the broader repository pattern for adding timeline media is centralized there, including track compatibility, manual-track defaults, selection updates, and cliporder maintenance, so the revised plan is still broader than a pure menu/ui change and needs either shared helper extraction or a more explicit statement that those invariants are being replicated on purpose. (flagged 1 times across 1 plans)
[DEBT] selection-save-bridge: the plan specifies passing pruneselection into usetimelinesave but doesn't detail the hook-layer bridge needed because usetimelinesave is instantiated inside usetimelinedata before usetimelinestate runs. (flagged 1 times across 1 plans)
[DEBT] shot-group-badge-scope: shot-group badge scope: step 3 suppresses the reminder at shot level, but this repo can render multiple shot groups for the same shot, so switching one group to the final video would hide the badge on other groups of that shot too. (flagged 1 times across 1 plans)
[DEBT] task-deduplication: server-generated idempotency keys would break retry deduplication because retried requests get fresh keys. (flagged 1 times across 1 plans)
[DEBT] task-reference-matching: task reference matching: reusing taskreferencesgeneration as the only matcher will miss active video-generation tasks for source clips. the helper does not inspect input_image_generation_ids, start_image_generation_id, or end_image_generation_id, even though this repo stores and later reads those fields to identify which timeline generations a travel task is using. that means spinners would fail to appear for at least some travel/video tasks. (flagged 1 times across 1 plans)
[DEBT] task-system-integration: create_generation_task is underspecified against the actual task family system. (flagged 1 times across 1 plans)
[DEBT] timeline-media-duration: timeline media duration: the revised plan still sizes the final-video clip to the shot-group span without any duration source, so shorter final videos can still overrun their real media length. (flagged 1 times across 1 plans)
[DEBT] tool-error-propagation: a blanket catch in executetool would silently downgrade db/persistence failures into ordinary tool results, changing the session error/http 500 behavior. (flagged 1 times across 1 plans)
[DEBT] track-reorder-accessibility: replacing arrow buttons with drag-only handle removes keyboard-accessible reorder; plan only specifies pointersensor. (flagged 1 times across 1 plans)
[DEBT] track-reorder-testing: no automated tests specified for same-kind boundary rules or save/load persistence of reordered tracks. (flagged 1 times across 1 plans)
[DEBT] usederivedtimeline: duplicate of correctness-1 — usememo dep array lint violation in sample code (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: preview fps source not exposed via existing context (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: same fps gap as flag-004 (flagged 3 times across 1 plans)
[DEBT] video-editor-effect-registry: replaceeffectregistry() in render mutates module state during react render (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same render-purity concern as correctness-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: o(n) re-renders during effect initialization (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same batching gap as performance-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: success criterion hardcodes render-time assignment as implementation detail (flagged 1 times across 1 plans)
[DEBT] video-editor-lightbox-tests: video editor lightbox tests: moving usequery into videoeditorprovider will break the existing provider unit test unless the plan also updates the test harness to supply react query context. (flagged 1 times across 1 plans)
[DEBT] video-editor-parameter-controls: video-editor-parameter-controls: the revised plan still suggests a dual-value slider for audio-binding min/max even though the shared slider wrapper is scalar-only; it should commit to two numberinput controls or a new range-slider implementation. (flagged 1 times across 1 plans)
[DEBT] video-editor-render-pipeline: video-editor-render-pipeline: recurring debt: the revised render-gating plan still uses cancelrender() as unmount cleanup and leaves delayrender() acquisition described as a mount-time action, which can abort renders or miss initial-frame blocking. (flagged 1 times across 1 plans)
[DEBT] video-editor-shell: video-editor shell: the plan’s width/aspect-based condensed threshold ignores the existing standard-layout maximize-timeline path, which already fixes the preview row at 180px. in this repo that means portrait timelines could be forced into condensed mode on normal desktop heights, effectively taking away the non-condensed maximize-timeline workflow unless the plan explicitly scopes the new threshold around istimelinemaximized or otherwise accepts that behavior change. (flagged 1 times across 1 plans)
[DEBT] vlm-cold-gpu-diagnostics: the cold-gpu vlm import crash investigation is deferred — the plan ships the zombie fix without root-causing the specific import failure. (flagged 1 times across 1 plans)
[DEBT] workspace-git-hygiene: step 2 discards unstaged edits in 6 files via git checkout head without first confirming the revert was unintentional. (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, T2]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC1, SC2]
- 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/reigh-app/.megaplan/plans/clean-up-the-final-video-20260406-0959/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. T1 now invalidates active shot queries after shot creation, and T2 now persists final-video dismissals across remounts while suppressing the badge when the final video is already on the timeline. Relevant Vitest modules passed, and the batch checkpoint was written to .megaplan/plans/clean-up-the-final-video-20260406-0959/execution_batch_1.json.","files_changed":["src/shared/hooks/shotCreation/shotCreationPaths.ts","src/shared/hooks/shotCreation/shotCreationPaths.test.ts","src/tools/video-editor/hooks/useFinalVideoAvailable.ts","src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts",".megaplan/plans/clean-up-the-final-video-20260406-0959/execution_batch_1.json"],"commands_run":["sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts","sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts","sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts","sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts","sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts","sed -n '1,140p' src/shared/contexts/ShotsContext.tsx","sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts","rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!/.megaplan/'","npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.test.ts"],"deviations":[],"task_updates":[{"task_id":"T1","status":"done","executor_notes":"Removed the inactive-only invalidation filter from both shot creation paths. Verified the active ShotsContext query uses the same ['shots', projectId, maxImagesPerShot] prefix that invalidateShotsQueries targets, so invalidateQueries now refetches the mounted list query as intended.","files_changed":["src/shared/hooks/shotCreation/shotCreationPaths.ts","src/shared/hooks/shotCreation/shotCreationPaths.test.ts"],"commands_run":["sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts","sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts","sed -n '1,140p' src/shared/contexts/ShotsContext.tsx","sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts","npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts"]},{"task_id":"T2","status":"done","executor_notes":"Moved final-video dismissal state to a module-level Set keyed by finalVideo.id and rewired TimelineEditor to suppress badges when a current row clip already references that final video generation. Verified the switch chain remains consistent: useSwitchToFinalVideo registers generationId=finalVideo.id, stores the asset on the inserted clip meta, and the new rows->meta->registry scan detects it.","files_changed":["src/tools/video-editor/hooks/useFinalVideoAvailable.ts","src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"],"commands_run":["sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts","sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts","sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts","rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!/.megaplan/'","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.test.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC1","executor_note":"Confirmed by inspection: ShotsContext mounts useListShots with queryKey ['shots', projectId, maxImagesPerShot], and invalidateShotsQueries invalidates ['shots', projectId] without a refetchType override. TanStack Query will therefore mark the active shots list stale and refetch it."},{"sense_check_id":"SC2","executor_note":"Confirmed by tracing the code path: useSwitchToFinalVideo creates the replacement asset with generationId: finalVideo.id, stores that asset key on the new clip's meta entry, and resolveFinalVideoShotIds now scans rows -> meta[action.id].asset -> registry.assets[assetKey].generationId, so a placed final video is detected from actual timeline clips."}]}
Clean up the final video badge and shot creation flow in the video editor timeline. Three issues to fix:
SHOT GROUP NOT APPEARING AFTER CREATE: createShotWithGenerationsPath in src/shared/hooks/shotCreation/shotCreationPaths.ts line 264 calls invalidateShotsQueries with refetchType:'inactive' which skips the active ShotsContext query. Same issue on line 204 for createShotWithFilesPath. Fix: remove refetchType:'inactive' so active queries refetch too.
FINAL VIDEO BADGE KEEPS REAPPEARING: dismissedShotIds in useFinalVideoAvailable.ts uses useState which resets on component remount. Move to a module-level Set (like useStaleVariants uses for dismissedAssetKeys at line 30) so it survives remounts. Also need to dismiss based on finalVideo.id (not shotId) so newer final videos for the same shot still show the badge.
BADGE SHOWS AFTER SWITCHING TO FINAL VIDEO: After applyEdit fires, the shot group recalculates. If the replaced video clip's generationId happens to match a shot image, the group re-forms and hasFinalVideo is still true (because finalVideoShotIds still includes it during the render before dismiss takes effect). The dismiss-before-switch approach was attempted but timing issues remain. Need a more robust solution - possibly check if any clip in the group is already using the final video asset, and suppress the badge in that case.
Batch framing:
- Execute batch 2 of 3.
- Actionable task IDs for this batch: ['T3']
- Already completed task IDs available as dependency context: ['T1', 'T2']
Actionable tasks for this batch:
[
{
"id": "T3",
"description": "Verify no other consumers of old API: Grep for dismissShot, dismissedShotIds, and useFinalVideoAvailable across the codebase (excluding .megaplan/). Confirm only TimelineEditor.tsx and useFinalVideoAvailable.ts reference these. Check that TimelineCanvas.tsx and any context menu components receive callbacks (not the hook directly) so their prop signatures still match. If any other file imports the old names, update them.",
"depends_on": [
"T2"
],
"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": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in src/shared/hooks/shotCreation/shotCreationPaths.ts (lines 204 and 264). Change each call to just invalidateShotsQueries(queryClient, selectedProjectId) with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "done",
"executor_notes": "Removed the inactive-only invalidation filter from both shot creation paths. Verified the active ShotsContext query uses the same ['shots', projectId, maxImagesPerShot] prefix that invalidateShotsQueries targets, so invalidateQueries now refetches the mounted list query as intended.",
"files_changed": [
"src/shared/hooks/shotCreation/shotCreationPaths.ts",
"src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"commands_run": [
"sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts",
"sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts",
"sed -n '1,140p' src/shared/contexts/ShotsContext.tsx",
"sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In src/tools/video-editor/hooks/useFinalVideoAvailable.ts:\n - Replace useState<Set<string>> with a module-level const dismissedFinalVideoIds = new Set<string>() outside the hook.\n - Add a const [, forceRender] = useState(0) inside the hook for re-render triggering.\n - Rename dismissShot to dismissFinalVideo \u2014 it now takes a finalVideoId: string and does dismissedFinalVideoIds.add(finalVideoId); forceRender(n => n + 1).\n - Export dismissedFinalVideoIds (the Set) and dismissFinalVideo (the callback) instead of the old dismissedShotIds/dismissShot.\n\n2. In src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx:\n - Update the destructured import: const { finalVideoMap, dismissedFinalVideoIds, dismissFinalVideo } = useFinalVideoAvailable();\n - Update the finalVideoShotIds memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId. Store in a timelineClipGenerationIds: Set<string>. IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each in : skip if , skip if (final video already on timeline), otherwise add .\n c. Add , , to the memo deps.\n - Update line 548 callback: \n - Update line 549 callback: ",
"depends_on": [],
"status": "done",
"executor_notes": "Moved final-video dismissal state to a module-level Set keyed by finalVideo.id and rewired TimelineEditor to suppress badges when a current row clip already references that final video generation. Verified the switch chain remains consistent: useSwitchToFinalVideo registers generationId=finalVideo.id, stores the asset on the inserted clip meta, and the new rows->meta->registry scan detects it.",
"files_changed": [
"src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"
],
"commands_run": [
"sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts",
"sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts",
"rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!'",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.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/clean-up-the-final-video-20260406-0959/execution_batch_1.json",
"Advisory audit finding: Git status shows changed files not claimed by any task: .megaplan/debt.json, .megaplan/plans/clean-up-the-final-video-20260406-0959",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC3",
"task_id": "T3",
"question": "Are there any other files besides TimelineEditor.tsx that import from useFinalVideoAvailable or reference dismissShot/dismissedShotIds? If TimelineCanvas or ShotGroupContextMenu receive these as props, do the prop types still match after the rename?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in src/shared/hooks/shotCreation/shotCreationPaths.ts (lines 204 and 264). Change each call to just invalidateShotsQueries(queryClient, selectedProjectId) with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "done",
"executor_notes": "Removed the inactive-only invalidation filter from both shot creation paths. Verified the active ShotsContext query uses the same ['shots', projectId, maxImagesPerShot] prefix that invalidateShotsQueries targets, so invalidateQueries now refetches the mounted list query as intended.",
"files_changed": [
"src/shared/hooks/shotCreation/shotCreationPaths.ts",
"src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"commands_run": [
"sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts",
"sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts",
"sed -n '1,140p' src/shared/contexts/ShotsContext.tsx",
"sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In src/tools/video-editor/hooks/useFinalVideoAvailable.ts:\n - Replace useState<Set<string>> with a module-level const dismissedFinalVideoIds = new Set<string>() outside the hook.\n - Add a const [, forceRender] = useState(0) inside the hook for re-render triggering.\n - Rename dismissShot to dismissFinalVideo \u2014 it now takes a finalVideoId: string and does dismissedFinalVideoIds.add(finalVideoId); forceRender(n => n + 1).\n - Export dismissedFinalVideoIds (the Set) and dismissFinalVideo (the callback) instead of the old dismissedShotIds/dismissShot.\n\n2. In src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx:\n - Update the destructured import: const { finalVideoMap, dismissedFinalVideoIds, dismissFinalVideo } = useFinalVideoAvailable();\n - Update the finalVideoShotIds memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId. Store in a timelineClipGenerationIds: Set<string>. IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each in : skip if , skip if (final video already on timeline), otherwise add .\n c. Add , , to the memo deps.\n - Update line 548 callback: \n - Update line 549 callback: ",
"depends_on": [],
"status": "done",
"executor_notes": "Moved final-video dismissal state to a module-level Set keyed by finalVideo.id and rewired TimelineEditor to suppress badges when a current row clip already references that final video generation. Verified the switch chain remains consistent: useSwitchToFinalVideo registers generationId=finalVideo.id, stores the asset on the inserted clip meta, and the new rows->meta->registry scan detects it.",
"files_changed": [
"src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"
],
"commands_run": [
"sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts",
"sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts",
"rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!'",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Verify no other consumers of old API: Grep for , , and across the codebase (excluding .megaplan/). Confirm only and reference these. Check that and any context menu components receive callbacks (not the hook directly) so their prop signatures still match. If any other file imports the old names, update them.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Run to verify no type errors. If any failures, fix them. Then do a final review: read the changed files, confirm no out-of-scope edits, confirm the three bugs are addressed (shot invalidation, dismiss persistence, badge suppression when final video is on timeline).",
"depends_on": [
"T1",
"T2",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: When checking if final video is already on timeline, scan ACTUAL clip assets from rows+meta+registry (not just registry entries). Registry retains entries after clip removal, so scanning all registry assets would incorrectly suppress the badge after a final video clip is deleted. The correct approach: iterate data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId.",
"FLAG-002: Suppressing per-shot (not per-group) is acceptable \u2014 if the final video is on ANY group for a shot, hiding the badge on other groups of that shot is correct. The gate rationale confirms this. No action needed.",
"DEBT: final-video-badge-suppression, final-video-reminder-state, shot-group-badge-scope \u2014 all three are directly addressed by this plan's changes. Ensure the fix resolves them, not worsens them.",
"The module-level Set survives component remounts but resets on full page reload. It does NOT reset on project switch \u2014 if the user switches projects and back, old dismissals persist. This is acceptable per gate guidance but worth noting.",
"useSwitchToFinalVideo registers the asset with (line 55). This is the same ID used for dismiss and timeline-presence checks. Ensure consistency \u2014 the finalVideo.id from useShotFinalVideos must match.",
"The forceRender pattern (useState counter + module Set) is simple but means only the component calling dismissFinalVideo re-renders. Since useFinalVideoAvailable is only called in TimelineEditor.tsx, this is fine."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "After removing refetchType:'inactive', does the ShotsContext active query actually refetch? Confirm that invalidateShotsQueries without the filter triggers a refetch of queries with the 'shots' query key that ShotsContext uses.",
"executor_note": "Confirmed by inspection: ShotsContext mounts useListShots with queryKey ['shots', projectId, maxImagesPerShot], and invalidateShotsQueries invalidates ['shots', projectId] without a refetchType override. TanStack Query will therefore mark the active shots list stale and refetch it.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does the timeline-clip-based generationId scan correctly identify when a final video is already placed on the timeline? Verify by tracing: useSwitchToFinalVideo sets generationId=finalVideo.id on the asset \u2192 the asset is assigned to a clip via meta[clipId].asset \u2192 the scan picks it up. Confirm the chain is unbroken.",
"executor_note": "Confirmed by tracing the code path: useSwitchToFinalVideo creates the replacement asset with generationId: finalVideo.id, stores that asset key on the new clip's meta entry, and resolveFinalVideoShotIds now scans rows -> meta[action.id].asset -> registry.assets[assetKey].generationId, so a placed final video is detected from actual timeline clips.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are there any other files besides TimelineEditor.tsx that import from useFinalVideoAvailable or reference dismissShot/dismissedShotIds? If TimelineCanvas or ShotGroupContextMenu receive these as props, do the prop types still match after the rename?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does pass cleanly? Are all three bugs addressed: (1) shot appears after creation, (2) dismiss survives remount, (3) badge hidden when final video is on timeline?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a focused 2-file fix (shotCreationPaths.ts + useFinalVideoAvailable.ts) plus a memo update in TimelineEditor.tsx. The trickiest part is T2's timeline-clip scan for FLAG-001: you MUST iterate rows\u2192meta\u2192registry to get generationIds of clips actually on the timeline, NOT scan all registry.assets entries (registry retains stale entries after clip deletion). The pattern for this scan already exists in useShotGroups.ts lines 51-58 \u2014 reuse that exact approach. The dismissFinalVideo rename is a breaking API change but only consumed in TimelineEditor.tsx (line 219, 548, 549), so the blast radius is small. T1 is fully independent and trivial \u2014 do it first for a quick win.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Remove refetchType:'inactive' from invalidateShotsQueries calls",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Move dismissed state to module-level Set keyed by finalVideo.id",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Suppress badge when final video is already on timeline",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Verify no other consumers of old API",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Run tsc --noEmit and validate",
"finalize_task_ids": [
"T4"
]
}
],
"orphan_tasks": [],
"completeness_notes": "Steps 2 and 3 are combined into T2 since they modify the same files and the same memo block. All 5 plan steps are covered.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] agent-chat-rendering: removing the duplicate assistant turn may hide message_user text if the frontend only renders assistant-role turns as chat bubbles. (flagged 1 times across 1 plans)
[DEBT] agent-chat-undo-integration: agent chat edits arrive via query invalidation/realtime polling and will bypass the undo stack because those paths are marked skiphistory. (flagged 1 times across 1 plans)
[DEBT] agent-tool-utils: agent-tool-utils: step 6 moves isrecord out of llm/messages.ts without preserving that module's current export surface for index.ts, db.ts, tool-calls.ts, and selectedclips.ts, so the refactor plan can break four existing imports unless it adds a re-export or rewires those callers. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the actual export surface in supabase/functions/ai-timeline-agent/llm/messages.ts and its consumers. step 6 says to 'remove local isrecord' from messages.ts and import it from utils.ts, but without also preserving messages.ts as an exporter or rewiring index.ts, db.ts, tool-calls.ts, and selectedclips.ts, that change would break the module graph immediately. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the render-gating cleanup plan against remotion's runtime exports in node_modules/remotion/dist/cjs/cancel-render.js:46-70. cancelrender() stores an error and throws to abort the render; it is not a benign cleanup for an abandoned delayrender handle, so step 2's instruction to call cancelrender(handle) on unmount is technically wrong and would abort preview or export with an error. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked how remotion itself acquires delay handles in node_modules/remotion/dist/cjs/iframe.js:8-18. remotion's own components create the handle synchronously with usestate(() => delayrender(...)); the plan says 'calls delayrender() on mount', which reads like an effect-time action and leaves the initial-frame blocking behavior underspecified compared with the actual library pattern. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the new useaudioparam() sketch against src/tools/video-editor/effects/compileeffect.tsx:1-2. the plan defines it in terms of interpolate(audio[binding.source], ...) but does not explicitly import interpolate into the new hook file or simplify it to straight arithmetic, so the helper's implementation contract is still looser than it needs to be. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked revised step 2.4 against src/tools/video-editor/hooks/useclipresize.ts:76-100. the plan still says to clamp audio by writing back to action.end, but the current hook treats the callback action as input data and then creates fresh row actions from it. mutating that caller-owned object is unnecessary and risks coupling the resize hook to outside references instead of using a local clampedend variable. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the no-duration-fetch decision against src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37, src/tools/video-editor/lib/config-utils.ts:17-35, and src/tools/video-editor/compositions/visualclip.tsx:114-123. the repository still derives clip length from to - from, and the final-video query still provides no duration metadata, so the revised plan still cannot prove that to: endtime - starttime is safe for shorter source media; a short final video can still be asked to play longer than its actual content. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the hand-built replacement clip against the existing insert path in src/tools/video-editor/hooks/useassetmanagement.ts:201-252,262-271 and serialization in src/tools/video-editor/hooks/usetimelinecommit.ts:210-216. the revised timelineeditor sketch still bypasses current insertion invariants such as manual-track geometry defaults and explicit cliporder updates, so replacement clips on manual visual tracks will not be initialized the same way as other inserted video clips and may serialize in a different per-track order. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the two user-visible must goals for the selection ring and locked-pane chat. they describe the right product outcomes, but they are mostly manual ui behaviors rather than code-review-verifiable gates, so they are not fully testable from the listed automated checks alone. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the revised must criterion about eliminating duplicated server-side helpers. as written, the plan could satisfy 'all import from utils.ts' for generation.ts, create-task.ts, and messages.ts and still break four existing messages.ts consumers, so the criterion is incomplete unless it also requires preserving or updating the messages.ts export surface. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the must criterion 'edge function tests (ai-generate-effect/index.test.ts) pass with updated templates' against the actual test file. since supabase/functions/ai-generate-effect/index.test.ts mocks buildgenerateeffectmessages(), this criterion can pass without validating the template edits themselves, so it is still a weak must gate as written. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the remaining must criteria against the revised verification plan. criteria like 'existing timelinecanvas.test.tsx tests pass' and 'rowstoconfig serialization ... verified by read-only inspection' are reviewable, but they are still proxy gates rather than direct evidence that resize speed math and live audio clamping behave correctly, so the criteria are improved but not fully outcome-oriented yet. (flagged 1 times across 1 plans)
[DEBT] audio-clamp-math: audio clamp math: revised step 4.2 still gives conflicting formulas for left-edge minstart, and one of them depends on clipmeta.to, so the live audio clamp is not fully specified. (flagged 1 times across 1 plans)
[DEBT] bulk-panel-tabs: text clip multi-selections would miss the position tab under the plan's stated rule. (flagged 1 times across 1 plans)
[DEBT] bulk-properties-panel: bulkclippanel still imports customeffecteditor; removing it without updating bulk mode would break the build. (flagged 1 times across 1 plans)
[DEBT] clip-drag-scroll-sync: the plan's step 3 ontick callback only shows coordinator.update() but the full clip-drag state path (snap, lateststart, ghost positions) also needs re-running during stationary-pointer scroll. (flagged 1 times across 1 plans)
[DEBT] clip-param-schema-evolution: clips with stale or partial params from a previous schema version will not be automatically normalized/backfilled when the effect schema changes. (flagged 1 times across 1 plans)
[DEBT] clip-resize-math: clip resize math: revised step 1 still leaves the source of origin.to under-specified, so the speed formula can be implemented against the wrong to value unless the plan explicitly says to use committed clip state or recompute it with getsourcetime(...). (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: silently reloading agent-originated timeline updates would discard dirty local edits. (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: if all 3 conflict retries fail, the fallback path risks discarding dirty local edits unless the executor wires it into the existing conflict dialog. (flagged 1 times across 1 plans)
[DEBT] context-menu-scope: multi-clip copy is not included despite being mentioned in the original idea. (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?: checked the revised step 6 against supabase/functions/ai-timeline-agent/llm/messages.ts:12, supabase/functions/ai-timeline-agent/index.ts:6, supabase/functions/ai-timeline-agent/db.ts:2, supabase/functions/ai-timeline-agent/tool-calls.ts:1-4, and supabase/functions/ai-timeline-agent/selectedclips.ts:1. the plan still does not account for isrecord being part of messages.ts's exported api today, so the utility extraction is incomplete unless it either re-exports isrecord from messages.ts or updates all four downstream imports. (flagged 2 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?: checked the revised audio-binding ui step against the research note and src/shared/components/ui/slider.tsx:5-17,31-52. the plan still says 'a dual-value slider or two number inputs' instead of committing to the supported path, even though the shared slider wrapper is scalar-only, so that important review note is only partially addressed. (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?: checked src/tools/video-editor/hooks/useclipresize.ts:54-73 against revised step 1. the plan now says to cache to in resizestartref, but it still never states whether that value must come from committed clip state or from a fresh getsourcetime(...) calculation. because the current resize handler computes a transient wrong to during left-edge trims before commit-time rematerialization repairs it, leaving origin.to implicit is still a correctness-sensitive ambiguity. (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?: checked revised step 4.2 against src/tools/video-editor/components/timelineeditor/timelinecanvas.tsx:483-490 and src/tools/video-editor/hooks/useclipresize.ts:56-60. the plan still gives two different formulas for audio minstart, and one of them depends on clipmeta.to, so the left-edge live-clamp requirement is not fully settled yet. (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?: checked src/tools/video-editor/hooks/usestalevariants.ts against the proposed usefinalvideoavailable state model: stale reminders are dismissed per assetkey and can clear when the asset changes, but the plan dismisses by shotid, which would hide any newer final video for the same shot for the rest of the session even though useshotfinalvideos() exposes a changing final-video id. (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?: checked the revised dismissal model against src/tools/video-editor/hooks/usestalevariants.ts:160-166 and src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:39-60. the plan still dismisses by shotid, not by final-video generation id, so if a shot gets a newer final output later in the same session the badge would remain suppressed even though useshotfinalvideos() would surface a different id; that earlier concern is still open. (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?: searched all isrecord imports from ./llm/messages.ts under supabase/functions/ai-timeline-agent/ and found four dependent files: index.ts, db.ts, tool-calls.ts, and selectedclips.ts. step 6 still lists only generation.ts, create-task.ts, and messages.ts as update targets, so it does not currently touch all locations that depend on the symbol being moved. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked supabase/functions/ai-timeline-agent/selectedclips.test.ts:1 through supabase/functions/ai-timeline-agent/selectedclips.ts:1. the supporting test infrastructure exists and would catch one of these export-chain breaks, but only after later refactors because the plan schedules the edge vitest run in step 9 rather than immediately after the step 6 export move. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked the supporting ui infrastructure for audio-binding controls. because src/shared/components/ui/slider.tsx:5-17,31-52 only supports one thumb and src/shared/components/ui/number-input.tsx:6-33 already exists as the established numeric input control, the plan should call out either numberinput usage or a new range-slider component explicitly; right now the supporting ui work is still incomplete in the plan. (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?: checked the planned test location for prompt-template changes against supabase/functions/ai-generate-effect/index.test.ts. since that suite mocks buildgenerateeffectmessages(), touching only index.test.ts still misses the supporting test infrastructure needed to validate templates.ts itself. (flagged 1 times across 1 plans)
[DEBT] drop-indicator-plumbing: dropindicator reads position.trackid without it being declared on the dropindicatorposition interface or forwarded by toindicatorposition(). (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: legacy persisted 'enhance' values might exist in storage (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no-migration assumption for enhance→upscale is under-supported (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: enhance/upscale only partially resolved — persisted values not validated (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no read-side normalization test for legacy 'enhance' values (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation grep for 'enhance' will false-fail due to video code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: grep scope too broad — hits video submode code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation scope reaches unrelated video code (flagged 1 times across 1 plans)
[DEBT] effect-layer-overlap-enforcement: the plan relies on same-track overlap being forbidden but does not explicitly specify the enforcement call (resolveoverlaps or range rejection) in the drop/create path. (flagged 1 times across 1 plans)
[DEBT] final-video-badge-suppression: final-video badge suppression: step 3's proposed timelinegenerationids scan over data.registry.assets would treat any previously registered final-video asset as 'already on the timeline', even if no current clip is using it. (flagged 1 times across 1 plans)
[DEBT] final-video-duration-handling: final-video duration handling: useshotfinalvideos() does not provide duration and the timeline uses clip.to - clip.from as truth, so the proposed in-place trim can overrun shorter source media. (flagged 1 times across 1 plans)
[DEBT] final-video-reminder-state: final-video reminder state: dismissing by shotid instead of final-video id still suppresses later final outputs for the same shot during the same session. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: checked the current callers of isrecord from llm/messages.ts. index.ts uses it to validate rawsession, db.ts uses it on db rows, tool-calls.ts uses it on parsed tool-call payloads and nested function objects, and selectedclips.ts uses it while normalizing attachments, so preserving that import contract matters to four different call paths. (flagged 2 times across 1 plans)
[DEBT] immediate-task-feedback: immediate task feedback: the plan does not cover the repo's existing optimistic-pending pattern, so it does not reliably meet the stated 'appear immediately when a task is created' behavior. with only realtime plus 5s polling, spinner appearance still depends on network/realtime latency. (flagged 1 times across 1 plans)
[DEBT] issue-detection: mid-sentence-cut detection is not implementable without transcript/profile data that the current provider doesn't expose. (flagged 1 times across 1 plans)
[DEBT] legacy-effect-lifecycle: removing customeffecteditor makes effects-table entries read-only — users can no longer edit legacy custom effects. (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: duplicate of correctness-2 — multi-drag meta patch accumulation not spelled out (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: same merge strategy concern as correctness-2/5 from the caller perspective (flagged 1 times across 1 plans)
[DEBT] optimistic-locking: plan only specifies version checking at the db write layer; the ui load/state/save path doesn't carry config_version yet. (flagged 1 times across 1 plans)
[DEBT] properties-panel-scope: crop and transition controls are not included in the bulk panel, narrowing the original idea's scope. (flagged 1 times across 1 plans)
[DEBT] realtime-subscriptions: the shared realtime system doesn't know about timeline_agent_sessions; step 7 hooks need their own channel subscription. (flagged 1 times across 1 plans)
[DEBT] registry-patch-testing: patchregistry() lacks automated regression tests — the duplicate-id bug's most likely reproduction path is covered only by pure-function tests on the assembler it delegates to, plus manual smoke testing. (flagged 1 times across 1 plans)
[DEBT] resize-hook-mutation: resize hook mutation: revised step 2.4 clamps audio by mutating action.end, even though the current resize hook builds new row objects immutably from the callback input. (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: resolve-overlaps.ts entirely lacks tests; plan only adds resolvegroupoverlaps tests (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: phase 4 blast radius covers both resolveoverlaps and resolvegroupoverlaps return shapes (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the affected edge-agent surface around llm/messages.ts. the isrecord extraction is broader than the three files listed in step 6 because messages.ts is a shared utility module for index.ts, db.ts, tool-calls.ts, and selectedclips.ts; the plan still scopes the edit as if only the local definition sites matter. (flagged 2 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the verification scope around the edge function. supabase/functions/ai-generate-effect/index.test.ts:35-46 mocks buildgenerateeffectmessages(), so adding only more index.test.ts cases still will not exercise the real templates.ts prompt content; the revised plan improves scope on the implementation side, but its test scope is still narrower than the actual risk surface. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked src/tools/video-editor/lib/resolve-overlaps.ts:139-195 at the useclipresize call site. this api only produces metapatches[clipid] for the moved clip, so revised step 3's generic 'for each clip id in overlappatches' loop is broader than the actual resize surface and adds complexity the fix does not currently need. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the existing video-drop paths in src/tools/video-editor/lib/external-drop-utils.ts:46-55,386-412 and src/tools/video-editor/hooks/useassetmanagement.ts:198-252. the broader repository pattern for video assets is not just “register then insert”; multi-generation video drops also patch registry.duration using getdroppedgenerationduration(), while useshotfinalvideos() in src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37 currently fetches no duration metadata. that means final-video replacement is broader than badge wiring alone if the new clip is expected to behave like other video assets in timing ui and resize logic. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked related asset-insertion code in src/tools/video-editor/hooks/useassetmanagement.ts:150-271 and src/tools/video-editor/lib/coordinate-utils.ts:24-33. the broader repository pattern for adding timeline media is centralized there, including track compatibility, manual-track defaults, selection updates, and cliporder maintenance, so the revised plan is still broader than a pure menu/ui change and needs either shared helper extraction or a more explicit statement that those invariants are being replicated on purpose. (flagged 1 times across 1 plans)
[DEBT] selection-save-bridge: the plan specifies passing pruneselection into usetimelinesave but doesn't detail the hook-layer bridge needed because usetimelinesave is instantiated inside usetimelinedata before usetimelinestate runs. (flagged 1 times across 1 plans)
[DEBT] shot-group-badge-scope: shot-group badge scope: step 3 suppresses the reminder at shot level, but this repo can render multiple shot groups for the same shot, so switching one group to the final video would hide the badge on other groups of that shot too. (flagged 1 times across 1 plans)
[DEBT] task-deduplication: server-generated idempotency keys would break retry deduplication because retried requests get fresh keys. (flagged 1 times across 1 plans)
[DEBT] task-reference-matching: task reference matching: reusing taskreferencesgeneration as the only matcher will miss active video-generation tasks for source clips. the helper does not inspect input_image_generation_ids, start_image_generation_id, or end_image_generation_id, even though this repo stores and later reads those fields to identify which timeline generations a travel task is using. that means spinners would fail to appear for at least some travel/video tasks. (flagged 1 times across 1 plans)
[DEBT] task-system-integration: create_generation_task is underspecified against the actual task family system. (flagged 1 times across 1 plans)
[DEBT] timeline-media-duration: timeline media duration: the revised plan still sizes the final-video clip to the shot-group span without any duration source, so shorter final videos can still overrun their real media length. (flagged 1 times across 1 plans)
[DEBT] tool-error-propagation: a blanket catch in executetool would silently downgrade db/persistence failures into ordinary tool results, changing the session error/http 500 behavior. (flagged 1 times across 1 plans)
[DEBT] track-reorder-accessibility: replacing arrow buttons with drag-only handle removes keyboard-accessible reorder; plan only specifies pointersensor. (flagged 1 times across 1 plans)
[DEBT] track-reorder-testing: no automated tests specified for same-kind boundary rules or save/load persistence of reordered tracks. (flagged 1 times across 1 plans)
[DEBT] usederivedtimeline: duplicate of correctness-1 — usememo dep array lint violation in sample code (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: preview fps source not exposed via existing context (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: same fps gap as flag-004 (flagged 3 times across 1 plans)
[DEBT] video-editor-effect-registry: replaceeffectregistry() in render mutates module state during react render (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same render-purity concern as correctness-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: o(n) re-renders during effect initialization (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same batching gap as performance-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: success criterion hardcodes render-time assignment as implementation detail (flagged 1 times across 1 plans)
[DEBT] video-editor-lightbox-tests: video editor lightbox tests: moving usequery into videoeditorprovider will break the existing provider unit test unless the plan also updates the test harness to supply react query context. (flagged 1 times across 1 plans)
[DEBT] video-editor-parameter-controls: video-editor-parameter-controls: the revised plan still suggests a dual-value slider for audio-binding min/max even though the shared slider wrapper is scalar-only; it should commit to two numberinput controls or a new range-slider implementation. (flagged 1 times across 1 plans)
[DEBT] video-editor-render-pipeline: video-editor-render-pipeline: recurring debt: the revised render-gating plan still uses cancelrender() as unmount cleanup and leaves delayrender() acquisition described as a mount-time action, which can abort renders or miss initial-frame blocking. (flagged 1 times across 1 plans)
[DEBT] video-editor-shell: video-editor shell: the plan’s width/aspect-based condensed threshold ignores the existing standard-layout maximize-timeline path, which already fixes the preview row at 180px. in this repo that means portrait timelines could be forced into condensed mode on normal desktop heights, effectively taking away the non-condensed maximize-timeline workflow unless the plan explicitly scopes the new threshold around istimelinemaximized or otherwise accepts that behavior change. (flagged 1 times across 1 plans)
[DEBT] vlm-cold-gpu-diagnostics: the cold-gpu vlm import crash investigation is deferred — the plan ships the zombie fix without root-causing the specific import failure. (flagged 1 times across 1 plans)
[DEBT] workspace-git-hygiene: step 2 discards unstaged edits in 6 files via git checkout head without first confirming the revert was unintentional. (flagged 1 times across 1 plans)
code
Note: User explicitly approved this plan at the gate checkpoint.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T3]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC3]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/reigh-app/.megaplan/plans/clean-up-the-final-video-20260406-0959/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.
{"output":"Executed batch 2 verification only. No additional source edits were needed: the old API names have no remaining runtime consumers in src/, TimelineEditor.tsx is the only runtime hook consumer, and TimelineCanvas.tsx plus ShotGroupContextMenu.tsx still receive callbacks through unchanged prop shapes. Wrote the batch checkpoint to .megaplan/plans/clean-up-the-final-video-20260406-0959/execution_batch_2.json.","files_changed":[".megaplan/plans/clean-up-the-final-video-20260406-0959/execution_batch_2.json"],"commands_run":["rg -n "dismissShot|dismissedShotIds|useFinalVideoAvailable" src --glob '!/.megaplan/'","rg -n "onShotGroupSwitchToFinalVideo|onShotGroupDismissFinalVideo|useFinalVideoAvailable" src/tools/video-editor/components/TimelineEditor src/tools/video-editor/hooks --glob '!/.megaplan/'","sed -n '1,220p' src/tools/video-editor/components/TimelineEditor/ShotGroupContextMenu.tsx","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineCanvas.test.tsx","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"],"deviations":[],"task_updates":[{"task_id":"T3","status":"done","executor_notes":"Verified the API rename blast radius by searching for dismissShot, dismissedShotIds, and useFinalVideoAvailable across src/. No remaining old-name consumers exist. The hook itself is only imported by TimelineEditor.tsx for runtime use; TimelineCanvas.tsx and ShotGroupContextMenu.tsx continue to receive callbacks via props, and the relevant timeline editor test modules pass with the current prop signatures.","files_changed":[],"commands_run":["rg -n "dismissShot|dismissedShotIds|useFinalVideoAvailable" src --glob '!/.megaplan/'","rg -n "onShotGroupSwitchToFinalVideo|onShotGroupDismissFinalVideo|useFinalVideoAvailable" src/tools/video-editor/components/TimelineEditor src/tools/video-editor/hooks --glob '!/.megaplan/'","sed -n '1,220p' src/tools/video-editor/components/TimelineEditor/ShotGroupContextMenu.tsx","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineCanvas.test.tsx","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC3","executor_note":"Confirmed. Runtime hook usage is limited to TimelineEditor.tsx, with useSwitchToFinalVideo.ts and TimelineEditor.test.ts only importing the shared ShotFinalVideo type. TimelineCanvas.tsx and ShotGroupContextMenu.tsx accept callback props with the same shotId/group shapes as before, so the rename did not change their prop contracts. TimelineCanvas.test.tsx and TimelineEditor.test.ts both pass."}]}
Clean up the final video badge and shot creation flow in the video editor timeline. Three issues to fix:
SHOT GROUP NOT APPEARING AFTER CREATE: createShotWithGenerationsPath in src/shared/hooks/shotCreation/shotCreationPaths.ts line 264 calls invalidateShotsQueries with refetchType:'inactive' which skips the active ShotsContext query. Same issue on line 204 for createShotWithFilesPath. Fix: remove refetchType:'inactive' so active queries refetch too.
FINAL VIDEO BADGE KEEPS REAPPEARING: dismissedShotIds in useFinalVideoAvailable.ts uses useState which resets on component remount. Move to a module-level Set (like useStaleVariants uses for dismissedAssetKeys at line 30) so it survives remounts. Also need to dismiss based on finalVideo.id (not shotId) so newer final videos for the same shot still show the badge.
BADGE SHOWS AFTER SWITCHING TO FINAL VIDEO: After applyEdit fires, the shot group recalculates. If the replaced video clip's generationId happens to match a shot image, the group re-forms and hasFinalVideo is still true (because finalVideoShotIds still includes it during the render before dismiss takes effect). The dismiss-before-switch approach was attempted but timing issues remain. Need a more robust solution - possibly check if any clip in the group is already using the final video asset, and suppress the badge in that case.
Batch framing:
- Execute batch 3 of 3.
- Actionable task IDs for this batch: ['T4']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3']
Actionable tasks for this batch:
[
{
"id": "T4",
"description": "Run npx tsc --noEmit to verify no type errors. If any failures, fix them. Then do a final review: read the changed files, confirm no out-of-scope edits, confirm the three bugs are addressed (shot invalidation, dismiss persistence, badge suppression when final video is on timeline).",
"depends_on": [
"T1",
"T2",
"T3"
],
"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": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in src/shared/hooks/shotCreation/shotCreationPaths.ts (lines 204 and 264). Change each call to just invalidateShotsQueries(queryClient, selectedProjectId) with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "done",
"executor_notes": "Removed the inactive-only invalidation filter from both shot creation paths. Verified the active ShotsContext query uses the same ['shots', projectId, maxImagesPerShot] prefix that invalidateShotsQueries targets, so invalidateQueries now refetches the mounted list query as intended.",
"files_changed": [
"src/shared/hooks/shotCreation/shotCreationPaths.ts",
"src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"commands_run": [
"sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts",
"sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts",
"sed -n '1,140p' src/shared/contexts/ShotsContext.tsx",
"sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In src/tools/video-editor/hooks/useFinalVideoAvailable.ts:\n - Replace useState<Set<string>> with a module-level const dismissedFinalVideoIds = new Set<string>() outside the hook.\n - Add a const [, forceRender] = useState(0) inside the hook for re-render triggering.\n - Rename dismissShot to dismissFinalVideo \u2014 it now takes a finalVideoId: string and does dismissedFinalVideoIds.add(finalVideoId); forceRender(n => n + 1).\n - Export dismissedFinalVideoIds (the Set) and dismissFinalVideo (the callback) instead of the old dismissedShotIds/dismissShot.\n\n2. In src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx:\n - Update the destructured import: const { finalVideoMap, dismissedFinalVideoIds, dismissFinalVideo } = useFinalVideoAvailable();\n - Update the finalVideoShotIds memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId. Store in a timelineClipGenerationIds: Set<string>. IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each in : skip if , skip if (final video already on timeline), otherwise add .\n c. Add , , to the memo deps.\n - Update line 548 callback: \n - Update line 549 callback: ",
"depends_on": [],
"status": "done",
"executor_notes": "Moved final-video dismissal state to a module-level Set keyed by finalVideo.id and rewired TimelineEditor to suppress badges when a current row clip already references that final video generation. Verified the switch chain remains consistent: useSwitchToFinalVideo registers generationId=finalVideo.id, stores the asset on the inserted clip meta, and the new rows->meta->registry scan detects it.",
"files_changed": [
"src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"
],
"commands_run": [
"sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts",
"sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts",
"rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!'",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Verify no other consumers of old API: Grep for , , and across the codebase (excluding .megaplan/). Confirm only and reference these. Check that and any context menu components receive callbacks (not the hook directly) so their prop signatures still match. If any other file imports the old names, update them.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Verified the API rename blast radius by searching for dismissShot, dismissedShotIds, and useFinalVideoAvailable across src/. No remaining old-name consumers exist. The hook itself is only imported by TimelineEditor.tsx for runtime use; TimelineCanvas.tsx and ShotGroupContextMenu.tsx continue to receive callbacks via props, and the relevant timeline editor test modules pass with the current prop signatures.",
"files_changed": [],
"commands_run": [
"rg -n "dismissShot|dismissedShotIds|useFinalVideoAvailable" src --glob '!'",
"rg -n "onShotGroupSwitchToFinalVideo|onShotGroupDismissFinalVideo|useFinalVideoAvailable" src/tools/video-editor/components/TimelineEditor src/tools/video-editor/hooks --glob '!'",
"sed -n '1,220p' src/tools/video-editor/components/TimelineEditor/ShotGroupContextMenu.tsx",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineCanvas.test.tsx",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.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/clean-up-the-final-video-20260406-0959/execution_batch_2.json",
"Advisory: done tasks rely on commands_run without files_changed (FLAG-006 softening): T3",
"Advisory audit finding: Git status shows changed files not claimed by any task: .megaplan/debt.json, .megaplan/plans/clean-up-the-final-video-20260406-0959",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC4",
"task_id": "T4",
"question": "Does npx tsc --noEmit pass cleanly? Are all three bugs addressed: (1) shot appears after creation, (2) dismiss survives remount, (3) badge hidden when final video is on timeline?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Fix shot query invalidation: Remove { refetchType: 'inactive' } from both invalidateShotsQueries calls in src/shared/hooks/shotCreation/shotCreationPaths.ts (lines 204 and 264). Change each call to just invalidateShotsQueries(queryClient, selectedProjectId) with no third argument. This lets the active ShotsContext query refetch after shot creation.",
"depends_on": [],
"status": "done",
"executor_notes": "Removed the inactive-only invalidation filter from both shot creation paths. Verified the active ShotsContext query uses the same ['shots', projectId, maxImagesPerShot] prefix that invalidateShotsQueries targets, so invalidateQueries now refetches the mounted list query as intended.",
"files_changed": [
"src/shared/hooks/shotCreation/shotCreationPaths.ts",
"src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"commands_run": [
"sed -n '180,290p' src/shared/hooks/shotCreation/shotCreationPaths.ts",
"sed -n '1,220p' src/shared/hooks/shots/cacheUtils.ts",
"sed -n '1,140p' src/shared/contexts/ShotsContext.tsx",
"sed -n '1,220p' src/shared/hooks/shots/useShotsQueries.ts",
"npx vitest run --config config/testing/vitest.config.ts src/shared/hooks/shotCreation/shotCreationPaths.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Refactor useFinalVideoAvailable to use module-level Set keyed by finalVideo.id:\n\n1. In src/tools/video-editor/hooks/useFinalVideoAvailable.ts:\n - Replace useState<Set<string>> with a module-level const dismissedFinalVideoIds = new Set<string>() outside the hook.\n - Add a const [, forceRender] = useState(0) inside the hook for re-render triggering.\n - Rename dismissShot to dismissFinalVideo \u2014 it now takes a finalVideoId: string and does dismissedFinalVideoIds.add(finalVideoId); forceRender(n => n + 1).\n - Export dismissedFinalVideoIds (the Set) and dismissFinalVideo (the callback) instead of the old dismissedShotIds/dismissShot.\n\n2. In src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx:\n - Update the destructured import: const { finalVideoMap, dismissedFinalVideoIds, dismissFinalVideo } = useFinalVideoAvailable();\n - Update the finalVideoShotIds memo (lines 269-277) to:\n a. Collect generationIds of all clips currently on the timeline by iterating data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId. Store in a timelineClipGenerationIds: Set<string>. IMPORTANT: scan actual row clips, NOT all registry entries (FLAG-001 \u2014 registry retains stale entries after clip removal).\n b. For each in : skip if , skip if (final video already on timeline), otherwise add .\n c. Add , , to the memo deps.\n - Update line 548 callback: \n - Update line 549 callback: ",
"depends_on": [],
"status": "done",
"executor_notes": "Moved final-video dismissal state to a module-level Set keyed by finalVideo.id and rewired TimelineEditor to suppress badges when a current row clip already references that final video generation. Verified the switch chain remains consistent: useSwitchToFinalVideo registers generationId=finalVideo.id, stores the asset on the inserted clip meta, and the new rows->meta->registry scan detects it.",
"files_changed": [
"src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"
],
"commands_run": [
"sed -n '1,240p' src/tools/video-editor/hooks/useFinalVideoAvailable.ts",
"sed -n '200,620p' src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"sed -n '1,140p' src/tools/video-editor/hooks/useShotGroups.ts",
"sed -n '1,180p' src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"sed -n '1,140p' src/tools/travel-between-images/hooks/video/useShotFinalVideos.ts",
"rg -n "dismissShot|dismissedShotIds|dismissFinalVideo|dismissedFinalVideoIds" src --glob '!'",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts src/tools/video-editor/hooks/useShotGroups.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Verify no other consumers of old API: Grep for , , and across the codebase (excluding .megaplan/). Confirm only and reference these. Check that and any context menu components receive callbacks (not the hook directly) so their prop signatures still match. If any other file imports the old names, update them.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Verified the API rename blast radius by searching for dismissShot, dismissedShotIds, and useFinalVideoAvailable across src/. No remaining old-name consumers exist. The hook itself is only imported by TimelineEditor.tsx for runtime use; TimelineCanvas.tsx and ShotGroupContextMenu.tsx continue to receive callbacks via props, and the relevant timeline editor test modules pass with the current prop signatures.",
"files_changed": [],
"commands_run": [
"rg -n "dismissShot|dismissedShotIds|useFinalVideoAvailable" src --glob '!'",
"rg -n "onShotGroupSwitchToFinalVideo|onShotGroupDismissFinalVideo|useFinalVideoAvailable" src/tools/video-editor/components/TimelineEditor src/tools/video-editor/hooks --glob '!'",
"sed -n '1,220p' src/tools/video-editor/components/TimelineEditor/ShotGroupContextMenu.tsx",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineCanvas.test.tsx",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.test.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Run to verify no type errors. If any failures, fix them. Then do a final review: read the changed files, confirm no out-of-scope edits, confirm the three bugs are addressed (shot invalidation, dismiss persistence, badge suppression when final video is on timeline).",
"depends_on": [
"T1",
"T2",
"T3"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"FLAG-001: When checking if final video is already on timeline, scan ACTUAL clip assets from rows+meta+registry (not just registry entries). Registry retains entries after clip removal, so scanning all registry assets would incorrectly suppress the badge after a final video clip is deleted. The correct approach: iterate data.rows \u2192 action.id \u2192 meta[action.id]?.asset \u2192 registry.assets[assetKey]?.generationId.",
"FLAG-002: Suppressing per-shot (not per-group) is acceptable \u2014 if the final video is on ANY group for a shot, hiding the badge on other groups of that shot is correct. The gate rationale confirms this. No action needed.",
"DEBT: final-video-badge-suppression, final-video-reminder-state, shot-group-badge-scope \u2014 all three are directly addressed by this plan's changes. Ensure the fix resolves them, not worsens them.",
"The module-level Set survives component remounts but resets on full page reload. It does NOT reset on project switch \u2014 if the user switches projects and back, old dismissals persist. This is acceptable per gate guidance but worth noting.",
"useSwitchToFinalVideo registers the asset with (line 55). This is the same ID used for dismiss and timeline-presence checks. Ensure consistency \u2014 the finalVideo.id from useShotFinalVideos must match.",
"The forceRender pattern (useState counter + module Set) is simple but means only the component calling dismissFinalVideo re-renders. Since useFinalVideoAvailable is only called in TimelineEditor.tsx, this is fine."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "After removing refetchType:'inactive', does the ShotsContext active query actually refetch? Confirm that invalidateShotsQueries without the filter triggers a refetch of queries with the 'shots' query key that ShotsContext uses.",
"executor_note": "Confirmed by inspection: ShotsContext mounts useListShots with queryKey ['shots', projectId, maxImagesPerShot], and invalidateShotsQueries invalidates ['shots', projectId] without a refetchType override. TanStack Query will therefore mark the active shots list stale and refetch it.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Does the timeline-clip-based generationId scan correctly identify when a final video is already placed on the timeline? Verify by tracing: useSwitchToFinalVideo sets generationId=finalVideo.id on the asset \u2192 the asset is assigned to a clip via meta[clipId].asset \u2192 the scan picks it up. Confirm the chain is unbroken.",
"executor_note": "Confirmed by tracing the code path: useSwitchToFinalVideo creates the replacement asset with generationId: finalVideo.id, stores that asset key on the new clip's meta entry, and resolveFinalVideoShotIds now scans rows -> meta[action.id].asset -> registry.assets[assetKey].generationId, so a placed final video is detected from actual timeline clips.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are there any other files besides TimelineEditor.tsx that import from useFinalVideoAvailable or reference dismissShot/dismissedShotIds? If TimelineCanvas or ShotGroupContextMenu receive these as props, do the prop types still match after the rename?",
"executor_note": "Confirmed. Runtime hook usage is limited to TimelineEditor.tsx, with useSwitchToFinalVideo.ts and TimelineEditor.test.ts only importing the shared ShotFinalVideo type. TimelineCanvas.tsx and ShotGroupContextMenu.tsx accept callback props with the same shotId/group shapes as before, so the rename did not change their prop contracts. TimelineCanvas.test.tsx and TimelineEditor.test.ts both pass.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does pass cleanly? Are all three bugs addressed: (1) shot appears after creation, (2) dismiss survives remount, (3) badge hidden when final video is on timeline?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a focused 2-file fix (shotCreationPaths.ts + useFinalVideoAvailable.ts) plus a memo update in TimelineEditor.tsx. The trickiest part is T2's timeline-clip scan for FLAG-001: you MUST iterate rows\u2192meta\u2192registry to get generationIds of clips actually on the timeline, NOT scan all registry.assets entries (registry retains stale entries after clip deletion). The pattern for this scan already exists in useShotGroups.ts lines 51-58 \u2014 reuse that exact approach. The dismissFinalVideo rename is a breaking API change but only consumed in TimelineEditor.tsx (line 219, 548, 549), so the blast radius is small. T1 is fully independent and trivial \u2014 do it first for a quick win.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Remove refetchType:'inactive' from invalidateShotsQueries calls",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Move dismissed state to module-level Set keyed by finalVideo.id",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Suppress badge when final video is already on timeline",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Verify no other consumers of old API",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Run tsc --noEmit and validate",
"finalize_task_ids": [
"T4"
]
}
],
"orphan_tasks": [],
"completeness_notes": "Steps 2 and 3 are combined into T2 since they modify the same files and the same memo block. All 5 plan steps are covered.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] agent-chat-rendering: removing the duplicate assistant turn may hide message_user text if the frontend only renders assistant-role turns as chat bubbles. (flagged 1 times across 1 plans)
[DEBT] agent-chat-undo-integration: agent chat edits arrive via query invalidation/realtime polling and will bypass the undo stack because those paths are marked skiphistory. (flagged 1 times across 1 plans)
[DEBT] agent-tool-utils: agent-tool-utils: step 6 moves isrecord out of llm/messages.ts without preserving that module's current export surface for index.ts, db.ts, tool-calls.ts, and selectedclips.ts, so the refactor plan can break four existing imports unless it adds a re-export or rewires those callers. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the actual export surface in supabase/functions/ai-timeline-agent/llm/messages.ts and its consumers. step 6 says to 'remove local isrecord' from messages.ts and import it from utils.ts, but without also preserving messages.ts as an exporter or rewiring index.ts, db.ts, tool-calls.ts, and selectedclips.ts, that change would break the module graph immediately. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the render-gating cleanup plan against remotion's runtime exports in node_modules/remotion/dist/cjs/cancel-render.js:46-70. cancelrender() stores an error and throws to abort the render; it is not a benign cleanup for an abandoned delayrender handle, so step 2's instruction to call cancelrender(handle) on unmount is technically wrong and would abort preview or export with an error. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked how remotion itself acquires delay handles in node_modules/remotion/dist/cjs/iframe.js:8-18. remotion's own components create the handle synchronously with usestate(() => delayrender(...)); the plan says 'calls delayrender() on mount', which reads like an effect-time action and leaves the initial-frame blocking behavior underspecified compared with the actual library pattern. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the new useaudioparam() sketch against src/tools/video-editor/effects/compileeffect.tsx:1-2. the plan defines it in terms of interpolate(audio[binding.source], ...) but does not explicitly import interpolate into the new hook file or simplify it to straight arithmetic, so the helper's implementation contract is still looser than it needs to be. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked revised step 2.4 against src/tools/video-editor/hooks/useclipresize.ts:76-100. the plan still says to clamp audio by writing back to action.end, but the current hook treats the callback action as input data and then creates fresh row actions from it. mutating that caller-owned object is unnecessary and risks coupling the resize hook to outside references instead of using a local clampedend variable. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the no-duration-fetch decision against src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37, src/tools/video-editor/lib/config-utils.ts:17-35, and src/tools/video-editor/compositions/visualclip.tsx:114-123. the repository still derives clip length from to - from, and the final-video query still provides no duration metadata, so the revised plan still cannot prove that to: endtime - starttime is safe for shorter source media; a short final video can still be asked to play longer than its actual content. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked the hand-built replacement clip against the existing insert path in src/tools/video-editor/hooks/useassetmanagement.ts:201-252,262-271 and serialization in src/tools/video-editor/hooks/usetimelinecommit.ts:210-216. the revised timelineeditor sketch still bypasses current insertion invariants such as manual-track geometry defaults and explicit cliporder updates, so replacement clips on manual visual tracks will not be initialized the same way as other inserted video clips and may serialize in a different per-track order. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the two user-visible must goals for the selection ring and locked-pane chat. they describe the right product outcomes, but they are mostly manual ui behaviors rather than code-review-verifiable gates, so they are not fully testable from the listed automated checks alone. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the revised must criterion about eliminating duplicated server-side helpers. as written, the plan could satisfy 'all import from utils.ts' for generation.ts, create-task.ts, and messages.ts and still break four existing messages.ts consumers, so the criterion is incomplete unless it also requires preserving or updating the messages.ts export surface. (flagged 2 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the must criterion 'edge function tests (ai-generate-effect/index.test.ts) pass with updated templates' against the actual test file. since supabase/functions/ai-generate-effect/index.test.ts mocks buildgenerateeffectmessages(), this criterion can pass without validating the template edits themselves, so it is still a weak must gate as written. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: checked the remaining must criteria against the revised verification plan. criteria like 'existing timelinecanvas.test.tsx tests pass' and 'rowstoconfig serialization ... verified by read-only inspection' are reviewable, but they are still proxy gates rather than direct evidence that resize speed math and live audio clamping behave correctly, so the criteria are improved but not fully outcome-oriented yet. (flagged 1 times across 1 plans)
[DEBT] audio-clamp-math: audio clamp math: revised step 4.2 still gives conflicting formulas for left-edge minstart, and one of them depends on clipmeta.to, so the live audio clamp is not fully specified. (flagged 1 times across 1 plans)
[DEBT] bulk-panel-tabs: text clip multi-selections would miss the position tab under the plan's stated rule. (flagged 1 times across 1 plans)
[DEBT] bulk-properties-panel: bulkclippanel still imports customeffecteditor; removing it without updating bulk mode would break the build. (flagged 1 times across 1 plans)
[DEBT] clip-drag-scroll-sync: the plan's step 3 ontick callback only shows coordinator.update() but the full clip-drag state path (snap, lateststart, ghost positions) also needs re-running during stationary-pointer scroll. (flagged 1 times across 1 plans)
[DEBT] clip-param-schema-evolution: clips with stale or partial params from a previous schema version will not be automatically normalized/backfilled when the effect schema changes. (flagged 1 times across 1 plans)
[DEBT] clip-resize-math: clip resize math: revised step 1 still leaves the source of origin.to under-specified, so the speed formula can be implemented against the wrong to value unless the plan explicitly says to use committed clip state or recompute it with getsourcetime(...). (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: silently reloading agent-originated timeline updates would discard dirty local edits. (flagged 1 times across 1 plans)
[DEBT] conflict-resolution: if all 3 conflict retries fail, the fallback path risks discarding dirty local edits unless the executor wires it into the existing conflict dialog. (flagged 1 times across 1 plans)
[DEBT] context-menu-scope: multi-clip copy is not included despite being mentioned in the original idea. (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?: checked the revised step 6 against supabase/functions/ai-timeline-agent/llm/messages.ts:12, supabase/functions/ai-timeline-agent/index.ts:6, supabase/functions/ai-timeline-agent/db.ts:2, supabase/functions/ai-timeline-agent/tool-calls.ts:1-4, and supabase/functions/ai-timeline-agent/selectedclips.ts:1. the plan still does not account for isrecord being part of messages.ts's exported api today, so the utility extraction is incomplete unless it either re-exports isrecord from messages.ts or updates all four downstream imports. (flagged 2 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?: checked the revised audio-binding ui step against the research note and src/shared/components/ui/slider.tsx:5-17,31-52. the plan still says 'a dual-value slider or two number inputs' instead of committing to the supported path, even though the shared slider wrapper is scalar-only, so that important review note is only partially addressed. (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?: checked src/tools/video-editor/hooks/useclipresize.ts:54-73 against revised step 1. the plan now says to cache to in resizestartref, but it still never states whether that value must come from committed clip state or from a fresh getsourcetime(...) calculation. because the current resize handler computes a transient wrong to during left-edge trims before commit-time rematerialization repairs it, leaving origin.to implicit is still a correctness-sensitive ambiguity. (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?: checked revised step 4.2 against src/tools/video-editor/components/timelineeditor/timelinecanvas.tsx:483-490 and src/tools/video-editor/hooks/useclipresize.ts:56-60. the plan still gives two different formulas for audio minstart, and one of them depends on clipmeta.to, so the left-edge live-clamp requirement is not fully settled yet. (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?: checked src/tools/video-editor/hooks/usestalevariants.ts against the proposed usefinalvideoavailable state model: stale reminders are dismissed per assetkey and can clear when the asset changes, but the plan dismisses by shotid, which would hide any newer final video for the same shot for the rest of the session even though useshotfinalvideos() exposes a changing final-video id. (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?: checked the revised dismissal model against src/tools/video-editor/hooks/usestalevariants.ts:160-166 and src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:39-60. the plan still dismisses by shotid, not by final-video generation id, so if a shot gets a newer final output later in the same session the badge would remain suppressed even though useshotfinalvideos() would surface a different id; that earlier concern is still open. (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?: searched all isrecord imports from ./llm/messages.ts under supabase/functions/ai-timeline-agent/ and found four dependent files: index.ts, db.ts, tool-calls.ts, and selectedclips.ts. step 6 still lists only generation.ts, create-task.ts, and messages.ts as update targets, so it does not currently touch all locations that depend on the symbol being moved. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked supabase/functions/ai-timeline-agent/selectedclips.test.ts:1 through supabase/functions/ai-timeline-agent/selectedclips.ts:1. the supporting test infrastructure exists and would catch one of these export-chain breaks, but only after later refactors because the plan schedules the edge vitest run in step 9 rather than immediately after the step 6 export move. (flagged 2 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: checked the supporting ui infrastructure for audio-binding controls. because src/shared/components/ui/slider.tsx:5-17,31-52 only supports one thumb and src/shared/components/ui/number-input.tsx:6-33 already exists as the established numeric input control, the plan should call out either numberinput usage or a new range-slider component explicitly; right now the supporting ui work is still incomplete in the plan. (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?: checked the planned test location for prompt-template changes against supabase/functions/ai-generate-effect/index.test.ts. since that suite mocks buildgenerateeffectmessages(), touching only index.test.ts still misses the supporting test infrastructure needed to validate templates.ts itself. (flagged 1 times across 1 plans)
[DEBT] drop-indicator-plumbing: dropindicator reads position.trackid without it being declared on the dropindicatorposition interface or forwarded by toindicatorposition(). (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: legacy persisted 'enhance' values might exist in storage (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no-migration assumption for enhance→upscale is under-supported (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: enhance/upscale only partially resolved — persisted values not validated (flagged 1 times across 1 plans)
[DEBT] edit-mode-persistence: no read-side normalization test for legacy 'enhance' values (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation grep for 'enhance' will false-fail due to video code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: grep scope too broad — hits video submode code (flagged 1 times across 1 plans)
[DEBT] edit-mode-validation: validation scope reaches unrelated video code (flagged 1 times across 1 plans)
[DEBT] effect-layer-overlap-enforcement: the plan relies on same-track overlap being forbidden but does not explicitly specify the enforcement call (resolveoverlaps or range rejection) in the drop/create path. (flagged 1 times across 1 plans)
[DEBT] final-video-badge-suppression: final-video badge suppression: step 3's proposed timelinegenerationids scan over data.registry.assets would treat any previously registered final-video asset as 'already on the timeline', even if no current clip is using it. (flagged 1 times across 1 plans)
[DEBT] final-video-duration-handling: final-video duration handling: useshotfinalvideos() does not provide duration and the timeline uses clip.to - clip.from as truth, so the proposed in-place trim can overrun shorter source media. (flagged 1 times across 1 plans)
[DEBT] final-video-reminder-state: final-video reminder state: dismissing by shotid instead of final-video id still suppresses later final outputs for the same shot during the same session. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: checked the current callers of isrecord from llm/messages.ts. index.ts uses it to validate rawsession, db.ts uses it on db rows, tool-calls.ts uses it on parsed tool-call payloads and nested function objects, and selectedclips.ts uses it while normalizing attachments, so preserving that import contract matters to four different call paths. (flagged 2 times across 1 plans)
[DEBT] immediate-task-feedback: immediate task feedback: the plan does not cover the repo's existing optimistic-pending pattern, so it does not reliably meet the stated 'appear immediately when a task is created' behavior. with only realtime plus 5s polling, spinner appearance still depends on network/realtime latency. (flagged 1 times across 1 plans)
[DEBT] issue-detection: mid-sentence-cut detection is not implementable without transcript/profile data that the current provider doesn't expose. (flagged 1 times across 1 plans)
[DEBT] legacy-effect-lifecycle: removing customeffecteditor makes effects-table entries read-only — users can no longer edit legacy custom effects. (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: duplicate of correctness-2 — multi-drag meta patch accumulation not spelled out (flagged 1 times across 1 plans)
[DEBT] multi-drag-utils: same merge strategy concern as correctness-2/5 from the caller perspective (flagged 1 times across 1 plans)
[DEBT] optimistic-locking: plan only specifies version checking at the db write layer; the ui load/state/save path doesn't carry config_version yet. (flagged 1 times across 1 plans)
[DEBT] properties-panel-scope: crop and transition controls are not included in the bulk panel, narrowing the original idea's scope. (flagged 1 times across 1 plans)
[DEBT] realtime-subscriptions: the shared realtime system doesn't know about timeline_agent_sessions; step 7 hooks need their own channel subscription. (flagged 1 times across 1 plans)
[DEBT] registry-patch-testing: patchregistry() lacks automated regression tests — the duplicate-id bug's most likely reproduction path is covered only by pure-function tests on the assembler it delegates to, plus manual smoke testing. (flagged 1 times across 1 plans)
[DEBT] resize-hook-mutation: resize hook mutation: revised step 2.4 clamps audio by mutating action.end, even though the current resize hook builds new row objects immutably from the callback input. (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: resolve-overlaps.ts entirely lacks tests; plan only adds resolvegroupoverlaps tests (flagged 1 times across 1 plans)
[DEBT] resolve-overlaps: phase 4 blast radius covers both resolveoverlaps and resolvegroupoverlaps return shapes (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the affected edge-agent surface around llm/messages.ts. the isrecord extraction is broader than the three files listed in step 6 because messages.ts is a shared utility module for index.ts, db.ts, tool-calls.ts, and selectedclips.ts; the plan still scopes the edit as if only the local definition sites matter. (flagged 2 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the verification scope around the edge function. supabase/functions/ai-generate-effect/index.test.ts:35-46 mocks buildgenerateeffectmessages(), so adding only more index.test.ts cases still will not exercise the real templates.ts prompt content; the revised plan improves scope on the implementation side, but its test scope is still narrower than the actual risk surface. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked src/tools/video-editor/lib/resolve-overlaps.ts:139-195 at the useclipresize call site. this api only produces metapatches[clipid] for the moved clip, so revised step 3's generic 'for each clip id in overlappatches' loop is broader than the actual resize surface and adds complexity the fix does not currently need. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked the existing video-drop paths in src/tools/video-editor/lib/external-drop-utils.ts:46-55,386-412 and src/tools/video-editor/hooks/useassetmanagement.ts:198-252. the broader repository pattern for video assets is not just “register then insert”; multi-generation video drops also patch registry.duration using getdroppedgenerationduration(), while useshotfinalvideos() in src/tools/travel-between-images/hooks/video/useshotfinalvideos.ts:19-37 currently fetches no duration metadata. that means final-video replacement is broader than badge wiring alone if the new clip is expected to behave like other video assets in timing ui and resize logic. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: checked related asset-insertion code in src/tools/video-editor/hooks/useassetmanagement.ts:150-271 and src/tools/video-editor/lib/coordinate-utils.ts:24-33. the broader repository pattern for adding timeline media is centralized there, including track compatibility, manual-track defaults, selection updates, and cliporder maintenance, so the revised plan is still broader than a pure menu/ui change and needs either shared helper extraction or a more explicit statement that those invariants are being replicated on purpose. (flagged 1 times across 1 plans)
[DEBT] selection-save-bridge: the plan specifies passing pruneselection into usetimelinesave but doesn't detail the hook-layer bridge needed because usetimelinesave is instantiated inside usetimelinedata before usetimelinestate runs. (flagged 1 times across 1 plans)
[DEBT] shot-group-badge-scope: shot-group badge scope: step 3 suppresses the reminder at shot level, but this repo can render multiple shot groups for the same shot, so switching one group to the final video would hide the badge on other groups of that shot too. (flagged 1 times across 1 plans)
[DEBT] task-deduplication: server-generated idempotency keys would break retry deduplication because retried requests get fresh keys. (flagged 1 times across 1 plans)
[DEBT] task-reference-matching: task reference matching: reusing taskreferencesgeneration as the only matcher will miss active video-generation tasks for source clips. the helper does not inspect input_image_generation_ids, start_image_generation_id, or end_image_generation_id, even though this repo stores and later reads those fields to identify which timeline generations a travel task is using. that means spinners would fail to appear for at least some travel/video tasks. (flagged 1 times across 1 plans)
[DEBT] task-system-integration: create_generation_task is underspecified against the actual task family system. (flagged 1 times across 1 plans)
[DEBT] timeline-media-duration: timeline media duration: the revised plan still sizes the final-video clip to the shot-group span without any duration source, so shorter final videos can still overrun their real media length. (flagged 1 times across 1 plans)
[DEBT] tool-error-propagation: a blanket catch in executetool would silently downgrade db/persistence failures into ordinary tool results, changing the session error/http 500 behavior. (flagged 1 times across 1 plans)
[DEBT] track-reorder-accessibility: replacing arrow buttons with drag-only handle removes keyboard-accessible reorder; plan only specifies pointersensor. (flagged 1 times across 1 plans)
[DEBT] track-reorder-testing: no automated tests specified for same-kind boundary rules or save/load persistence of reordered tracks. (flagged 1 times across 1 plans)
[DEBT] usederivedtimeline: duplicate of correctness-1 — usememo dep array lint violation in sample code (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: preview fps source not exposed via existing context (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-preview: same fps gap as flag-004 (flagged 3 times across 1 plans)
[DEBT] video-editor-effect-registry: replaceeffectregistry() in render mutates module state during react render (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same render-purity concern as correctness-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: o(n) re-renders during effect initialization (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: same batching gap as performance-1 (flagged 1 times across 1 plans)
[DEBT] video-editor-effect-registry: success criterion hardcodes render-time assignment as implementation detail (flagged 1 times across 1 plans)
[DEBT] video-editor-lightbox-tests: video editor lightbox tests: moving usequery into videoeditorprovider will break the existing provider unit test unless the plan also updates the test harness to supply react query context. (flagged 1 times across 1 plans)
[DEBT] video-editor-parameter-controls: video-editor-parameter-controls: the revised plan still suggests a dual-value slider for audio-binding min/max even though the shared slider wrapper is scalar-only; it should commit to two numberinput controls or a new range-slider implementation. (flagged 1 times across 1 plans)
[DEBT] video-editor-render-pipeline: video-editor-render-pipeline: recurring debt: the revised render-gating plan still uses cancelrender() as unmount cleanup and leaves delayrender() acquisition described as a mount-time action, which can abort renders or miss initial-frame blocking. (flagged 1 times across 1 plans)
[DEBT] video-editor-shell: video-editor shell: the plan’s width/aspect-based condensed threshold ignores the existing standard-layout maximize-timeline path, which already fixes the preview row at 180px. in this repo that means portrait timelines could be forced into condensed mode on normal desktop heights, effectively taking away the non-condensed maximize-timeline workflow unless the plan explicitly scopes the new threshold around istimelinemaximized or otherwise accepts that behavior change. (flagged 1 times across 1 plans)
[DEBT] vlm-cold-gpu-diagnostics: the cold-gpu vlm import crash investigation is deferred — the plan ships the zombie fix without root-causing the specific import failure. (flagged 1 times across 1 plans)
[DEBT] workspace-git-hygiene: step 2 discards unstaged edits in 6 files via git checkout head without first confirming the revert was unintentional. (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: [T4]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC4]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/reigh-app/.megaplan/plans/clean-up-the-final-video-20260406-0959/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.