Repository navigation
fix(github): pin pending installation selection and cancel to one request - #8570
Conversation
…uest A user can hold several pending GitHub App installation requests, one per GitHub target. Both the pending-state lookup and the cancel path picked one of those rows without an order, so a resumed view could describe a different request than the one shown and an unscoped cancel could delete any of them. Order the requester lookup by created_at DESC, id DESC; require the integration id when cancelling and delete exactly that row; return the pending row id from checkUserPendingInstallation so clients and agents can name it. Delete the unused findPendingInstallationByRequesterId, which had the same unordered shape and no callers. Regenerate the MCP catalog for the now-required input.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe only incremental code change is a database-backed test for equal pending Assumptions: Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit f0726e3)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f0726e3)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe incremental commit strengthens the NOT_FOUND test so it now proves the router matches the requested integration id; one previously reported mismatch between the pending lookup and the installation view remains open. Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Previous review (commit fd86322)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (8 files)
Reviewed by deepseek-flash-latest · Input: 73K · Output: 13.6K · Cached: 1.1M Review guidance: REVIEW.md from base branch |
…istic-pending-installations # Conflicts: # apps/web/src/lib/integrations/github-apps-service.ts
Evidence
Evidence: demonstrated — database-backed regression tests and authenticated requests to the running local web app verified deterministic pending selection and exact-row cancellation, with PostgreSQL reads checking the effects.
Follow-up verification
On the merged branch, using an owned fake account, generated development credentials, and disposable local PostgreSQL:
githubApps.checkUserPendingInstallationreturned the descending integration ID.integrationIdreturned HTTP 400BAD_REQUEST; both rows remained.NOT_FOUND; the remaining request was unchanged.NODE_ENV=test pnpm exec jest --runInBand --runTestsByPath src/lib/integrations/github-apps-service.test.ts src/routers/github-apps-router.test.ts src/app/api/integrations/github/callback/route.test.tsfromapps/web: 3 suites, 104 tests passed.GOMEMLIMIT=2GiB pnpm exec tsgo --noEmit --checkers 1 --tsBuildInfoFile .tsbuildinfo/tsgo.tsbuildinfofromapps/web: passed.oxfmtandoxlinton the resolved service and its regression test: passed.pnpm install --frozen-lockfile: passed.This follow-up exercised the HTTP API rather than the visual surface; no new screenshot is claimed. The initial session also exercised the web page's Cancel Request confirmation and observed deletion of only the displayed row. No provider HTTP request is required by these database-only paths; GitHub, GitLab, and Bitbucket provider behavior remains unproven by this run.
Change
findPendingInstallationByKiloUserIdorders bycreated_at DESC, id DESCandcheckUserPendingInstallationreturnspendingIntegrationIdidentifying that response's row.cancelPendingInstallation(owner, integrationId)requires an ID and scopes it to a pending GitHub request belonging to that owner. The router rejects omitted IDs, and the web cancellation passes the displayed row's ID. The organization caller already supplied its rendered ID.findPendingInstallationByRequesterId; removed its stale test mock entry.integrationId.mainby retaining both the required ID andmain's sharedownerCondition(owner)predicate.Review decisions and limits
checkUserPendingInstallationis user-wide and newest-first;getInstallationis owner-scoped and ranks connection health. Each response identifies its own row, and cancellation targets that explicit ID. This PR does not change connection-health precedence.Proxy answers
The owner's proxy gave these answers in the owner's place.
Answer: Require integrationId
Confidence: 0.85 · Precedent: Replace old paths instead of keeping them alongside the new path: session ad6a3f589364, "alongside? why not instead?"; the brief allows removing the unscoped fallback.
Answer: Newest first (created_at DESC, id DESC)
Confidence: 0.90 · Precedent: none
Answer: Delete it
Confidence: 0.60 · Precedent: Delete obsolete code freely, since git can restore an overdeletion: session 2f71af3a787e, "delete all you can, we can restore from git later if we overdelete"; also fix the class of the issue.
Answer: Keep them distinct, reject the remark
Confidence: 0.62 · Precedent: Git and pull requests: 'Run the standard PR loop: check each kilobot comment, fix it or reject it' (session 80d037e14f3a); 'Keep each PR diff to files that the feature needs' (session df491946927a).