René's URL Explorer Experiment


Title: fix(media): bill a completed fal generation even when a Stop ends its download by waleedlatif1 · Pull Request #9106 · simstudioai/sim · GitHub

Open Graph Title: fix(media): bill a completed fal generation even when a Stop ends its download by waleedlatif1 · Pull Request #9106 · simstudioai/sim

X Title: fix(media): bill a completed fal generation even when a Stop ends its download by waleedlatif1 · Pull Request #9106 · simstudioai/sim

Description: Summary A Stop or deadline that landed after fal completed a generation (during the media download or the cost lookup) threw before recordServiceCost ran, so a generation fal charged for was never billed. The cost lookup and the download both took the caller's abort signal, and the cost was recorded only after both. generateFalAudio / generateFalVideo now take an onCost recorder and bill through it once fal has returned the result, before the download that a Stop can still end. The mothership audio/video tools wire onCost to recordServiceCost inside the meter scope and no longer record afterwards, so each generation is billed exactly once. The cost lookup no longer takes the caller's signal. getFalAICostMetadata now has its own 10s bound (via the existing withinDeadline), and past it the fallback floor is billed instead of nothing. A Stop during the lookup waits at most that bound, then the generation fails without downloading. No change for requests stopped before fal completes them (cancelled, nothing billed) or for completions whose result fetch fails. Type of Change Bug fix Testing lib/media/falai.test.ts runs the real queue, pricing and download path with stubbed fal HTTP. It covers a Stop during the download after completion (audio and video, billed once), a Stop during the cost lookup (lookup finishes, billed once, no download), a lookup that hangs (floor billed once at the bound), the success path (billed exactly once), and a Stop before completion (cancelled, nothing billed). The first four fail on staging. model-boundaries.test.ts: the tools bill once through onCost even when the generation then fails. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary A Stop or deadline that landed after fal completed a generation (during the media download or the cost lookup) threw before recordServiceCost ran, so a generation fal charged for was never...

X Description: Summary A Stop or deadline that landed after fal completed a generation (during the media download or the cost lookup) threw before recordServiceCost ran, so a generation fal charged for was never...

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

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:7b07c202-0f71-99a4-7738-f693c91735f3
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id94EC:37EBB:883FBA:C155DB:6AFB4F78
html-safe-nonce4282e63f7b1ed838d4755c6789d62740049a991a2d480539450ef562b27d19c5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEVDOjM3RUJCOjg4M0ZCQTpDMTU1REI6NkFGQjRGNzgiLCJ2aXNpdG9yX2lkIjoiNzgxNTE4MTE4ODYxOTUyMTkxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac30f4d2a1380ad0e9bac6273fdde1ec859a4d51910f50dd8151a660c7f5f7e231
hovercard-subject-tagpull_request:4882798543
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/9106/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary A Stop or deadline that landed after fal completed a generation (during the media download or the cost lookup) threw before recordServiceCost ran, so a generation fal charged for was never...
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/9106/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9106%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%2F9106%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/9106/files
Reloadhttps://github.com/simstudioai/sim/pull/9106/files
Reloadhttps://github.com/simstudioai/sim/pull/9106/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
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/fal-cost-after-aborthttps://github.com/simstudioai/sim/tree/fix/fal-cost-after-abort
Conversation 18 https://github.com/simstudioai/sim/pull/9106
Commits 4 https://github.com/simstudioai/sim/pull/9106/commits
Checks 52 https://github.com/simstudioai/sim/pull/9106/checks
Files changed https://github.com/simstudioai/sim/pull/9106/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/files
fix(media): bill a completed fal generation even when a Stop ends its download https://github.com/simstudioai/sim/pull/9106/files#top
Show all changes 4 commits https://github.com/simstudioai/sim/pull/9106/files
ae6f73f fix(media): bill a completed fal generation even when a Stop ends its… waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9106/commits/ae6f73f7a2f9bf3b33eccc1734b2236ad97cb5bf
3ebc3dd fix(media): use fake-clock gates in fal billing tests waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9106/commits/3ebc3ddd2a25be387692678b88f583dbdb7d2108
91bebd8 fix(media): bill a completed fal generation whose result has no media… waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9106/commits/91bebd8f04fd86cb8ab59b397518e01b8966ce0e
6020163 fix(media): bill the fal floor when the pricing estimate body is unre… waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9106/commits/60201638e702e16942784a2a27aa9d354b380c1a
Clear filters https://github.com/simstudioai/sim/pull/9106/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/files
falai-audio.ts https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
falai-video.ts https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
falai.test.ts https://github.com/simstudioai/sim/pull/9106/files#diff-877f7081cfb1235e890b96aca58d2202e5bfc19b2965140ab15bfd4e624cb60f
falai.ts https://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
generate-audio.ts https://github.com/simstudioai/sim/pull/9106/files#diff-3e3a066155517b7cc494ebfe01c36acbd2b76d01668e54d398a56c62733b17d7
generate-video.ts https://github.com/simstudioai/sim/pull/9106/files#diff-6b1eba7743f92e8a30c890523faa24ac801e5704df4a11eeca90187b3bdb0afd
model-boundaries.test.ts https://github.com/simstudioai/sim/pull/9106/files#diff-caf0ae31ed7b76089b52cd616aa9e68808c6e195e5099ff7ace57861ad35aae3
falai-pricing.test.ts https://github.com/simstudioai/sim/pull/9106/files#diff-0dbf67ba27b4d6c3da7cc06f9cc5875ee4564aad946974844ec6ec2758043138
falai-pricing.ts https://github.com/simstudioai/sim/pull/9106/files#diff-d07c955c37d9f1d8634c42a47c6be4e5d781a8556733d154ad756b5c0790bf4f
apps/sim/lib/media/falai-audio.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/media/falai-audio.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
https://github.com/simstudioai/sim/pull/9106/files#diff-81aaeaeff54ed6522195f74bf31322906c8a5ccc3d9550b7110ebfe73ec383ad
apps/sim/lib/media/falai-video.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/media/falai-video.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
https://github.com/simstudioai/sim/pull/9106/files#diff-248b25b56fcae12a9ac859c3803ea07aa890e868ae254bd151c6ea396f865d40
apps/sim/lib/media/falai.test.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-877f7081cfb1235e890b96aca58d2202e5bfc19b2965140ab15bfd4e624cb60f
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/media/falai.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-877f7081cfb1235e890b96aca58d2202e5bfc19b2965140ab15bfd4e624cb60f
https://github.com/simstudioai/sim/pull/9106/files#diff-877f7081cfb1235e890b96aca58d2202e5bfc19b2965140ab15bfd4e624cb60f
https://github.com/simstudioai/sim/pull/9106/files#diff-877f7081cfb1235e890b96aca58d2202e5bfc19b2965140ab15bfd4e624cb60f
apps/sim/lib/media/falai.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/media/falai.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
https://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
https://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/files
https://github.com/simstudioai/sim/pull/9106/files#diff-c077a3538059a85cadfbb40e3e8ca623a7ddf7a2a87dce07d59357130ebda678
apps/sim/lib/mothership/tools/server/media/generate-audio.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-3e3a066155517b7cc494ebfe01c36acbd2b76d01668e54d398a56c62733b17d7
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/mothership/tools/server/media/generate-audio.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-3e3a066155517b7cc494ebfe01c36acbd2b76d01668e54d398a56c62733b17d7
https://github.com/simstudioai/sim/pull/9106/files#diff-3e3a066155517b7cc494ebfe01c36acbd2b76d01668e54d398a56c62733b17d7
apps/sim/lib/mothership/tools/server/media/generate-video.tshttps://github.com/simstudioai/sim/pull/9106/files#diff-6b1eba7743f92e8a30c890523faa24ac801e5704df4a11eeca90187b3bdb0afd
View file https://github.com/simstudioai/sim/blob/60201638e702e16942784a2a27aa9d354b380c1a/apps/sim/lib/mothership/tools/server/media/generate-video.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9106/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9106/files#diff-6b1eba7743f92e8a30c890523faa24ac801e5704df4a11eeca90187b3bdb0afd
https://github.com/simstudioai/sim/pull/9106/files#diff-6b1eba7743f92e8a30c890523faa24ac801e5704df4a11eeca90187b3bdb0afd
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9106/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.