Skip to content

fix(skill): stage GSAP locally instead of fetching it from a CDN - #6040

Closed
lab1207 wants to merge 2 commits into
heygen-com:mainfrom
lab1207:fix/6028-stage-gsap-locally
Closed

lab1207 wants to merge 2 commits into
heygen-com:mainfrom
lab1207:fix/6028-stage-gsap-locally

Conversation

@lab1207

@lab1207 lab1207 commented Oct 21, 2026

Copy link
Copy Markdown

Closes #6028

The problem

skills/pr-to-video/scripts/assemble-index.mjs wrote the assembled
index.html with a hardcoded jsDelivr CDN tag for GSAP:

<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js" ...></script>

Every frame's composition registers its paused timeline on window.__timelines,
so if that script never loads no frame animates. On a network that cannot
reach cdn.jsdelivr.net (mainland China routinely resets the connection in
under 300 ms) the whole pipeline still gets through Step 5 — frames built,
check green, snapshots fine — and only the final render comes out wrong. By
then it looks like a frame bug, not a missing library.

It also breaks the repo's own rule: "Deterministic rendering: no render-time
network fetches."

The fix

GSAP is now staged locally and referenced by a relative path.

  • skills/pr-to-video/assets/vendor/gsap.min.js — the library is bundled in
    this skill, the way talking-head-recut already bundles it.
  • assemble-index.mjs copies that copy (or node_modules/gsap/dist/gsap.min.js
    when the skill runs from a checkout) into <project>/assets/vendor/gsap.min.js
    and emits <script src="./assets/vendor/gsap.min.js"></script>.
  • The CDN stays available as an explicit opt-in, --gsap=cdn (default
    local). If no local copy is found at all, the script falls back to the CDN
    and says so on stderr, so the failure is named at assembly time instead
    of surfacing three minutes later as a static render.
  • flag() now accepts both --name value and --name=value, so the
    documented --gsap=cdn spelling works.

Test

Two cases in skills/pr-to-video/scripts/assemble-index.test.mjs:

  • the assembled index.html references ./assets/vendor/gsap.min.js, contains
    no cdn.jsdelivr.net, and the copy it points at is staged next to it;
  • --gsap=cdn still produces the CDN tag.

The test file also resolved the script path with new URL(...).pathname,
which is a POSIX-only spelling — on Windows it produced C:\C:\... and every
test in the file failed to start. It now uses fileURLToPath, which is the
same path on POSIX and a working one on Windows.

How I verified it

$ node --test skills/pr-to-video/scripts/assemble-index.test.mjs
✔ assemble REFUSES while bgm_pending and no bed on disk
✔ --allow-pending-bgm assembles anyway, and says so
✔ a film that is silent BY DESIGN still assembles untouched
﹣ loop-extended bgm is written as .mp3, not .loop.wav, even when the source is a .wav  # SKIP
✔ assembles the GSAP script from a local copy, not the CDN
✔ keeps the CDN when it is asked for explicitly
ℹ tests 6  ℹ pass 5  ℹ fail 0  ℹ skipped 1

The skip is the ffmpeg case (no ffmpeg in this environment).

oxfmt --check and oxlint are clean on both changed files.

Model Used

MiniMax M3.1 Flash Free via the opencode agent harness (minimax-m3.1-flash-free)

gh resolves both the repository and the argument against the local git
context, so \gh pr view owner/repo#N\ reads the whole thing as a branch
name and fails outright outside a git repository - which is the directory
the pr-to-video skill runs the fetch in.

Parse the ref ourselves and pass the number with --repo when the ref names
a repository. A bare number keeps the old behaviour.
Every frame registers its paused timeline on window.__timelines, so a
GSAP that never loads means no frame animates - and on a network that
cannot reach jsDelivr the failure surfaces three minutes later as a
silent static render that looks like a frame bug.

GSAP is now bundled in the skill and staged into the project, the page
references it by a relative path, the CDN stays available behind
--gsap=cdn, and a missing local copy warns at assembly time.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at e29ab918cc2a8b6f39ce5b335388397a15424aff.

The local GSAP staging and explicit CDN opt-in work in the changed scripts, but this head conflicts with main. Please rebase against the current skill layout, keep the PR-reference argument fix separate if needed, and regenerate any affected manifest.

Both exact-head node test files passed, 10 tests total. I did not render the generated composition or audit the vendored minified GSAP against an upstream distribution. No full build or browser acceptance claim.

Need: yes · Size: ok · Reuse: existing helper and dispatch paths · Simpler: keep the focused fix · Structure: fine
Risk: medium - compatibility with current main.

Verdict: COMMENT
Reasoning: The branch currently conflicts with main; I will review the resolved delta after a rebase.

Reasoning: The local GSAP staging and explicit CDN opt-in work in the changed scripts, but this head conflicts with main. Please rebase against the current skill layout, keep the PR-reference argument fix separate if needed, and regenerate any affected manifest.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 14 days, so it is marked stale and will close in 7 days. Push a commit or leave a comment to keep it open. A maintainer can add keep-open to exempt it.

@github-actions github-actions Bot added the stale label Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Closed after 21 days without activity. Reopen it, or open a new PR, whenever you pick it back up.

@github-actions github-actions Bot closed this Nov 21, 2026
@lab1207

lab1207 commented Nov 22, 2026

Copy link
Copy Markdown
Author

Closing the loop on this one rather than rebasing it.

The skills/pr-to-video skill this PR patches was retired upstream in #5651 (feat(skills)!: publish seven knowledge skills aligned with Studio and retire the workflow skills), which merged the same day this branch was cut. skills/pr-to-video no longer exists on main, and the assemble-index / fetch-pr scripts aren't anywhere in the current tree — so there is no rebase target, and the "regenerate any affected manifest" step has no manifest left to regenerate against.

On keeping the PR-reference argument fix separate: that part is #6027, which is a separate PR and doesn't need to be split out here.

@jrusso1020 flagging this so the rebase request isn't left waiting on a branch that can't satisfy it. The staging idea is still sound in principle — vendoring GSAP locally instead of pulling it from a CDN at fetch time — and upstream now has packages/core/src/gsapCdn.ts, packages/cli/src/server/gsapVendor.ts and scripts/ci/inline-gsap.mjs, so the equivalent concern lives in the CLI and core packages now rather than in a retired skill script. If the CDN-vs-local question still applies there, that's worth raising as a fresh change against the current layout.

Leaving this closed as obsolete unless that turns out to be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-to-video: assemble-index.mjs hardcodes the jsDelivr CDN for GSAP (breaks offline / restricted-network renders)

2 participants