feat(github): add safe connection management foundation - #5903
Merged
Conversation
pandemicsyn
marked this pull request as ready for review
September 8, 2026 03:53
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Executive Summary
Overview
Issue Details (click to expand)WARNING
Files Reviewed (88 files)
Previous Review Summaries (2 snapshots, latest commit 7190a8f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 7190a8f)Status: No Issues Found | Recommendation: Merge Files Reviewed (10 files)
Previous review (commit 260a7e0)Status: 5 Issues Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Reviewed by grok-4.6 · Input: 355K · Output: 34.2K · Cached: 1.2M Review guidance: REVIEW.md from base branch |
pandemicsyn
force-pushed
the
feat/github-connections-pr1
branch
from
September 8, 2026 13:58
7190a8f to
608ce7f
Compare
intentionally-left-nil
approved these changes
Sep 8, 2026
This was referenced Sep 9, 2026
This was referenced Sep 14, 2026
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.
What this PR does
GITHUB_CONNECTION_MANAGEMENT_ENABLED; this PR does not enable sharing one installation across multiple Kilo entities.Migration and compatibility
Migration
0239_old_hemingwaycreates canonical installation and connection-attempt storage, then automatically links every healthy, active, unambiguous GitHub integration using idempotent set-based SQL. The observed aggregate was 37,154 GitHub rows in a 121 MB source table: 36,951 eligible, 0 ambiguous active rows, 2 migration-0205 losers, and 201 inactive or invalid rows intentionally excluded.The remaining script is for exception reporting and reconciliation only; normal deployment does not require a manual backfill. Existing install, pending-approval, suspend/unsuspend, upstream-uninstall, session, Slack, and Code Reviewer behavior remains compatible while the flag is off.
Why PostgreSQL advisory locks are required
The authorization rules cover multiple rows, including connections that do not exist yet, so row locks cannot protect the decision. Transaction-scoped advisory locks serialize two boundaries:
This also makes PR1 writers safe when PR2 later removes the old global uniqueness index to support intentional sharing. Locks use one consistent order (installation, then organization), release automatically on commit/rollback, and do not serialize users or organizations already allowed to use multiple installations.
Safety properties
Verification
Rollout and follow-ups
Keep
GITHUB_CONNECTION_MANAGEMENT_ENABLEDoff through PR2. Before enabling the shared-installation pilot, verify live Standard/Lite authorization, confirm reconciliation and writer cutover, and complete the deferred canonical foreign key and shared Cloud Agent authorization.Planned stack: