From 99c3e89bebf11888cb64cc4869fda7e97df8cb44 Mon Sep 17 00:00:00 2001 From: Z User Date: Fri, 30 Oct 2026 22:40:34 +0000 Subject: [PATCH] Step 5 corrected: internal plan_json widget is the only safe paste surface - ComfyUI frontend dynamic-prompt serializer strips braces from dynamicPrompts:true widgets at queue time (Extra data fingerprint = quoted first key length; probe calibration included) --- README.md | 40 +++++++++++++++++++---------- h3-plan-gate/SKILL.md | 59 ++++++++++++++++++++++++++++++------------- 2 files changed, 69 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 5dc5b54..fb64694 100755 --- a/README.md +++ b/README.md @@ -243,15 +243,21 @@ three six-section shots: exactly the shape the single-pass system prompt emits ( file: `h3_agent_workflow_examples/plan.json`). **7. Render the multi-clip video.** Paste the full contents of `plan.json` into the -Production Plan node's forced STRING input `plan_json_input` and queue **once**. The node -renders each shot as its own clip and chains the clips through the H3 context loop — -scene 2 continues from scene 1's final frames, scene 3 from scene 2's — producing ONE -continuous multi-clip video: 685 delivered frames ≈ 28.5 s at 24 fps (every scene after -the first loses ~1 second to the fixed overlap trim that stitches the clips together). -The `plan_json_input` field must hold exactly this one JSON object — first character `{`, -last character `}`, nothing before or after. If ComfyUI reports -`H3 Chain Plan JSON is invalid: Extra data: …`, the field picked up extra text: clear it -completely and paste once. +Production Plan node's **internal `plan_json` widget** and queue **once** — that widget +is the one paste surface the pack declares `"dynamicPrompts": False`, so the frontend +dynamic-prompt serializer cannot strip the JSON's braces. Disconnect `plan_json_input` +first (a non-empty connected socket silently overrides the widget), select all, delete, +paste, queue. The node renders each shot as its own clip and chains the clips through +the H3 context loop — scene 2 continues from scene 1's final frames, scene 3 from scene +2's — producing ONE continuous multi-clip video: 685 delivered frames ≈ 28.5 s at 24 fps +(every scene after the first loses ~1 second to the fixed overlap trim that stitches the +clips together). The widget must hold exactly this one JSON object — first character +`{`, last character `}`, nothing before or after. If ComfyUI reports +`H3 Chain Plan JSON is invalid: Extra data: line 1 column 16 (char 15)`, the paste went +through a `dynamicPrompts: true` surface (prompt-typed widgets, third-party string nodes +with dynamic prompts) and the frontend ate the braces — the parsed head is just the +plan's quoted first key (`"prompt_prefix"` = 15 chars). Never paste a plan into a +prompt-typed node. Want scene 2 different? Just tell the agent "rewrite scene 2, keep everything else": it rewrites only `scene_02.json`, re-validates it, and re-merges — refreshing `plan.json` @@ -274,10 +280,18 @@ Smoke test with the shipped examples: ### Wiring the result -Paste the full contents of `plan.json` into the Plan node's forced STRING input -**`plan_json_input`** (a non-empty connected value overrides the visual editor's plan for -that run) and queue once — the node's context loop turns the multi-shot plan into one -multi-clip video by itself; no per-scene renders, no editor stitching. Resolution, +Paste the full contents of `plan.json` into the Plan node's internal **`plan_json`** +widget — declared `"dynamicPrompts": False` in the pack source, the one surface where +ComfyUI's frontend dynamic-prompt serializer (which resolves `{a|b}` groups and strips +braces in `dynamicPrompts: true` widgets at queue time) cannot touch the JSON. +Disconnect `plan_json_input` first (a non-empty connected value silently overrides the +widget for that run), select all, delete, paste, and queue once — the node's context +loop turns the multi-shot plan into one multi-clip video by itself; no per-scene +renders, no editor stitching. The `plan_json_input` socket stays for programmatic +delivery (an LLM story director node producing the plan at execution time); a hand +paste through a string node is safe only if that node provably leaves braces alone — +probe it with `{"shots":[{"id":"probe","prompt":["test card"]}]}`: +`Extra data: line 1 column 8 (char 7)` means the node eats braces. Resolution, context length, audio mode, and `base_seed` stay on the node's own widgets (the JSON cannot set them; default canvas is 960×544 — set width/height widgets and wire the width/height outputs into the conditioning node and sampler latent to avoid square diff --git a/h3-plan-gate/SKILL.md b/h3-plan-gate/SKILL.md index 5940c3b..8dcfe85 100755 --- a/h3-plan-gate/SKILL.md +++ b/h3-plan-gate/SKILL.md @@ -181,24 +181,49 @@ failure is reported as `H3 Chain Plan JSON is invalid: `. If the effecti string were exactly the delivered `plan.json` bytes, this parse cannot fail; a reported error always means the field content differs from the file. -Deliver through the external socket, which the visual editor cannot corrupt: add a -multiline STRING node, paste the full contents of `plan.json` into it, wire it into -`plan_json_input`, and queue ONCE. Prefer the single-line variant of the plan file -(`json.dumps(..., separators=(',', ':'), ensure_ascii=True)` — one line, pure ASCII) -so no newline handling, leftover default demo plan, or editor re-serialization can -touch the paste. The internal `plan_json` Raw JSON widget is the fragile path: it -ships with a two-shot demo plan as its default, the visual scene editor serializes -its own edits over it, and a connected `plan_json_input` OVERRIDES it at queue time -(an internal paste into an overridden widget is silently ignored). If that widget is -used anyway: disconnect `plan_json_input` first, select all, delete, confirm the -widget is empty, paste once. +**Paste into the node's internal `plan_json` widget — the only safe hand-paste +surface.** Both Plan nodes declare it `"dynamicPrompts": False` in the pack source +(`chain_nodes.py`), on purpose: ComfyUI's frontend resolves `{option|option}` +dynamic-prompt groups in any widget declared `dynamicPrompts: true` at queue time, +and a plan JSON is dense with braces (the 3-shot example plan carries 5, the +12-shot plan 14). One pass of the frontend serializer strips them, and the node +then reports for a byte-perfect copy: -Either way the effective plan string must contain EXACTLY the one JSON object: first -character `{`, last character `}`, nothing before or after. If ComfyUI still reports -`H3 Chain Plan JSON is invalid: Extra data: line N column M`, the effective string -holds more than the single JSON object — leftover demo or earlier plan text ahead of -the paste, or a duplicated fragment of it. The `line N column M` points at the first -byte of the leftover; ask the user for that exact error text when diagnosing. + H3 Chain Plan JSON is invalid: Extra data: line 1 column 16 (char 15) + +The parsed head is exactly the plan's quoted first key — `"prompt_prefix"` is 15 +characters, so column = length of the quoted first key + 1. That fingerprint means +a dynamic-prompt surface ate the braces; it reproduces on perfect pastes, pipes or +no pipes, and is NOT a copy mistake. The pack's own prompt-typed widgets (e.g. +`MiniMaxH3TaggedReferenceToVideo`'s `prompt`, `dynamicPrompts: True`) and any +third-party string or prompt node with dynamic prompts enabled are all such +surfaces. Never paste a plan into one, and never wire one into `plan_json_input`. + +Internal-widget procedure: disconnect `plan_json_input` first (a non-empty +connected socket silently overrides the widget at queue time), select all, delete, +confirm the widget is empty, paste the full plan, and queue ONCE — before the +visual editor re-serializes anything over it. Prefer the single-line variant of the +plan file (`json.dumps(..., separators=(',', ':'), ensure_ascii=True)` — one line, +pure ASCII) so no newline handling can touch the paste. The widget ships with a +two-shot demo plan as its default: the pasted plan must still contain EXACTLY the +one JSON object, first character `{`, last character `}`, nothing before or after. + +The `plan_json_input` socket is for programmatic delivery — an LLM story director +or other node producing the plan at execution time; socket values flow node-to-node +and skip frontend widget serialization. A hand paste may use the socket only when +the source is a string primitive that provably leaves braces alone. Verify any +surface with one 100-byte probe pasted where the plan would go, then queue: + + {"shots":[{"id":"probe","prompt":["static test card, one red cube on white"]}]} + +A rendered one-shot test card means the surface is clean; `Extra data: line 1 +column 8 (char 7)` (`"shots"` is 7 characters) means it eats braces — deliver +through the internal widget instead. + +A leftover demo or earlier plan AHEAD of the paste also reports `Extra data`, but +only after the whole leftover object parses — its `char N` is far larger than the +plan's first key length. Read the reported `char N` against the first key to tell +brace-eating and leftover-text apart; ask the user for the exact error text. The node renders each shot as its own clip and chains the clips through the H3 context loop — scene 2 continues from scene 1's final frames, scene 3 from scene