@@ -62,21 +62,25 @@ Every export of a `'use client'` module becomes a *client reference* on the serv
6262Server code runs in two runtimes with ** different environments** . The app container loads the
6363full env from ` SIM_ENV_SECRET_ID ` (Secrets Manager). Trigger.dev workers — which execute
6464workflows, so every block handler and every tool call — get their env from the Trigger.dev
65- dashboard, and ` trigger.config.ts ` syncs only ` DB_APP_NAME ` . The repo cannot see what the
66- dashboard holds.
65+ dashboard; ` trigger.config.ts ` additionally syncs ` DB_APP_NAME ` , ` TRIGGER_DEV_ENABLED ` , and the
66+ ` FUNCTION_EXECUTION_ENV ` vars. The repo cannot see what the dashboard holds.
6767
6868So before replacing a worker's HTTP call to our own API with an in-process call, ask what env
6969that work reads * on the app side* . Anything gated by a ` require*Capability ` helper is the sharp
7070case: those ** throw** when the variable is absent (` requireOAuthClientCapability ` →
7171` EnvCapabilityConfigurationError ` ), and the throw may be caught and reported as something
72- unrelated. OAuth token refresh is the known example — moving it into the worker turns every
73- expired credential into ` Failed to refresh access token ` , while a still-valid token hides the
74- bug entirely, so it surfaces hours later and only for whoever's token lapsed first.
72+ unrelated — an in-worker OAuth refresh missing a provider's client pair reports every expired
73+ credential as ` Failed to refresh access token ` , while a still-valid token hides the bug until it
74+ lapses. The required step before such a conversion is verifying the dashboard env holds every
75+ variable the moved code reads (for OAuth refresh: the ` OAUTH_CLIENT_CAPABILITIES ` key pairs in
76+ ` packages/deployment-config/src/env-capabilities.ts ` ).
7577
7678An in-process conversion is safe when the same work already runs in that runtime (the agent
7779block has always called ` executeProviderRequest ` in-process, so router and evaluator joining it
78- is proven), or when the caller and the callee are both the app (a route calling a lib module, an
79- RSC prefetch reading the data layer). It is not safe on reasoning alone.
80+ is proven; connector sync refreshing OAuth tokens in-worker is what proved credential-token
81+ resolution could move in-process), or when the caller and the callee are both the app (a route
82+ calling a lib module, an RSC prefetch reading the data layer). It is not safe on reasoning
83+ alone — verify the env, then convert.
8084
8185## Feature Organization
8286
0 commit comments