René's URL Explorer Experiment


Title: fix(cron): bind stale async-job cutoffs through the column encoder by waleedlatif1 · Pull Request #6327 · simstudioai/sim · GitHub

Open Graph Title: fix(cron): bind stale async-job cutoffs through the column encoder by waleedlatif1 · Pull Request #6327 · simstudioai/sim

X Title: fix(cron): bind stale async-job cutoffs through the column encoder by waleedlatif1 · Pull Request #6327 · simstudioai/sim

Description: Summary The stale-processing predicate in cleanup-stale-executions interpolated Date values directly into a raw sql template. A raw template carries no column context, so drizzle skips PgTimestamp.mapToDriverValue (which stringifies via toISOString) and postgres-js receives a Date it cannot serialize under the pools' prepare: false / fetch_types: false options Bind both cutoffs with sql.param(date, column), matching the workflow sweep already doing this on line 153 of the same handler The testing sql mock already rejected sql.param(date) for exactly this reason but not the interpolated form that shipped — extended it to cover both Evidence Every run of the job has failed its async-job sweep since v0.7.59, while the surrounding typed lt(column, date) sweeps in the same request succeed: 10:00:35.240 Stale execution cleanup completed <- lt(column, date) OK 10:00:35.287 Failed to clean up stale async jobs <- raw sql`…${date}` FAIL 10:00:35.431 Deleted 57 old async jobs <- lt(column, date) OK New: zero CleanupStaleExecutions errors in 7 days of logs before today; first at 09:00:35 UTC, the first run after the release cut over at 08:42:45 Deterministic: 4/4 invocations since onset failed, every one immediately after its Starting stale execution cleanup job line Not data or environment: the identical predicate returns cleanly when run read-only with now() substituted; async_jobs has zero processing rows Impact: stuck async jobs are never reaped, so job slots leak and executions stay running indefinitely. Type of Change Bug fix Testing bunx vitest run app/api/cron — 15 passing. Reverting the fix with the mock guard in place fails 3 existing tests, so the regression is covered without new test code. Full suite (20,200 tests) shows no other route binding a bare Date into a sql template; the 5 unrelated failures reproduce on clean origin/staging. Lint 23/23 and typecheck clean. 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) ⚠️ Correction (post-merge) Independent verification after merge found two errors in the description above. The fix itself is correct and confirmed (reproduced locally against the real stack), but the recorded rationale is wrong: The stated mechanism is wrong. This is not caused by the pools' prepare: false / fetch_types: false options — a 2×2 matrix test proved those are irrelevant. The actual cause is drizzle() overwriting client.options.serializers for temporal OIDs. The sql.param(date, column) fix is still the right one; only the explanation was incorrect. The fix is incomplete, and the mock guard does not prove otherwise. Five further live instances of the same bug exist, one introduced in the same commit and release as the site fixed here. The claim that the full suite proved no other instances is false: the database.mock.ts guard only fires on paths tests actually execute, and 26 test files override the drizzle-orm mock — two of the missed sites have passing tests. Realized production impact was effectively zero. No jobs happened to get stuck during the ~9.5-hour window. The bug was real and deterministic, but caused no measurable harm. A follow-up PR addresses the remaining instances, corrects the misleading comment in packages/testing/src/mocks/database.mock.ts, and replaces the mock guard with a repo-wide detector that covers untested and mock-overriding code.

Open Graph Description: Summary The stale-processing predicate in cleanup-stale-executions interpolated Date values directly into a raw sql template. A raw template carries no column context, so drizzle skips PgTimestamp...

X Description: Summary The stale-processing predicate in cleanup-stale-executions interpolated Date values directly into a raw sql template. A raw template carries no column context, so drizzle skips PgTimestamp...

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

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:24d295bf-b3f2-e6d1-39f1-bd8ce6702f78
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA968:2C34A2:2754B3:371D03:6AFB528B
html-safe-noncebc9cf8d33404e2674f6464bc98668c907412521efad35fcd91f4a3e9460af212
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTY4OjJDMzRBMjoyNzU0QjM6MzcxRDAzOjZBRkI1MjhCIiwidmlzaXRvcl9pZCI6IjcxODM4ODk1OTEwMzAyMDcxMTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac43dc35b133b8b8770a4c46d88f6b39f3db34ddd2642552e1073dff0c1590be0a
hovercard-subject-tagpull_request:4220256849
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/6327/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 The stale-processing predicate in cleanup-stale-executions interpolated Date values directly into a raw sql template. A raw template carries no column context, so drizzle skips PgTimestamp...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
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
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6327/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6327%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%2F6327%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/6327/files
Reloadhttps://github.com/simstudioai/sim/pull/6327/files
Reloadhttps://github.com/simstudioai/sim/pull/6327/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/cleanup-cron-timestamp-bindinghttps://github.com/simstudioai/sim/tree/fix/cleanup-cron-timestamp-binding
Conversation 3 https://github.com/simstudioai/sim/pull/6327
Commits 1 https://github.com/simstudioai/sim/pull/6327/commits
Checks 30 https://github.com/simstudioai/sim/pull/6327/checks
Files changed https://github.com/simstudioai/sim/pull/6327/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6327/files
fix(cron): bind stale async-job cutoffs through the column encoder https://github.com/simstudioai/sim/pull/6327/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/6327/files
1715c79 fix(cron): bind stale async-job cutoffs through the column encoder waleedlatif1 Aug 6, 2026 https://github.com/simstudioai/sim/pull/6327/commits/1715c79c9c887ee6e5517fd48a1d73503416478f
Clear filters https://github.com/simstudioai/sim/pull/6327/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6327/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6327/files
route.ts https://github.com/simstudioai/sim/pull/6327/files#diff-3c5077959e4545be2034b5b99e76849a74f2d3bd0e41e546514214def8fe3563
database.mock.ts https://github.com/simstudioai/sim/pull/6327/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
apps/sim/app/api/cron/cleanup-stale-executions/route.tshttps://github.com/simstudioai/sim/pull/6327/files#diff-3c5077959e4545be2034b5b99e76849a74f2d3bd0e41e546514214def8fe3563
View file https://github.com/simstudioai/sim/blob/1715c79c9c887ee6e5517fd48a1d73503416478f/apps/sim/app/api/cron/cleanup-stale-executions/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6327/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6327/files#diff-3c5077959e4545be2034b5b99e76849a74f2d3bd0e41e546514214def8fe3563
https://github.com/simstudioai/sim/pull/6327/files#diff-3c5077959e4545be2034b5b99e76849a74f2d3bd0e41e546514214def8fe3563
packages/testing/src/mocks/database.mock.tshttps://github.com/simstudioai/sim/pull/6327/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
View file https://github.com/simstudioai/sim/blob/1715c79c9c887ee6e5517fd48a1d73503416478f/packages/testing/src/mocks/database.mock.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6327/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6327/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
https://github.com/simstudioai/sim/pull/6327/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
Please reload this pagehttps://github.com/simstudioai/sim/pull/6327/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.