refactor(cloud-agent-next): migrate to git-token-service RPC#1158
Draft
refactor(cloud-agent-next): migrate to git-token-service RPC#1158
Conversation
… fix test worker port Rename GITLAB_OAUTH_CLIENT_ID/SECRET to GITLAB_CLIENT_ID/SECRET to match the backend's naming convention. Fix test worker port conflict by using a separate port (8796) from the main worker (8795).
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
cloud-agent-nextfrom local GitHub token generation (Hyperdrive DB lookup +@octokit/auth-app+ KV caching) to the centralizedgit-token-serviceworker via Cloudflare service binding RPC.session-prepareGitHub flow: The two-step lookup-then-generate pattern (InstallationLookupService→GitHubTokenService) is replaced by a singleGIT_TOKEN_SERVICE.getTokenForRepo()RPC call that returns a ready-to-use token.platform === 'gitlab'and no client token is provided, callsGIT_TOKEN_SERVICE.getGitLabToken()to automatically resolve a token. Stores agitlabTokenManagedflag in DO state so the token is refreshed on session resume.initiatePreparedand follow-up execution paths now call the git-token-service for fresh tokens instead of using the localGitHubTokenService.github-token-service.tsandinstallation-lookup-service.ts. Removed@octokit/auth-appand@kilocode/dbdependencies. RemovedHYPERDRIVE,GITHUB_TOKEN_CACHEKV, and GitHub App secret env vars fromwrangler.jsoncandEnvtype.GIT_TOKEN_SERVICEservice binding inwrangler.jsonc(prod →git-token-service, dev →git-token-service-dev).Verification
pnpm typecheck— passed (all 28 workspace projects)pnpm lint— passedpnpm test— 2632 passed, 6 skipped, 166 suitesVisual Changes
N/A
Reviewer Notes
GITHUB_APP_SLUG,GITHUB_APP_BOT_USER_ID, and_LITE_variants) are retained — they're used for git commit email/author, not token generation.gitlabTokenManagedflag is stored in DO state to distinguish auto-resolved GitLab tokens (which need refresh) from client-provided tokens (which don't).worker-configuration.d.tsdiff includes Cloudflare runtime type updates (e.g.,HostedImagesBinding,aiSearch()) from runningpnpm run types— these are generated and unrelated to this change.