Repository navigation
fix(cli): keep audio timings when trimming long recordings - #6375
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
miguel-heygen
left a comment
There was a problem hiding this comment.
Independent review of 1e2921603eb26d329690678720290f2bd7f0e53e against 84b63193463bac2e3e7f8500d03fb7da9fbf8846. No blocking finding.
packages/cli/src/audio/analysis/run.ts:105 now computes the same zero-based maximum without expanding every envelope value into an argument. Both the skipped head and retained tail use this helper, so the fix covers either overflow path. The envelope and strict louder-than comparison are unchanged. The added real-FFmpeg tests cover both long sides; the guide's flags match the command handler.
Audited: the three-file diff, preview placement/window construction, probe/decode/retained-margin handling, envelope values, both loudest calls, item-error catch and report output. Empty, zero, NaN/infinity and signed-zero maximum semantics remain equivalent. Other spread sites in analysis/formatting were enumerated; unrelated algorithms are not claimed globally overflow-proof. No new resource acquisition or provider behavior.
Executed independently: Linux Node 24.19.0 source-API processes using real FFmpeg and synthetic low-rate 1802-second WAVs. Both a 1-second skip (long retained tail) and a 1800-second skip (long skipped head) preserve duration/window/moments and the skipped-loudest warning. The exact one-expression baseline mutation returns null measurements and Maximum call stack size exceeded in both cases, despite process exit 0. Quieter/equal/silent-head controls preserve no-warning behavior; silence retains null moments without an item error. Existing esbuild bundles the exact run/analyze/core/parser source; network fetch is forbidden by the harness, with local signal moments explicitly selected. No provider/sign-in/install or product edit.
Hosted execution independently read: CLI job 121359893771 passes run.test.ts's 8 tests; overall 5,923 passed and 90 skipped across 405 passed/6 skipped files. Docs job 121359791318 passes validation and broken-links. Author's separate 8kHz moment timestamps and local 26-test claim remain attributed, not my execution.
Final CI / limits: 49 successful, 16 skipped, one neutral and one running check, no failed check. Fork preview approval is external and was not mutated. No full local workspace-suite, Windows/macOS, live provider or resource-cost improvement claim; the fix still decodes skipped audio.
Verdict: APPROVE
Reasoning: Both argument-overflow paths are removed without changing envelope or warning semantics, and real-FFmpeg baseline/fix controls discriminate the failure. Relevant hosted CLI/docs gates passed; the remaining pending check is not claimed green.
— Magi (desktop-review)
Merge 8 upstream commits (85dcc19..7d6c02f: heygen-com#6418, heygen-com#5273, heygen-com#6245, heygen-com#5593, heygen-com#5447, heygen-com#6415, heygen-com#6373, heygen-com#6375). Keep the fork's Windows-only ci.yml. For cancellableProcess.ts take upstream's heygen-com#5273, which supersedes the fork's own 744a620 port (same StringDecoder design, but the output limit counts raw bytes). Record the batch in docs/DECISIONS.md, mark heygen-com#6373/heygen-com#6375/heygen-com#6415/heygen-com#6418 as merged, and advance the commit watermark to 7d6c02f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
What
Taking a late excerpt from a long recording with
audio --place-at --skip-file-secondscan discard every timing measurement and reportMaximum call stack size exceeded. Keep the measurements and the warning when the skipped audio held the loudest moment.Why
The skipped-peak check passes every 10 ms envelope value to one
Math.maxcall. A 30-minute portion produces 180,000 arguments. Either a long skipped head or a long retained tail can exceed Node's argument limit, and the item then becomes an error even though decoding and measurement succeeded.Same synthetic 1802-second, 8 kHz mono recording, same Node 24 CLI invocation, trimming 1800 seconds and placing the remaining two seconds at film second 4:
null{ "from": 1800, "to": 1802 }null1802onset: 1800,steepest: 1800.006,peak: 1800.008,tailEnd: 1801.999could not read: Maximum call stack size exceededThe linked issue contains the complete synthetic asset and CLI commands. Both versions exit 0; the difference is the item's returned analysis.
Related work
Fixes #6374.
The public searches found no matching report or active implementation. #5793 keeps Studio's beat analysis responsive and changes grade sampling; the CLI's skipped-peak maximum remains separate.
How
Reduce the existing envelope to its maximum rather than spreading it into function arguments. The 10 ms measurement and warning comparison stay the same.
The two real-FFmpeg regression cases cover both sides of the trim. They use low-rate WAVs to keep a 30-minute fixture small. The CLI guide includes the long-recording trim command.
Test plan
Both new regressions fail on unpatched upstream main; six existing run tests pass.
Focused audio tests:
run,targets,analyze, andformat, 26 passed.Manual source CLI reproduction on the synthetic 8 kHz recording, before and after.
Documentation updated.
oxlint, oxfmt, whitespace, comment citations, and comment ratio checks.
CLI typecheck.
Full workspace build on the initial base, followed by core and CLI rebuilds and repeated affected checks on current main
84b631934.Full-site
mint broken-links --check-redirects.mint validatewith the exact changed guide in an isolated one-page docs project. Full-sitemint validatewas terminated with SIGTERM before returning a result.Repository pre-commit checks, including core/Studio/scripts typechecks, fallow audit, CLI process ownership, tracked artifacts, and large-file checks. Commit message passes commitlint.
Local verification uses Linux arm64, Node 24.22.1, Bun 1.4.4 and FFmpeg 7.0.2. No Windows/macOS run or paid service call. The fix still decodes the skipped portion to compare loudness; this does not change that resource cost.