René's URL Explorer Experiment


Title: fix(clickhouse): add execution time cap to task run metrics queries by claude[bot] · Pull Request #4381 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: fix(clickhouse): add execution time cap to task run metrics queries by claude[bot] · Pull Request #4381 · triggerdotdev/trigger.dev

X Title: fix(clickhouse): add execution time cap to task run metrics queries by claude[bot] · Pull Request #4381 · triggerdotdev/trigger.dev

Description: Requested via Slack thread Two of the task run metrics queries are registered with no clickhouseSettings, so they have no server-side max_execution_time — nothing tells ClickHouse to give up on them. Their sibling in the same object literal already has one. Before / After Before getTaskActivity and getAverageDurations were registered as getTaskActivityQueryBuilder(this.reader) and getAverageDurations(this.reader) — no settings argument, so no execution cap reached the server. The only bound on a slow one of these was the client's request_timeout. That is a client-side abort of the HTTP request, not a cancellation of the query: it tears down the socket after 30s and the caller gets an untyped socket timeout, with no indication of which query ran long or why. Whether the query itself stopped depended on ClickHouse noticing the dropped connection rather than on an explicit limit. After Both queries carry max_execution_time: 25. A query that runs long is terminated by ClickHouse itself at 25s and comes back as a real ClickHouse timeout error — typed, attributable to a named query, and raised before the client would have aborted. Queries that complete normally are entirely unaffected. How One-line change on each of the two registrations in internal-packages/clickhouse/src/index.ts: getTaskActivity: getTaskActivityQueryBuilder(this.reader, { max_execution_time: 25 }), getAverageDurations: getAverageDurations(this.reader, { max_execution_time: 25 }), Both builders already accepted an optional settings?: ClickHouseSettings second argument and forwarded it to ch.query({ ..., settings }), so no signature or plumbing changes were needed. Why 25 and not 10 The neighbouring existsQueryBuilder uses { max_execution_time: 10 }, but copying that value here would be a behaviour regression rather than a safeguard: any of these metrics queries that currently completes in the 10–30s window would start failing where today it succeeds. A cap that newly breaks working queries is worse than the problem it fixes. 25s was picked to sit just under the client timeout, verified rather than assumed: internal-packages/clickhouse/package.json depends on @clickhouse/client: ^1.12.1, resolved to 1.12.1 in pnpm-lock.yaml. That version's own config default is request_timeout: config.request_timeout ?? 30000 (@clickhouse/client-common/dist/config.js), i.e. 30s. request_timeout is not set anywhere in this repo — createClient in src/client/client.ts passes keep_alive, http_agent, compression, max_open_connections, clickhouse_settings and log, and nothing else — so the 30s default is what's in effect. So 25s is comfortably above normal latency for these queries, and comfortably below the 30s point at which the client would abort. The server wins the race, which is the whole point: ClickHouse enforces the limit and returns a typed error naming the query, instead of the client blindly tearing down a request. For reference, the repo already treats this as the pattern elsewhere — queryService.server.ts sets max_execution_time from QUERY_CLICKHOUSE_MAX_EXECUTION_TIME, and the logs client sets it from CLICKHOUSE_LOGS_LIST_MAX_EXECUTION_TIME. These two registrations were simply missed. One thing worth flagging for review: the client does set cancel_http_readonly_queries_on_client_close: 1, so on a clean socket teardown ClickHouse will usually cancel the query anyway. That mitigates the wasted-work half of the problem but not the error-quality half, and it makes termination contingent on connection handling rather than on an explicit server-side limit. An explicit cap is the more reliable of the two. Deliberately out of scope: the status skip-index / FINAL question on task_runs_v2. That is schema work and needs a schema owner; this PR is only the missing per-query cap. ✅ Checklist I have followed every step in the contributing guide The PR title follows the convention. I ran and tested the code works Testing pnpm run typecheck --filter @internal/clickhouse — passes. pnpm run typecheck --filter webapp — passes (the webapp is the consumer of these two registrations). pnpm run format and pnpm run lint:fix — clean, no changes produced. The client-timeout default was read out of the installed @clickhouse/client-common rather than assumed, and the repo was checked for any request_timeout override (there is none). Changelog Server-only change, so this carries a .server-changes/ note rather than a changeset: .server-changes/task-run-metrics-query-time-limit.md. Task metrics that take too long to load now stop with a clear error instead of hanging until the request gives up Screenshots No visual change. Generated by Claude Code

Open Graph Description: Requested via Slack thread Two of the task run metrics queries are registered with no clickhouseSettings, so they have no server-side max_execution_time — nothing tells ClickHouse to give up on the...

X Description: Requested via Slack thread Two of the task run metrics queries are registered with no clickhouseSettings, so they have no server-side max_execution_time — nothing tells ClickHouse to give up on the...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/4381

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:e99f22a5-6b52-ee94-470f-52a53fd2b240
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDCC2:1C3CF5:860D1A:C67D1F:6AFAFB65
html-safe-nonce6a48da8bb20c0c4cec8a5b97d3f76c6e8f6adce67461d58ea0321fb366a48c27
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0MyOjFDM0NGNTo4NjBEMUE6QzY3RDFGOjZBRkFGQjY1IiwidmlzaXRvcl9pZCI6IjMxOTA0NzczOTkxOTU4NDM0MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb26ad2e6e9c2bb7061e4094cd9e041b80f8ebe601753b7a1cf2dce003c4365b1
hovercard-subject-tagpull_request:4137326534
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/triggerdotdev/trigger.dev/pull/4381/files
twitter:imagehttps://avatars.githubusercontent.com/in/1236702?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/1236702?s=400&v=4
og:image:altRequested via Slack thread Two of the task run metrics queries are registered with no clickhouseSettings, so they have no server-side max_execution_time — nothing tells ClickHouse to give up on the...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None54f7a6886649661c85eee945cca0773566bfb4065370e0429b7c8f7204184650
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
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
releasecf8450eb633ec589502c42ff6f4072e40db65da3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/4381/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4381%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%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4381%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=triggerdotdev%2Ftrigger.dev
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests67 (67)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
claudehttps://github.com/apps/claude
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
fix/clickhouse-task-run-metrics-execution-caphttps://github.com/triggerdotdev/trigger.dev/tree/fix/clickhouse-task-run-metrics-execution-cap
Conversation 2 https://github.com/triggerdotdev/trigger.dev/pull/4381
Commits 1 https://github.com/triggerdotdev/trigger.dev/pull/4381/commits
Checks 40 https://github.com/triggerdotdev/trigger.dev/pull/4381/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/4381/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
fix(clickhouse): add execution time cap to task run metrics queries https://github.com/triggerdotdev/trigger.dev/pull/4381/files#top
Show all changes 1 commit https://github.com/triggerdotdev/trigger.dev/pull/4381/files
27c3205 fix(clickhouse): add execution time cap to task run metrics queries claude Jul 26, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4381/commits/27c32057ebd19acad465a6ff2cd74df18874fee1
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/4381/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4381/files
task-run-metrics-query-time-limit.md https://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-08f1ee993276c071e1805c3cec35dc54291faece4176d4517a2d745bd1a72f29
index.ts https://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-2e6d3213fef546d9f2caf30976ed88b793b2da8ec70f079a4701db7686f00564
.server-changes/task-run-metrics-query-time-limit.mdhttps://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-08f1ee993276c071e1805c3cec35dc54291faece4176d4517a2d745bd1a72f29
View file https://github.com/triggerdotdev/trigger.dev/blob/27c32057ebd19acad465a6ff2cd74df18874fee1/.server-changes/task-run-metrics-query-time-limit.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4381/{{ revealButtonHref }}
internal-packages/clickhouse/src/index.tshttps://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-2e6d3213fef546d9f2caf30976ed88b793b2da8ec70f079a4701db7686f00564
View file https://github.com/triggerdotdev/trigger.dev/blob/27c32057ebd19acad465a6ff2cd74df18874fee1/internal-packages/clickhouse/src/index.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4381/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-2e6d3213fef546d9f2caf30976ed88b793b2da8ec70f079a4701db7686f00564
https://github.com/triggerdotdev/trigger.dev/pull/4381/files#diff-2e6d3213fef546d9f2caf30976ed88b793b2da8ec70f079a4701db7686f00564
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.