René's URL Explorer Experiment


Title: fix(mothership): close abandoned tool meters once instead of alarming every tick by waleedlatif1 · Pull Request #8479 · simstudioai/sim · GitHub

Open Graph Title: fix(mothership): close abandoned tool meters once instead of alarming every tick by waleedlatif1 · Pull Request #8479 · simstudioai/sim

X Title: fix(mothership): close abandoned tool meters once instead of alarming every tick by waleedlatif1 · Pull Request #8479 · simstudioai/sim

Description: Summary Problem. The service-usage replay tick logged Service usage requires reconciliation at ERROR on every tick, in every process, indefinitely. The alarm never cleared and carried no information about which meter was stuck. Root cause. A tool meter row (_tool_execution, cost_usd IS NULL) is opened when a tool starts and closed by finishServiceUsage when it ends. When the process that owns the tool dies mid-execution, nothing ever closes that row. serviceMeteringHealth counted every such row older than 5 minutes, so a single abandoned meter produced a permanent, repeating error. The 5-minute threshold also flagged tools that were still legitimately running under the long-running watchdog. Fix. Replace the health count with closeAbandonedServiceMeters: the replay tick closes open meters older than twice the longest tool watchdog (TOOL_WATCHDOG_LONG_RUNNING_MS), claimed with FOR UPDATE SKIP LOCKED so concurrent ticks close each meter exactly once. A pricing failure keeps its recorded error; otherwise the row records Tool execution never finished. Each closed meter is logged once, at WARN, with its stream, tool call, creation time and reason. Behaviour changes The recurring Service usage requires reconciliation ERROR is gone. Each abandoned meter now yields one WARN line naming its stream and tool call, then never again. Open tool meters older than 2x the longest tool watchdog are marked closed (delivered_at set). Meters younger than that are left alone, so in-flight tools are no longer flagged. Known spend is unaffected: priced usage is stored as separate receipts, which are still claimed and delivered as before. Meters are never delivered to the worker. Test plan service-store.integration.ts (real PostgreSQL 17 + pgvector, migrated with db:migrate): a new case covers an abandoned meter, an abandoned meter with a pricing error, a meter just past the watchdog that must stay open, and a priced receipt that must stay deliverable. Two concurrent closes return each abandoned meter once, a third returns nothing, and the receipt is still claimable. Existing receipt delivery integration case still passes with the health check removed. New integration case fails before the fix and passes after. vitest run lib/mothership/billing (unit) passes. bun run type-check (apps/sim) and Biome pass.

Open Graph Description: Summary Problem. The service-usage replay tick logged Service usage requires reconciliation at ERROR on every tick, in every process, indefinitely. The alarm never cleared and carried no informatio...

X Description: Summary Problem. The service-usage replay tick logged Service usage requires reconciliation at ERROR on every tick, in every process, indefinitely. The alarm never cleared and carried no informatio...

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

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:acb4cf90-3a01-810b-ebb8-249756803e49
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id86E2:205907:9C2AB8:D5F1B0:6AFBD9DA
html-safe-nonce54313985f1600ece6a696c4afdf82bf6e5eb79816b81c0cadf130f35e2ab4315
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkUyOjIwNTkwNzo5QzJBQjg6RDVGMUIwOjZBRkJEOURBIiwidmlzaXRvcl9pZCI6IjU5ODE3NTA5MTgwMTIxOTczMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd6cac46bcd3d72011cb0e99ca53bfe094b17f6ef72c0fed25ee7105350d5f70c
hovercard-subject-tagpull_request:4696551908
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/8479/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 Problem. The service-usage replay tick logged Service usage requires reconciliation at ERROR on every tick, in every process, indefinitely. The alarm never cleared and carried no informatio...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None18742cb872ec73544356e60359266b67aafece70c4ce008042e06227924cdd07
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
release820be804f18e1ef3940bd74a00d41d73d02e2b91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8479/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8479%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%2F8479%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/8479/files
Reloadhttps://github.com/simstudioai/sim/pull/8479/files
Reloadhttps://github.com/simstudioai/sim/pull/8479/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests201 (201)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/service-usage-reconciliation-alarmhttps://github.com/simstudioai/sim/tree/fix/service-usage-reconciliation-alarm
Conversation 19 https://github.com/simstudioai/sim/pull/8479
Commits 2 https://github.com/simstudioai/sim/pull/8479/commits
Checks 31 https://github.com/simstudioai/sim/pull/8479/checks
Files changed https://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
fix(mothership): close abandoned tool meters once instead of alarming every tick https://github.com/simstudioai/sim/pull/8479/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8479/files
03e1761 fix(mothership): close abandoned tool meters once instead of alarming… waleedlatif1 Sep 30, 2026 https://github.com/simstudioai/sim/pull/8479/commits/03e17610eae1a29597a2b30eae9bd21b017e6742
3072df4 fix(mothership): keep a closed tool meter final against a late tool c… waleedlatif1 Sep 30, 2026 https://github.com/simstudioai/sim/pull/8479/commits/3072df4c7031989fd11274149e0b2425bf4e8b3e
Clear filters https://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
service-delivery.ts https://github.com/simstudioai/sim/pull/8479/files#diff-2176a750993a0bff2a374c5d24426508baa7106b89a4051d63ee12c96e047a06
service-store.integration.ts https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
service-store.ts https://github.com/simstudioai/sim/pull/8479/files#diff-99a722ae225924df72836371cd593f3b04eb3fd86c655c35a1256f1ec5b555ee
apps/sim/lib/mothership/billing/service-delivery.tshttps://github.com/simstudioai/sim/pull/8479/files#diff-2176a750993a0bff2a374c5d24426508baa7106b89a4051d63ee12c96e047a06
View file https://github.com/simstudioai/sim/blob/3072df4c7031989fd11274149e0b2425bf4e8b3e/apps/sim/lib/mothership/billing/service-delivery.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8479/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8479/files#diff-2176a750993a0bff2a374c5d24426508baa7106b89a4051d63ee12c96e047a06
https://github.com/simstudioai/sim/pull/8479/files#diff-2176a750993a0bff2a374c5d24426508baa7106b89a4051d63ee12c96e047a06
https://github.com/simstudioai/sim/pull/8479/files#diff-2176a750993a0bff2a374c5d24426508baa7106b89a4051d63ee12c96e047a06
apps/sim/lib/mothership/billing/service-store.integration.tshttps://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
View file https://github.com/simstudioai/sim/blob/3072df4c7031989fd11274149e0b2425bf4e8b3e/apps/sim/lib/mothership/billing/service-store.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8479/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
https://github.com/simstudioai/sim/pull/8479/files#diff-d0519ab7530dddf7e1638f7ba07c8d212f244d5760bf73d260628efe4e74835d
apps/sim/lib/mothership/billing/service-store.tshttps://github.com/simstudioai/sim/pull/8479/files#diff-99a722ae225924df72836371cd593f3b04eb3fd86c655c35a1256f1ec5b555ee
View file https://github.com/simstudioai/sim/blob/3072df4c7031989fd11274149e0b2425bf4e8b3e/apps/sim/lib/mothership/billing/service-store.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8479/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8479/files#diff-99a722ae225924df72836371cd593f3b04eb3fd86c655c35a1256f1ec5b555ee
https://github.com/simstudioai/sim/pull/8479/files#diff-99a722ae225924df72836371cd593f3b04eb3fd86c655c35a1256f1ec5b555ee
https://github.com/simstudioai/sim/pull/8479/files#diff-99a722ae225924df72836371cd593f3b04eb3fd86c655c35a1256f1ec5b555ee
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8479/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.