Title: fix(webapp): remove unawaited task list metrics promises by claude[bot] · Pull Request #4380 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: fix(webapp): remove unawaited task list metrics promises by claude[bot] · Pull Request #4380 · triggerdotdev/trigger.dev
X Title: fix(webapp): remove unawaited task list metrics promises by claude[bot] · Pull Request #4380 · triggerdotdev/trigger.dev
Description: Requested via Slack thread TaskListPresenter created promises that nothing ever consumed. Two of the three deferred metrics promises it returned had no reader, no await and no .catch(), so when the query behind one of them failed the rejection had nowhere to go. Before / After Before TaskListPresenter.call() returned four things: tasks, activity, runningStats and durations. Its only caller reads tasks and runningStats. Every load of the tasks page therefore fired two ClickHouse queries whose results were thrown away. If either of those two queries failed, the resulting promise rejection was unhandled — nothing was awaiting it and nothing had attached an error handler, so it surfaced as an unhandled rejection at the process level rather than as an error anyone could attribute to a request. After TaskListPresenter.call() returns tasks and runningStats only. Two fewer queries run per tasks-page load. There is no longer an unconsumed promise that can reject without a handler. runningStats is awaited by its caller, so its failures continue to be handled the way they always were. Nothing changes on screen: the tasks page renders hourlyActivity and runningStates, and neither of the removed values fed either of those. How The removed values were verified unreferenced before deleting anything: TaskListPresenter has exactly one caller, UnifiedTaskListPresenter, which reads taskResult.tasks and taskResult.runningStats and nothing else. No file anywhere in the repo — app code, tests, or type re-exports — reads an activity or durations field off the presenter's result. UnifiedTaskListPresenter builds its own unifiedTaskListHourlyActivity query for the 24h chart the page actually renders, which is what made the presenter's separate 7-day daily activity data redundant. getDailyTaskActivity and getAverageDurations on ClickHouseEnvironmentMetricsRepository had no callers other than the two lines being deleted, so they and their now-orphaned helpers and types were removed too. Changes: apps/webapp/app/presenters/v3/TaskListPresenter.server.ts — drop the activity and durations fields (both from the main return and from the no-current-worker early return) and the two repository calls behind them. Drop the unreferenced TaskActivity type alias. The "don't await this" comment on the remaining runningStats promise now spells out that the caller has to consume it. apps/webapp/app/services/environmentMetricsRepository.server.ts — remove getDailyTaskActivity and getAverageDurations from the EnvironmentMetricsRepository interface and its ClickHouse implementation, along with fillInDailyTaskActivity and the DailyTaskActivity / AverageDurations types. getCurrentRunningStats is the control that shows the diagnosis is right. It throws on query failure in exactly the same way as the two removed methods — if (queryError) throw queryError — but it never produced an unhandled rejection, because UnifiedTaskListPresenter passes its promise into a Promise.all(...).then(...) chain that the route then awaits. Same failure mode, opposite outcome, and the only difference is whether anything consumes the promise. Follow-ups, not in this PR: AgentListPresenter returns three sparkline promises in the same shape and they look similarly unconsumed. Left alone here to keep this change reviewable. With these two callers gone, the getTaskActivity and getAverageDurations query builders in @internal/clickhouse have no remaining callers in this repo. Whether to remove them is a separate call for someone who owns that package. ✅ 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 webapp — passes. This is the meaningful check here: it proves nothing still references the removed fields, methods or types. pnpm run format and pnpm run lint:fix — clean, no changes produced. No test file referenced the removed symbols, so no test needed updating. Changelog Server-only change, so this carries a .server-changes/ note rather than a changeset: .server-changes/task-list-remove-unused-metrics-queries.md. The tasks page no longer runs two queries whose results were never displayed, cutting wasted work on every page load and removing a source of hidden server errors Screenshots No visual change — the removed data was never rendered.
Open Graph Description: Requested via Slack thread TaskListPresenter created promises that nothing ever consumed. Two of the three deferred metrics promises it returned had no reader, no await and no .catch(), so when the...
X Description: Requested via Slack thread TaskListPresenter created promises that nothing ever consumed. Two of the three deferred metrics promises it returned had no reader, no await and no .catch(), so when the...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/4380
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:16a78a07-13ac-3e44-bdfb-07c948fc8af2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9EE8:31FFEA:5D884:8496E:6AFAF632 |
| html-safe-nonce | 3e125b1a00932cac8b16e60eb6e5cf3cc7332a2f3df4818f7549069f0639688c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUU4OjMxRkZFQTo1RDg4NDo4NDk2RTo2QUZBRjYzMiIsInZpc2l0b3JfaWQiOiIxNDI4Njg0NDYwMDc2NDk2NDM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a4cad787144c915274c6fba6ff7af7ceb84f7cff3c9de2bcce1c0a7a6ce73d36 |
| hovercard-subject-tag | pull_request:4137311899 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/4380/files |
| twitter:image | https://avatars.githubusercontent.com/in/1236702?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1236702?s=400&v=4 |
| og:image:alt | Requested via Slack thread TaskListPresenter created promises that nothing ever consumed. Two of the three deferred metrics promises it returned had no reader, no await and no .catch(), so when the... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a85e96a83bed7871993e6b1ffda24105928eee17 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width