Skip to content

Bitbucket - Add Bitbucket Integration#4218

Open
eshurakov wants to merge 4 commits into
mainfrom
earthy-giant
Open

Bitbucket - Add Bitbucket Integration#4218
eshurakov wants to merge 4 commits into
mainfrom
earthy-giant

Conversation

@eshurakov

@eshurakov eshurakov commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add personal and organization-owned Bitbucket Cloud OAuth connections with encrypted credential storage, workspace selection, repository caching, and GDPR cleanup.
  • Resolve Bitbucket contributor repositories and short-lived credentials through git-token-service, with live owner authorization checks and purpose-bound internal tokens.
  • Extend Cloud Agent session admission, persistence, clone, resume, and push flows to support stable Bitbucket workspace and repository identities.
  • Add Web integration management and repository selection, plus the database migration and production Worker configuration required for deployment.

Verification

  • Tested locally with Cloud Agent
Screenshot 2026-06-23 at 23 24 30

@eshurakov eshurakov changed the title feat(bitbucket): add Cloud Agent integration Bitbucket - Add Bitbucket Integration Jun 23, 2026
const onlyAvailableRepo =
!isLoadingGitHubRepos &&
!isLoadingGitLabRepos &&
(organizationId || !isLoadingBitbucketRepos) &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Repository auto-selection can race Bitbucket loading

For personal sessions this effect still runs while the Bitbucket query is loading, and for organization sessions organizationId || !isLoadingBitbucketRepos explicitly treats the repository set as complete before Bitbucket finishes. Because getPreferredInitialRepo() still only tracks GitHub/GitLab loading, a saved or recent GitHub/GitLab repo can be auto-selected here and prevent the user’s Bitbucket repo from ever being chosen automatically.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

CREATE UNIQUE INDEX "UQ_platform_oauth_credentials_platform_integration_id" ON "platform_oauth_credentials" USING btree ("platform_integration_id");--> statement-breakpoint
CREATE INDEX "IDX_platform_oauth_credentials_platform_subject" ON "platform_oauth_credentials" USING btree ("platform","provider_subject_id");--> statement-breakpoint
CREATE INDEX "IDX_platform_oauth_credentials_authorized_by_user_id" ON "platform_oauth_credentials" USING btree ("authorized_by_user_id");--> statement-breakpoint
CREATE UNIQUE INDEX "UQ_platform_integrations_user_bitbucket" ON "platform_integrations" USING btree ("owned_by_user_id","platform") WHERE "platform_integrations"."platform" = 'bitbucket' AND "platform_integrations"."owned_by_user_id" IS NOT NULL;--> statement-breakpoint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Non-concurrent index creation can block writes on deploy

platform_integrations is an existing populated table, so these two CREATE UNIQUE INDEX statements will take a write-blocking lock while the migration runs. In production that can stall integration updates and other writes; this needs a concurrent rollout strategy instead of plain index creation.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • apps/web/src/components/cloud-agent-next/utils/git-utils.ts
  • apps/web/src/lib/token.test.ts
  • apps/web/src/lib/tokens.ts
Previous Review Summary (commit 95af145)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 95af145)

Status: 2 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx 530 Bitbucket loading can race repository auto-selection and lock in the wrong saved/recent repo.
packages/db/src/migrations/0173_cynical_the_executioner.sql 25 New indexes on populated platform_integrations are created without CONCURRENTLY, which can block writes during deploy.
Files Reviewed (103 files)
  • apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx - 1 issue
  • packages/db/src/migrations/0173_cynical_the_executioner.sql - 1 issue
  • 101 additional changed files - 0 issues

Reviewed by gpt-5.4-20260305 · Input: 84.9K · Output: 8.3K · Cached: 549.6K

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant