Title: fix(trigger): let workers see that Trigger.dev is available by waleedlatif1 · Pull Request #6869 · simstudioai/sim · GitHub
Open Graph Title: fix(trigger): let workers see that Trigger.dev is available by waleedlatif1 · Pull Request #6869 · simstudioai/sim
X Title: fix(trigger): let workers see that Trigger.dev is available by waleedlatif1 · Pull Request #6869 · simstudioai/sim
Description: Problem isTriggerAvailable() is Boolean(env.TRIGGER_SECRET_KEY) && isTriggerDevEnabled, and isTriggerDevEnabled reads TRIGGER_DEV_ENABLED. That variable is set on the app container but not in the Trigger.dev environment, so the check is false inside every task run — and work a task dispatches silently takes the in-process fallback instead of the queue it was written for. Runtime TRIGGER_DEV_ENABLED isTriggerAvailable() App container TRUE true — dispatches to the queue Trigger.dev worker absent false — dispatchInProcess Document processing is where this surfaced. A connector sync chunks and embeds its own documents at IN_PROCESS_DISPATCH_CONCURRENCY = 5 instead of handing them to knowledge-process-document, so that task's queue concurrency limit, machine, retry policy and duration budget all sit unused, and a sync with thousands of documents runs until it hits its own max duration. Evidence, three independent ways: A connector sync ran the full hour and hit MAX_DURATION_EXCEEDED. Its trace contains "Document dispatch failed" — a string that appears in exactly one place in the codebase, the dispatchInProcess catch block. knowledge-process-document has zero runs for that knowledge base over two days, despite thousands of documents being processed. The flag is read in 17 files, so the same silent downgrade applies to any dispatching path reachable from a task run, table backfills and imports among them. Change Assert the flag for workers via the syncEnvVars extension that already runs there for DB_APP_NAME. Putting it in trigger.config.ts keeps it version-controlled and reviewable rather than being dashboard state that can drift out of agreement with the app again. This is fail-safe. The availability check still requires TRIGGER_SECRET_KEY, which only the Trigger.dev runtime provides. Anywhere dispatching is not actually possible, the flag stays ineffective and behaviour is unchanged — the change cannot enable dispatch in an environment that cannot dispatch. Dispatch failure is also made recoverable. Only a total failure raised before, so a single failed batch left its documents at pending with nothing recording why — invisible until the stuck-document sweep happened to reach them, and never if they aged out of its 7-day window first. Those are now processed in-process instead: it costs the caller the time it hoped to hand to the queue, but the work is not dropped. That path was unreachable from a worker until this change made dispatching happen there, which is why it belongs with it. Risk and how to verify This changes where document processing executes for every connector sync, so it is worth watching rather than assuming: Expected after deploy: knowledge-process-document runs appear for connector-synced knowledge bases, where there are currently none; connector sync runs get much shorter. If dispatching turns out not to work from a worker, the flag stays false and nothing changes — or, if it half-works, the guard above processes the remainder in-process rather than dropping it. Worth confirming on staging first, since it also affects the table paths that gate on the same flag. Also here A comment trim, carried in a second commit rather than its own PR. Both this change's TSDoc and the quota classification's from #6868 explained the incident that motivated the code rather than the code itself — narrative that stops being true as the system moves and misleads instead. Each is cut back to the reason a reader needs; no behaviour change. Verification 632 embedding and knowledge tests pass; 29/29 audits; type-check clean
Open Graph Description: Problem isTriggerAvailable() is Boolean(env.TRIGGER_SECRET_KEY) && isTriggerDevEnabled, and isTriggerDevEnabled reads TRIGGER_DEV_ENABLED. That variable is set on the app container but not ...
X Description: Problem isTriggerAvailable() is Boolean(env.TRIGGER_SECRET_KEY) && isTriggerDevEnabled, and isTriggerDevEnabled reads TRIGGER_DEV_ENABLED. That variable is set on the app container ...
Opengraph URL: https://github.com/simstudioai/sim/pull/6869
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:ffa060b3-e806-9a66-512c-0b1a948630bd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BD3C:2C34A2:50999D:70C6E7:6AFB5E5E |
| html-safe-nonce | 46271b2f5d30869e71fab164dd82b8ef94a817b62c724149321fd3c5f63393de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDNDOjJDMzRBMjo1MDk5OUQ6NzBDNkU3OjZBRkI1RTVFIiwidmlzaXRvcl9pZCI6IjY2OTYzNDc4NDczMDM1ODUzNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bd09f8cf236e37044b77ff11a900af43100ebbd98faa382c24301e815dc063e6 |
| hovercard-subject-tag | pull_request:4318091602 |
| 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/simstudioai/sim/pull/6869/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Problem isTriggerAvailable() is Boolean(env.TRIGGER_SECRET_KEY) && isTriggerDevEnabled, and isTriggerDevEnabled reads TRIGGER_DEV_ENABLED. That variable is set on the app container but not ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| 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 | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width