OUT-4067: migrate to @assembly-js/node-sdk - #137
Merged
Conversation
The deprecated copilot-node-sdk is replaced by @assembly-js/node-sdk. The new SDK's session tokens expire after 5 minutes, which breaks long-running Trigger.dev file-sync tasks. Authenticate with a workspace-scoped API key (workspaceId/apiKey) and no token so credentials never expire mid-sync. CopilotAPI now takes a workspaceId (callers pass user.portalId), decodes the token payload via a token-scoped SDK only at the auth boundary, and drops the SDK methods that are no longer used. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The workspace-scoped API key only authorizes when COPILOT_ENV (or ASSEMBLY_ENV) is "local" or "__SECRET_STAGING__". Validate it at boot so a misconfigured runtime fails fast instead of on the first API call. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Inline the new SDK in the integration config, point the mock host at the SDK's api.assembly.com base URL, fix the createFile mock's channelID casing, and update the workspace tests for the decode-then-construct flow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR migrates Assembly access from the deprecated Copilot SDK to
Confidence Score: 5/5The PR appears safe to merge once the explicitly documented COPILOT_ENV or ASSEMBLY_ENV deployment configuration is applied. The migrated call sites consistently derive workspace scope from decoded tokens or persisted users, no removed wrapper consumers remain, and the reviewed changes reveal no concrete blocking failure beyond the acknowledged deployment prerequisite. Important Files Changed
Sequence DiagramsequenceDiagram
participant Request
participant Auth as Token decoder
participant App as Sync/workspace service
participant SDK as Assembly SDK
participant API as Assembly API
Request->>Auth: Request token
Auth->>SDK: assemblyApi(apiKey, token)
SDK-->>Auth: workspaceId payload
Auth->>App: Authenticated user/workspaceId
App->>SDK: assemblyApi(workspaceId/API key)
SDK->>API: Workspace-scoped operations
API-->>App: Files/workspace data
Reviews (1): Last reviewed commit: "test(OUT-4067): update tests and msw har..." | Re-trigger Greptile |
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
Migrates the app from the deprecated copilot-node-sdk to @assembly-js/node-sdk v4.2.2.
The new SDK's session tokens expire after 5 minutes, which breaks long-running Trigger.dev file-sync tasks. To avoid mid-sync expiry, the app now authenticates with a workspace-scoped API key (
workspaceId/apiKey) and no token.CopilotAPItakes aworkspaceId(callers passuser.portalId); the request token is decoded only at the auth boundary via a token-scoped SDK.Commits
feat: SDK migration —CopilotAPI/utils/User.model/base.service/types+ all call sites (Sync.service, resync helper,processFileSync,workspace); removed unused SDK methods; dropped thecopilot-node-sdkdependency.feat:server.env.tsnow validatesCOPILOT_ENV/ASSEMBLY_ENVso a misconfigured runtime fails fast at boot instead of on the first API call.test: updated integration config (inline new SDK), MSW host (api.assembly.com) +createFilemock casing, and workspace tests for the decode-then-construct flow.Tenant isolation
Reviewed for cross-portal leakage (multi-tenant: one portal = one Assembly workspace). Confirmed safe — every
CopilotAPIis freshly scoped to aportalId/workspaceIdfrom a decoded token or DB row; no module-level singleton/cache that could bleed across warm Vercel/Trigger.dev instances. The SDK isolates concurrent requests viaAsyncLocalStorageand never mutates global config.Verification
pnpm typecheck— cleanpnpm biome lint src test— cleanpnpm build— cleanserver.env.tsfail-closes at import unlessCOPILOT_ENV(orASSEMBLY_ENV) islocal. SetCOPILOT_ENV=localin Vercel (all envs) and Trigger.dev before/with merge, or every API route and sync task will crash on cold start.🤖 Generated with Claude Code