You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
idea: repair two adjacent chain segments together (a break that spilled into k+1) #1231
repair-segment takes one segment. A break in segment k of a guide chain also breaks
segment k+1's opening (its guide is k's broken tail), so repairing k alone has to rejoin
a broken k+1 and cannot clean the take (bench/records/repair.mdBy eye). Rendering
k and k+1 together between k-1 and k+2 is 22 + 204 + 39 = 265 frames plus the grid
overrun, inside H3's 345-frame ceiling, so it is one render. A second repair of an
already-repaired take also fails at the segment-file lookup, not with its own error.
Found by the long-form bench (#1199), filed by model claude-opus-5-5 via provider anthropic.
Plan for #1231, by model claude-opus-5-5 via provider anthropic. Design at develop f25446b4.
Verdict: build smaller
Build only the clear refusal for a second repair of a repaired take. Do not build the two-segment repair (span 2) yet.
Value.
Span 2. The evidence is one bench take, chk-s3-seg4-broken (bench/records/repair.mdBy eye).
That break reached segment 5 because the check passed it before cut_ratio existed. cut_ratio (d37c3192) was added to stop a break at segment k, before its tail becomes the next guide. That is the prevention this repair would clean up after.
Clear refusal. This one is cheap and certain. Today a second repair fails with the generic error "shots name no segment files (a chain run before they were recorded…) - pass 'chain_output'". If the caller follows that advice, it fails later as "not the same run's", "it has none", or not at all. Each of those sends an MCP session down the wrong path.
Build cost.
Stage A: about $2-3, with a cheap verify. The refusal fires in the cut, before any render.
Span 2, if built later: about $5-8 for one stage, plus about 13 min of GPU per verify render (277 frames against 175's 8.1 min) and an unmeasured VRAM peak.
Inertia.
Stage A adds no surface. It changes one error message and its doc lines.
Span 2 would add:
one template variable, against about 64 tokens of catalog headroom (tests/test_catalog_structure.py:578-591);
a num_frames default that is wrong for span 2 (175 against 277), which the caller must override;
geometry and splice code generalised across N shots, with its tests;
a span that only fits chains of 158 frames or fewer per segment at the default canvas, and is refused at 1344x768 by VRAM (about 28 GB).
Reversibility. Stage A is fully reversible. Span 2, once a template variable is named, needs a breaking change to remove.
Cheaper alternatives for a spilled break, all available today:
re-run the chain from segment k with a new seed;
cut at the seam (repair ladder step 3);
repair segment k+1 alone after k. That fails too: k+1's head guide is k's broken tail.
So re-running is the real alternative. It costs one chain run, about 18 min for 10 segments.
What would bring span 2 back (it stays recorded in this plan's sweep and the draft design below): a field report, or a bench take, where cut_ratio passed a break that spilled into k+1 and re-running from k was not acceptable.
Sweep (one read-only pass over every consumer)
Engine: dw/tasks/chain_repair.py. Every geometry and splice function assumes exactly one replaced segment.
repair_geometry (:86-160) reads segment_frames[segment-2:segment+1] at :129, so it only ever sees three slots. With a span of 2, the minimum segment count (:108) becomes 4, the range (:113) becomes 2..N-2, shortest (:135) sums both replaced segments, and the tail check (:145) tests segment k+2.
chain_repair_cut (:348-461) has three pieces that change:
the pre-check at :402;
following = paths[segment] at :406;
the neighbour audio and decode checks at :407-433, which read k-1 and k+1 and must read k-1 and k+span.
check_take_shots (:327-345) needs a shot at index segment+span-1.
_spliced_track (:555-599) breaks for a span of 2. It reads after = shots[segment] and blends out at that index.
_spliced_shots (:602-639) breaks for a span of 2. It would keep the stale shot k+1.
The registrations (:642-671) need the span as a POSITIVE whole number.
_locate, _named_files, segment_files and _take_spans are unaffected by the span.
The description and summary (:3-4) say "one bad segment", "2 to N-1" and "cannot be repaired again".
num_frames (:62-69) is constrained to 124..345 on 17n+5, default 175.
The cut step (:101-116) and the splice step (:272-290) would carry the span.
Frame math (the 345 ceiling is per template, enforced by dw/variable_constraints.py). A span of 2 is 22 + 2L + 39 on the grid:
chain
interior L
shortest
render
overrun
chained-segments (124, carry 22)
102
265
277
12
guide_frames 39
85
231
243
12
chain-video-continuity / chain-matched-to-audio
122
305
311
6
chain-matched-and-aligned
118
297
311
14
A span of 2 fits only for chain segments of 158 frames or fewer.
A span of 3 does not fit (367 frames).
The existing "pass num_frames=N" message can already name N > 345 for a span of 1 on a 345-frame chain.
VRAM (repair-segment.json:5-22).
At 960x544: 19.95 GB at 175 frames, 22.07 at 277, 22.78 at 311. All are under the 24 GB entry.
At 1344x768, 277 frames is about 28 GB and is refused.
A span of 2 has no measured peak.
Second repair of a repaired take.
_spliced_shots:610 strips segment_file from every shot.
_locate:264-269 then raises the generic "shots name no segment files … pass 'chain_output'".
With chain_output passed, the cut fails at :422-431 ("not the same run's") or at check_take_shots ("it has none"). A repair far from the span silently uses the original files.
Nothing marks a take as repaired except the shot name suffix (repaired), which _spliced_shots:611-612 writes.
Tests that pin today's behaviour.
tests/test_chain_repair.py:
:26-37splice_length;
:99, :116 and :120 (refusal messages);
:414 and :499 (splice shots);
:512 and :527 (no-shots refusals);
:592-663 (template).
tests/test_catalog_structure.py:347,578-591.
Docs that state the rule:
docs/TASKS.md:933-1010, including :1009-1010 "a repaired take cannot be repaired again";
docs/WORKFLOW_GUIDE.md:2689-2702;
docs/ARCHITECTURE.md:88;
workflows/templates/minimax/README.md:166;
plugins/dw/skills/long-form/references/run-and-repair.md:48-80, including :67-75;
plugins/dw/skills/long-form/SKILL.md:3,124-128;
references/quality-and-speed.md:21.
MCP, REST and UI. Nothing names repair-segment or chain_repair.
Problem and non-goals
Problem. A second repair of a repaired take fails with an error that names the wrong cause, and its advice ("pass chain_output") leads somewhere worse.
Non-goals:
making a repaired take repairable. The splice would have to write segment files for the span, and that is a new concept;
span-2 repair (cut, above);
the "over 345" wording of the span-1 num_frames message. It is a small separate improvement, folded into stage A only because it lives in the same function (Q1).
Design
Detecting a repair output. In chain_repair_cut's _locate, before either branch, refuse when the take's shots carry any shot whose name ends in (repaired). That shot is the one _spliced_shots writes, and only the splice writes that suffix.
The refusal names the take, the repaired shot and segment, and the way out: "<take> is a repair output (<shot name>, the splice keeps no segment files) - a repaired take cannot be repaired again. Repair the chain's original take, which still names its segment files, or re-render the chain."
It fires whether chain_take or chain_output was passed, so the misleading fallback is never reached.
The splice refuses too.chain_repair_splice gets the same check through one shared helper, so a hand-built workflow that skips the cut is refused as well.
No new shot key. A repaired: true record was considered and not chosen. It would change the shot record that dw/shots.py documents and the run manifest, for no gain over the suffix the splice already owns. Q2 asks about this.
num_frames over the ceiling (Q1). When the smallest render that fits is over 345, the cut says so: "segment k (L frames) with these guides needs N frames, past H3's 345 - lower head_frames/tail_frames". It does not name an N that the template's own constraint would then refuse.
No MCP, REST, syntax or template-variable change. The refusal raises the same ValueError before the render as today.
Stages
Stage A: refuse a second repair by name
Builds:
the shared repair-output check in dw/tasks/chain_repair.py, used by both chain_repair_cut (at the top of _locate) and chain_repair_splice;
the "past 345" wording in repair_geometry.
Unit tests (tests/test_chain_repair.py):
the cut refuses a spliced take passed as chain_take, and again with chain_output passed too. In both cases the message names the repaired shot and "cannot be repaired again";
the splice refuses a spliced take;
an original take still cuts, so the existing tests stay green;
a geometry case whose minimum is over 345 names the ceiling, not an N.
the repair-segment.json:3 description, as a wording change only, in the same token count or fewer (catalog budget).
Deploy path: server (task code; restart the worker).
Estimate: $2-3, one build session.
Acceptance intent (over MCP):
Run templates/minimax/repair-segment with chain_take set to an output: of a take that a repair already produced. The job fails in the cut step, before any H3 render starts. Its error says the take is a repair output, names its (repaired) shot, says it cannot be repaired again, and points to the original take or a re-render. It must not say "pass 'chain_output'".
The same run with chain_output (one of the original chain's segment files) added fails the same way.
The original take still repairs as before.
A run whose smallest fitting render is over 345 frames fails naming the 345 ceiling.
Stage A is blocked by #1207 (and through it #1199): it edits chain_repair.py, which #1207 has pending verification. If #1207 fails verification and is reworked, stage A builds on the reworked code. If repair-segment is withdrawn, stage A goes with it.
Risks
Suffix detection. A chain whose own segment is named … (repaired) would be refused. Chain shot names come from the segment list. This is unlikely, and the refusal says why, so it is accepted.
Wording. A wording change to the template description could break COMPACT_BUDGET. Keep it the same length or shorter.
Questions
Q1 [none] Fold the "past 345" wording of the span-1 num_frames message into stage A. Default: yes, it is the same function. If otherwise: stage A is the refusal only, and that wording waits for a separate fix.
Q2 [none] Detect a repair output by the (repaired) suffix the splice writes, not by a new repaired shot key. Default: the suffix. If otherwise: a new shot key, with its documentation in dw/shots.py. That is about $1 more, and gives a sturdier signal.
Decision for Don: build only the clear "a repaired take cannot be repaired again" refusal (stage A, after #1207 verifies), and leave span-2 repair unbuilt until a spilled break gets past cut_ratio. Kind: none (build smaller) Default: stage A as above; span 2 is not built. If otherwise: "build span 2" makes this a scope plan. I add a span-2 stage (about $5-8, one template variable, a VRAM measurement) for review in the blocking lane. Reversible: yes
Reply in comments and hand back with owner:lead. Approve by adding status:plan-approved yourself. No agent may set it.
Don's ruling: park. The plan's stage A (the second-repair refusal) folds into #1207, which the implementer already has for the same chain_repair_cut message. No lead stage. Span-2 repair stays unbuilt. Trigger to revisit: a break spills into segment k+1 on a real take despite cut_ratio, or repair-segment gets real (non-bench) use.
— recorded from Don's Claude Code session (model claude-opus-5-5 via provider anthropic)
Activity
dkackman commentedon Nov 7, 2026
Plan for #1231, by model
claude-opus-5-5via provideranthropic. Design at developf25446b4.Verdict: build smaller
Build only the clear refusal for a second repair of a repaired take. Do not build the two-segment repair (span 2) yet.
Value.
chk-s3-seg4-broken(bench/records/repair.mdBy eye).cut_ratioexisted.cut_ratio(d37c3192) was added to stop a break at segment k, before its tail becomes the next guide. That is the prevention this repair would clean up after.field-reportissue mentions repair.repair-segmenthas no real use. All of its runs are the bench's (Long-form media: one playbook, measured levers, quality-first defaults for pieces longer than one clip #1199). None of the last 100 jobs is a repair. No workspace of Don's has one.repair-segmentitself (#1199 stage 6: repair one chain segment in place #1207, Long-form media: one playbook, measured levers, quality-first defaults for pieces longer than one clip #1199 stage 6) is not verified yet.Build cost.
Inertia.
tests/test_catalog_structure.py:578-591);num_framesdefault that is wrong for span 2 (175 against 277), which the caller must override;Reversibility. Stage A is fully reversible. Span 2, once a template variable is named, needs a breaking change to remove.
Cheaper alternatives for a spilled break, all available today:
So re-running is the real alternative. It costs one chain run, about 18 min for 10 segments.
Overlap.
repair-segmentand are pending verification. Stage A edits the same file, so it waits for them.What would bring span 2 back (it stays recorded in this plan's sweep and the draft design below): a field report, or a bench take, where
cut_ratiopassed a break that spilled into k+1 and re-running from k was not acceptable.Sweep (one read-only pass over every consumer)
Engine:
dw/tasks/chain_repair.py. Every geometry and splice function assumes exactly one replaced segment.repair_geometry(:86-160) readssegment_frames[segment-2:segment+1]at:129, so it only ever sees three slots. With a span of 2, the minimum segment count (:108) becomes 4, the range (:113) becomes 2..N-2,shortest(:135) sums both replaced segments, and the tail check (:145) tests segment k+2.chain_repair_cut(:348-461) has three pieces that change::402;following = paths[segment]at:406;:407-433, which read k-1 and k+1 and must read k-1 and k+span.check_take_shots(:327-345) needs a shot at indexsegment+span-1._spliced_track(:555-599) breaks for a span of 2. It readsafter = shots[segment]and blends out at that index._spliced_shots(:602-639) breaks for a span of 2. It would keep the stale shot k+1.:642-671) need the span as a POSITIVE whole number._locate,_named_files,segment_filesand_take_spansare unaffected by the span.Template
workflows/templates/minimax/repair-segment.json.:3-4) say "one bad segment", "2 to N-1" and "cannot be repaired again".num_frames(:62-69) is constrained to 124..345 on 17n+5, default 175.cutstep (:101-116) and thesplicestep (:272-290) would carry the span.Frame math (the 345 ceiling is per template, enforced by
dw/variable_constraints.py). A span of 2 is 22 + 2L + 39 on the grid:VRAM (
repair-segment.json:5-22).Second repair of a repaired take.
_spliced_shots:610stripssegment_filefrom every shot._locate:264-269then raises the generic "shots name no segment files … pass 'chain_output'".chain_outputpassed, the cut fails at:422-431("not the same run's") or atcheck_take_shots("it has none"). A repair far from the span silently uses the original files.(repaired), which_spliced_shots:611-612writes.Tests that pin today's behaviour.
tests/test_chain_repair.py::26-37splice_length;:99,:116and:120(refusal messages);:414and:499(splice shots);:512and:527(no-shots refusals);:592-663(template).tests/test_catalog_structure.py:347,578-591.Docs that state the rule:
docs/TASKS.md:933-1010, including:1009-1010"a repaired take cannot be repaired again";docs/WORKFLOW_GUIDE.md:2689-2702;docs/ARCHITECTURE.md:88;workflows/templates/minimax/README.md:166;plugins/dw/skills/long-form/references/run-and-repair.md:48-80, including:67-75;plugins/dw/skills/long-form/SKILL.md:3,124-128;references/quality-and-speed.md:21.MCP, REST and UI. Nothing names repair-segment or chain_repair.
Problem and non-goals
Problem. A second repair of a repaired take fails with an error that names the wrong cause, and its advice ("pass chain_output") leads somewhere worse.
Non-goals:
num_framesmessage. It is a small separate improvement, folded into stage A only because it lives in the same function (Q1).Design
chain_repair_cut's_locate, before either branch, refuse when the take's shots carry any shot whose name ends in(repaired). That shot is the one_spliced_shotswrites, and only the splice writes that suffix.<take>is a repair output (<shot name>, the splice keeps no segment files) - a repaired take cannot be repaired again. Repair the chain's original take, which still names its segment files, or re-render the chain."chain_takeorchain_outputwas passed, so the misleading fallback is never reached.chain_repair_splicegets the same check through one shared helper, so a hand-built workflow that skips the cut is refused as well.repaired: truerecord was considered and not chosen. It would change the shot record thatdw/shots.pydocuments and the run manifest, for no gain over the suffix the splice already owns. Q2 asks about this.num_framesover the ceiling (Q1). When the smallest render that fits is over 345, the cut says so: "segment k (L frames) with these guides needs N frames, past H3's 345 - lower head_frames/tail_frames". It does not name an N that the template's own constraint would then refuse.ValueErrorbefore the render as today.Stages
Stage A: refuse a second repair by name
dw/tasks/chain_repair.py, used by bothchain_repair_cut(at the top of_locate) andchain_repair_splice;repair_geometry.tests/test_chain_repair.py):chain_take, and again withchain_outputpassed too. In both cases the message names the repaired shot and "cannot be repaired again";docs/TASKS.md:1009-1010;plugins/dw/skills/long-form/references/run-and-repair.md:74-75;repair-segment.json:3description, as a wording change only, in the same token count or fewer (catalog budget).templates/minimax/repair-segmentwithchain_takeset to anoutput:of a take that a repair already produced. The job fails in thecutstep, before any H3 render starts. Its error says the take is a repair output, names its(repaired)shot, says it cannot be repaired again, and points to the original take or a re-render. It must not say "pass 'chain_output'".chain_output(one of the original chain's segment files) added fails the same way.46d9c4f4b1d7's output) is still on lem, the refusals cost no GPU. Otherwise one chain run withkeep_segmentsplus one repair (about 10 min) produces one. The positive case on an original take is the existing #1199 stage 6: repair one chain segment in place #1207 acceptance, which need not be re-run if #1199 stage 6: repair one chain segment in place #1207 has verified.Order and dependencies
Stage A is blocked by #1207 (and through it #1199): it edits
chain_repair.py, which #1207 has pending verification. If #1207 fails verification and is reworked, stage A builds on the reworked code. Ifrepair-segmentis withdrawn, stage A goes with it.Risks
… (repaired)would be refused. Chain shot names come from the segment list. This is unlikely, and the refusal says why, so it is accepted.COMPACT_BUDGET. Keep it the same length or shorter.Questions
num_framesmessage into stage A. Default: yes, it is the same function. If otherwise: stage A is the refusal only, and that wording waits for a separate fix.(repaired)suffix the splice writes, not by a newrepairedshot key. Default: the suffix. If otherwise: a new shot key, with its documentation indw/shots.py. That is about $1 more, and gives a sturdier signal.Decision for Don: build only the clear "a repaired take cannot be repaired again" refusal (stage A, after #1207 verifies), and leave span-2 repair unbuilt until a spilled break gets past
cut_ratio.Kind: none (build smaller) Default: stage A as above; span 2 is not built.
If otherwise: "build span 2" makes this a scope plan. I add a span-2 stage (about $5-8, one template variable, a VRAM measurement) for review in the blocking lane. Reversible: yes
Reply in comments and hand back with
owner:lead. Approve by addingstatus:plan-approvedyourself. No agent may set it.dkackman commentedon Nov 7, 2026
Don's ruling: park. The plan's stage A (the second-repair refusal) folds into #1207, which the implementer already has for the same
chain_repair_cutmessage. No lead stage. Span-2 repair stays unbuilt. Trigger to revisit: a break spills into segment k+1 on a real take despitecut_ratio, orrepair-segmentgets real (non-bench) use.— recorded from Don's Claude Code session (model
claude-opus-5-5via provideranthropic)