You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tools): resolve credentials over HTTP again so token refresh keeps the app's OAuth config (#6662)
* fix(tools): resolve credentials over HTTP again so token refresh keeps the app's OAuth config
* chore(ship): note what to keep out of PR titles and descriptions
Describe the bug by its mechanism, not by how you found it. "Expired OAuth credentials fail to refresh in the worker" — not "the Sheets canary failed at 16:31Z for workspace abc-123".
112
+
103
113
## PR Description Format
104
114
105
115
Use this exact template in the user's voice (concise, bullet points):
Describe the bug by its mechanism, not by how you found it. "Expired OAuth credentials fail to refresh in the worker" — not "the Sheets canary failed at 16:31Z for workspace abc-123".
111
+
102
112
## PR Description Format
103
113
104
114
Use this exact template in the user's voice (concise, bullet points):
Copy file name to clipboardExpand all lines: .claude/rules/sim-architecture.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,27 @@ Use the `migrate-application-operation` skill before creating or migrating a pro
57
57
58
58
Every export of a `'use client'` module becomes a *client reference* on the server — server-evaluated code (RSC pages/layouts, `prefetch.ts`, route handlers, block definitions, triggers) can only *render* it as a component or pass it as a prop, never *call* it (doing so throws at runtime, e.g. `tableKeys.list is not a function`; `next build` does not catch it). Keep server-importable query primitives (key factories, fetchers, mappers, constants) in non-`'use client'` modules — see `.claude/rules/sim-queries.md`. Enforced by `scripts/check-client-boundary-imports.ts`.
59
59
60
+
## The app/worker runtime boundary
61
+
62
+
Server code runs in two runtimes with **different environments**. The app container loads the
63
+
full env from `SIM_ENV_SECRET_ID` (Secrets Manager). Trigger.dev workers — which execute
64
+
workflows, 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.
67
+
68
+
So before replacing a worker's HTTP call to our own API with an in-process call, ask what env
69
+
that work reads *on the app side*. Anything gated by a `require*Capability` helper is the sharp
70
+
case: those **throw** when the variable is absent (`requireOAuthClientCapability` →
71
+
`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.
75
+
76
+
An in-process conversion is safe when the same work already runs in that runtime (the agent
77
+
block 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
+
60
81
## Feature Organization
61
82
62
83
Features live under `app/workspace/[workspaceId]/`:
Describe the bug by its mechanism, not by how you found it. "Expired OAuth credentials fail to refresh in the worker" — not "the Sheets canary failed at 16:31Z for workspace abc-123".
106
+
97
107
## PR Description Format
98
108
99
109
Use this exact template in the user's voice (concise, bullet points):
0 commit comments