Skip to content

fix(code-review): disable code review on bad config#3558

Merged
alex-alecu merged 7 commits into
mainfrom
unsupported-static-ip
May 29, 2026
Merged

fix(code-review): disable code review on bad config#3558
alex-alecu merged 7 commits into
mainfrom
unsupported-static-ip

Conversation

@alex-alecu
Copy link
Copy Markdown
Contributor

Summary

  • Disable Code Reviewer when known action-required failures stop reviews from running.
  • Show clear recovery steps in the app, email the owner, and update review status checks when possible.
  • Block retries until the user fixes settings and enables Code Reviewer again.

Verification

N/A (not manually verified in browser).

Visual Changes

N/A (no screenshots captured).

Reviewer Notes

  • Action-required state is saved on the existing agent config, so this does not add a database migration.
  • GitHub IP allow-list failures may block GitHub-side updates, so email and the dashboard are the reliable notices.

Comment thread apps/web/src/lib/code-reviews/action-required.ts
Comment thread apps/web/src/lib/code-reviews/action-required.ts Outdated
Comment thread apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts
Comment thread apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

All 4 previously flagged issues are resolved across 6 new commits; incremental changes introduce no new problems.

Previously Flagged Issues — All Resolved

Issue Fixed In
Silent failure when agent config not found 48d47ef — now throws Error('Code Review agent config not found...')
shouldSendEmail mutation from inside async transaction callback e0fc8e4 — transaction now returns shouldSendEmail as a proper return value
Review stuck in queued state if failReservedQueuedReview throws 2288d90 — fallback releaseQueuedReviewClaim added in catch block
Redundant disableCodeReviewForActionRequiredFailure when action-required state already set 0807df1 — skipped via actionRequiredStateAlreadyPresent guard
Files Reviewed (29 files)
  • apps/web/src/app/(app)/code-reviews/ReviewAgentPageClient.tsx
  • apps/web/src/app/(app)/organizations/[id]/code-reviews/ReviewAgentPageClient.tsx
  • apps/web/src/app/admin/components/CodeReviewErrorAnalysis.tsx
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts
  • apps/web/src/components/code-reviews/CodeReviewActionRequiredAlert.tsx
  • apps/web/src/components/code-reviews/CodeReviewJobsCard.tsx
  • apps/web/src/components/code-reviews/ReviewConfigForm.tsx
  • apps/web/src/emails/AGENTS.md
  • apps/web/src/emails/codeReviewDisabled.html
  • apps/web/src/lib/agent-config/db/agent-configs.ts
  • apps/web/src/lib/code-reviews/action-required-shared.ts
  • apps/web/src/lib/code-reviews/action-required.test.ts
  • apps/web/src/lib/code-reviews/action-required.ts
  • apps/web/src/lib/code-reviews/alerting/detectors.test.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.ts
  • apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.test.ts
  • apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts
  • apps/web/src/lib/email.ts
  • apps/web/src/lib/integrations/platforms/github/webhook-handlers/pull-request-handler.ts
  • apps/web/src/lib/purchase-emails.test.ts
  • apps/web/src/routers/admin-code-reviews-router.ts
  • apps/web/src/routers/code-reviews-router.test.ts
  • apps/web/src/routers/code-reviews-router.ts
  • apps/web/src/routers/code-reviews/code-reviews-router.ts
  • apps/web/src/routers/organizations/organization-code-reviews-router.ts
  • packages/db/src/schema-types.ts
  • packages/worker-utils/src/cloud-agent-next-client.ts
  • services/code-review-infra/src/types.ts

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-4.6 · 1,283,809 tokens

Review guidance: REVIEW.md from base branch main

@alex-alecu alex-alecu changed the title fix(code-review): disable on action required fix(code-review): disable code review on bad config May 28, 2026
Comment thread apps/web/src/lib/code-reviews/action-required.ts Outdated
Comment thread packages/worker-utils/src/cloud-agent-next-client.ts
Comment thread packages/worker-utils/src/cloud-agent-next-client.ts
@alex-alecu
Copy link
Copy Markdown
Contributor Author

I will follow up if necessary with an automation of reengaging with the users / orgs that will have code reviews disabled using this query:

SELECT
  ac.id AS agent_config_id,
  ac.platform,
  ac.is_enabled,
  ac.owned_by_user_id,
  u.google_user_email,
  ac.owned_by_organization_id,
  o.name AS organization_name,
  state.value->>'reason' AS reason,
  state.value->>'detectedAt' AS detected_at,
  state.value->>'lastSeenAt' AS last_seen_at,
  state.value->>'triggeringReviewId' AS triggering_review_id,
  state.value->>'emailSentAt' AS email_sent_at
FROM agent_configs ac
LEFT JOIN kilocode_users u ON u.id = ac.owned_by_user_id
LEFT JOIN organizations o ON o.id = ac.owned_by_organization_id
CROSS JOIN LATERAL (
  SELECT COALESCE(ac.runtime_state, '{}'::jsonb)->'code_review_action_required' AS value
) state
WHERE ac.agent_type = 'code_review'
  AND ac.is_enabled = false
  AND COALESCE(ac.runtime_state, '{}'::jsonb) ? 'code_review_action_required';

The important flag is code_review_action_required

@alex-alecu alex-alecu merged commit 53c5ad8 into main May 29, 2026
54 checks passed
@alex-alecu alex-alecu deleted the unsupported-static-ip branch May 29, 2026 07:43
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.

2 participants