improvement(oauth): resolve credential tokens in-process instead of hopping the token route - #7340
Merged
Merged
Conversation
…f hopping the oauth token route
…credential-token resolution
…fresh-failure causes
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThe PR moves server-side OAuth credential-token resolution from an internal HTTP round trip to the shared in-process application dispatch while retaining the browser route path.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/oauth/token-resolution.ts | Centralizes the managed OAuth, service-account, and ordinary OAuth dispatch while preserving authorization and error projection. |
| apps/sim/executor/utils/credential-token.ts | Replaces the internal token-route request with in-process dispatch and binds managed credential use to the executor delegation origin. |
| apps/sim/lib/credentials/application/managed-oauth-delegation.ts | Adds an in-process managed OAuth delegation binder that retains canonical execution validation and per-credential scope. |
| apps/sim/app/api/auth/oauth/token/route.ts | Reduces the POST route to an authenticated adapter over the shared token-resolution dispatch. |
| apps/sim/tools/index.ts | Uses in-process resolution on the server, retains contract-backed HTTP resolution in the browser, and consumes the full token payload. |
Sequence Diagram
sequenceDiagram
participant E as Server-side executor
participant D as Token resolution dispatch
participant A as Authorization and delegation binding
participant C as Credential service
participant P as OAuth provider
E->>D: Resolve credential token in-process
D->>A: Authenticate or bind managed delegation
A-->>D: Authorized credential scope
D->>C: Load credential and resolve token
C->>P: Refresh token when required
P-->>C: Refreshed token
C-->>D: Credential token payload
D-->>E: Access token and provider metadata
Reviews (2): Last reviewed commit: "chore(tools): drop the orphaned wire-pay..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Fix all with cubic | Re-trigger cubic
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolveCredentialAccessToken) instead of HTTP-POSTing its own/api/auth/oauth/tokenroute — dropping an internal round-trip on every credentialed tool call and per-call internal-JWT mint/verifylib/oauth/token-resolution.ts; the route is now a thin adapter and its tests pass unmodified. Managed-credential delegations bind in-process (bindExecutorManagedOAuthDelegation) with the same DB re-validation, audience, and per-credential scope as the wire pathrequestJson+ the existing contract instead of a raw annotated fetch; the route's wire path stays intact for compatibility during deploy rolloutresolveCredentialTokenBundle(was colliding with the new dispatcher name), removed the now-dead executor delegation-header builder, deduped input types, and fixed a falsyimpersonateEmailedge so empty subblock state keeps resolvingType of Change
Testing
bun run type-check,bun run lint:check,bun run check:audits(40/40 incl. api-validation strict, tool-request/registry boundary)Checklist