René's URL Explorer Experiment


Title: fix(media): bound the ffmpeg tool's child processes, inputs and scale targets by icecrasher321 · Pull Request #6989 · simstudioai/sim · GitHub

Open Graph Title: fix(media): bound the ffmpeg tool's child processes, inputs and scale targets by icecrasher321 · Pull Request #6989 · simstudioai/sim

X Title: fix(media): bound the ffmpeg tool's child processes, inputs and scale targets by icecrasher321 · Pull Request #6989 · simstudioai/sim

Description: Problem The copilot ffmpeg tool shells out to FFmpeg in the Sim app process — not in a sandbox (docker/app.Dockerfile installs the binary for exactly this) — and nothing bounded the run. runCommand had no timer, no .kill() and no signal, so a transcode ran until it finished and survived the request that asked for it: a stopped copilot turn left the encode pinning both cores of a shared instance. scale=30000:30000 reached libavfilter unvalidated, which sizes its per-frame buffers from those numbers (~2.7 GB a frame) inside a child that shares the instance's memory. Change Deadline + kill. Every operation shares one 10-minute wall-clock deadline; both the deadline and the caller's cancellation SIGKILL the child. Per-operation rather than per-command, because concat runs a full re-encode per input — a per-command timeout would let N inputs multiply into N timeouts. Cancellation is wired to context.abortSignal. Every abort reason on that controller is an explicit user stop (UserStop / RedisPoller / MarkerObservedAtBodyClose); the copilot lifecycle tracks a passive client disconnect separately as publisher.clientDisconnected and does not abort on it. So an encode dies when the user presses stop and never otherwise. Worth flagging separately: userStopSignal, which the existing assertServerToolNotAborted calls read, is declared on ServerToolContext but never populated — createServerToolHandler forwards only abortSignal, and ToolExecutionContext has no such field. Those assertions are currently no-ops on this path. Left alone here; abortSignal is the signal that actually arrives. ffprobe had the same shape in miniature. fluent-ffmpeg's static ffprobe hands back no process handle, so a timeout could only race the callback and leave a wedged prober alive — and concat probes once per input, so the leak scaled with the request. Now runs through execFile, which takes timeout, killSignal and signal natively. Scale targets are rejected outside 16–4096 with a message the model can act on, plus an area cap. concat's targets come from the source container rather than a caller assertion, so those are clamped instead of rejected. Two holes not in the original report: readOut buffered the output with no ceiling (CRF-18 re-encodes routinely exceed their input, so the input budget did not bound it), and the handler accepted unlimited input files. Both capped; the byte check now runs against the recorded size before the download rather than after. Single source of truth FFMPEG_LIMITS holds the four numbers the Go tool catalog mirrors into its schema, pinned by ffmpeg-schema-parity.test.ts. Without it, changing a limit here would leave the model reading a stale ceiling off its own schema — silent, and user-visible as "the tool said 4096 but refused at 2048". Verified non-vacuous: flipping maxInputFiles to 21 and maxScaleDimension to 2048 fails it on exactly those assertions. Scope note on the generated bindings Regenerating the catalog the obvious way pulls in load_slide_layout, an unrelated tool from copilot 7e741a39 (house deck system / slide-layout library) that this branch has not synced. The bindings here were generated from the copilot commit these files already matched, plus only this change — proven by first regenerating from the unmodified baseline contract and confirming a byte-identical match with the committed files. The diff touches exactly Ffmpeg, GenerateAudio, GenerateImage, GenerateVideo; zero slide-layout leakage. That feature syncs whenever someone brings it over. Verification tsc --noEmit, lint:check, 2586 tests across lib/copilot + lib/media + lib/uploads + lib/workspace-files, and check:api-validation / boundaries / client-boundary / utils — all pass, rebased onto latest staging (which includes #6986's provenance change to this same file). Companion Companion: https://github.com/simstudioai/mothership/pull/447 That PR carries the schema side — the tool-catalog wording and the maxItems/minimum/maximum this branch mirrors. Merge in lockstep. 🤖 Generated with Claude Code

Open Graph Description: Problem The copilot ffmpeg tool shells out to FFmpeg in the Sim app process — not in a sandbox (docker/app.Dockerfile installs the binary for exactly this) — and nothing bounded the run. runCommand...

X Description: Problem The copilot ffmpeg tool shells out to FFmpeg in the Sim app process — not in a sandbox (docker/app.Dockerfile installs the binary for exactly this) — and nothing bounded the run. runCommand...

Opengraph URL: https://github.com/simstudioai/sim/pull/6989

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6485b17d-7d99-206b-0aae-ce4d3c717680
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC840:19FA2E:8140AE:B79B7E:6AFB4C88
html-safe-nonce8fb58d2e429515c67c86a0e3c8ea7bc34531675bc17464416589a712742fc949
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODQwOjE5RkEyRTo4MTQwQUU6Qjc5QjdFOjZBRkI0Qzg4IiwidmlzaXRvcl9pZCI6IjM1MTk4MTU5NTQyODM0MjkyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdff5e4bbc2858a7108e3cded9ccab1bd75393cb6ca62633b59e4861fe0267f38
hovercard-subject-tagpull_request:4339984502
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6989/files
twitter:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
og:image:altProblem The copilot ffmpeg tool shells out to FFmpeg in the Sim app process — not in a sandbox (docker/app.Dockerfile installs the binary for exactly this) — and nothing bounded the run. runCommand...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26504db649b58525278f77a52b80ba5f10d5f4de
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6989/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6989%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6989%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6989/files
Reloadhttps://github.com/simstudioai/sim/pull/6989/files
Reloadhttps://github.com/simstudioai/sim/pull/6989/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
icecrasher321https://github.com/icecrasher321
staginghttps://github.com/simstudioai/sim/tree/staging
fix/ffmpeg-tool-execution-boundshttps://github.com/simstudioai/sim/tree/fix/ffmpeg-tool-execution-bounds
Conversation 21 https://github.com/simstudioai/sim/pull/6989
Commits 3 https://github.com/simstudioai/sim/pull/6989/commits
Checks 30 https://github.com/simstudioai/sim/pull/6989/checks
Files changed https://github.com/simstudioai/sim/pull/6989/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
fix(media): bound the ffmpeg tool's child processes, inputs and scale targets https://github.com/simstudioai/sim/pull/6989/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/6989/files
f1726e1 fix(media): bound the ffmpeg tool's child processes, inputs and scale… Aug 22, 2026 https://github.com/simstudioai/sim/pull/6989/commits/f1726e1895a6400e12eb6cf85ff7407525b02317
627509f fix(media): fit concat inside the shared area budget and stop input p… Aug 22, 2026 https://github.com/simstudioai/sim/pull/6989/commits/627509fbb4b741a820fd7ad26b3b54da3bc19c55
0dee35b fix(media): floor the scaled concat axes so the area bound actually h… Aug 22, 2026 https://github.com/simstudioai/sim/pull/6989/commits/0dee35bbb44570d61500b544e313504587e162d0
Clear filters https://github.com/simstudioai/sim/pull/6989/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
tool-catalog-v1.ts https://github.com/simstudioai/sim/pull/6989/files#diff-b3b12f017d88432c4850c81911367dad8977f2cc16cddf567d9c5b12ba31b1b9
tool-schemas-v1.ts https://github.com/simstudioai/sim/pull/6989/files#diff-d6bbefc705a9a562b6c1fbf9721f8653c610e12436e493f01dbd7a2895ebaa66
ffmpeg.test.ts https://github.com/simstudioai/sim/pull/6989/files#diff-23c65b14e0c27a9e41070e0d872ac2edbf0dada17c31f57826f72002a45d5de0
ffmpeg.ts https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
ffmpeg-limits.ts https://github.com/simstudioai/sim/pull/6989/files#diff-fb057145774cee72b7d264f638b6e3c6c295c243900825ffd12ac2e7fa3a6caa
ffmpeg-schema-parity.test.ts https://github.com/simstudioai/sim/pull/6989/files#diff-554ddf00d8415f6428e051f90f87e904748138934014f5b593c6bc42180a09ba
ffmpeg.test.ts https://github.com/simstudioai/sim/pull/6989/files#diff-84d6454b1747ffe231fb651f9c2f250ca9c9ffca1b44c177c5c5930d7f68bc1e
ffmpeg.ts https://github.com/simstudioai/sim/pull/6989/files#diff-4cb239d09c65948f5097877c0984c0a2063556969163ff7c4316dd2de35ca7a9
apps/sim/lib/copilot/generated/tool-catalog-v1.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-b3b12f017d88432c4850c81911367dad8977f2cc16cddf567d9c5b12ba31b1b9
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/copilot/generated/tool-catalog-v1.ts
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
apps/sim/lib/copilot/generated/tool-schemas-v1.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-d6bbefc705a9a562b6c1fbf9721f8653c610e12436e493f01dbd7a2895ebaa66
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/copilot/generated/tool-schemas-v1.ts
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
apps/sim/lib/copilot/tools/server/media/ffmpeg.test.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-23c65b14e0c27a9e41070e0d872ac2edbf0dada17c31f57826f72002a45d5de0
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/copilot/tools/server/media/ffmpeg.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6989/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6989/files#diff-23c65b14e0c27a9e41070e0d872ac2edbf0dada17c31f57826f72002a45d5de0
apps/sim/lib/copilot/tools/server/media/ffmpeg.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/copilot/tools/server/media/ffmpeg.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6989/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
https://github.com/simstudioai/sim/pull/6989/files#diff-8030aed9f9ee7d0778e55efbb00341798ef0d1d628947d81e23d2419093a40bd
apps/sim/lib/media/ffmpeg-limits.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-fb057145774cee72b7d264f638b6e3c6c295c243900825ffd12ac2e7fa3a6caa
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/media/ffmpeg-limits.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6989/{{ revealButtonHref }}
apps/sim/lib/media/ffmpeg-schema-parity.test.tshttps://github.com/simstudioai/sim/pull/6989/files#diff-554ddf00d8415f6428e051f90f87e904748138934014f5b593c6bc42180a09ba
View file https://github.com/simstudioai/sim/blob/0dee35bbb44570d61500b544e313504587e162d0/apps/sim/lib/media/ffmpeg-schema-parity.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6989/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6989/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.