Skip to content

feat(code-review): resolve fixed threads#4049

Closed
alex-alecu wants to merge 3 commits into
mainfrom
auto-resolve-addressed-review-threads
Closed

feat(code-review): resolve fixed threads#4049
alex-alecu wants to merge 3 commits into
mainfrom
auto-resolve-addressed-review-threads

Conversation

@alex-alecu

Copy link
Copy Markdown
Contributor

Summary

Incremental code reviews can now close an old Kilo review thread only when the new review says the issue is fully fixed. The server checks that the thread still belongs to Kilo, has no replies, is still safe to close, and matches the commit the review saw. If anything is missing, stale, or changed, nothing is closed.

Verification

  1. Run an incremental GitHub code review on a staging PR with a fixed Kilo inline thread that has no replies.
  2. Confirm that fixed thread is resolved.
  3. Add a reply to another Kilo thread and confirm it stays open after the review.

Visual Changes

N/A

Reviewer Notes

GitHub permissions should be checked in staging because closing threads depends on viewerCanResolve.

@kilo-code-bot

kilo-code-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (81 files)
  • .specs/kiloclaw-billing-lifecycle.md
  • .specs/kiloclaw-billing.md
  • apps/web/src/app/(app)/claw/components/billing/PlanSelectionDialog.tsx
  • apps/web/src/app/(app)/claw/components/billing/WelcomePage.tsx
  • apps/web/src/app/(app)/claw/components/billing/billing-types.test.ts
  • apps/web/src/app/(app)/claw/components/billing/billing-types.ts
  • apps/web/src/app/(app)/claw/components/changelog-data.ts
  • apps/web/src/app/admin/components/KiloclawInstances/KiloclawInstancesPage.tsx
  • apps/web/src/app/admin/components/KiloclawInstances/KiloclawOrphansTab.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/app/payments/kilo-pass/awarding/KiloPassAwardingCreditsClient.tsx
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts
  • apps/web/src/lib/ai-gateway/providers/model-settings.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.test.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.ts
  • apps/web/src/lib/ai-gateway/tool-calling.test.ts
  • apps/web/src/lib/ai-gateway/tool-calling.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.test.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.ts
  • apps/web/src/lib/code-reviews/github-review-thread-resolution.test.ts
  • apps/web/src/lib/code-reviews/github-review-thread-resolution.ts
  • apps/web/src/lib/code-reviews/prompts/generate-prompt.test.ts
  • apps/web/src/lib/code-reviews/prompts/generate-prompt.ts
  • apps/web/src/lib/code-reviews/review-memory/github-feedback.test.ts
  • apps/web/src/lib/code-reviews/review-memory/github-feedback.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.test.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.ts
  • apps/web/src/lib/integrations/platforms/github/adapter.ts
  • apps/web/src/lib/kiloclaw/credit-billing.ts
  • apps/web/src/lib/kiloclaw/instance-lifecycle.test.ts
  • apps/web/src/lib/kiloclaw/pricing-catalog.test.ts
  • apps/web/src/lib/kiloclaw/stripe-handlers.ts
  • apps/web/src/routers/admin-kiloclaw-instances-router.test.ts
  • apps/web/src/routers/admin-kiloclaw-instances-router.ts
  • apps/web/src/routers/kilo-pass-router.test.ts
  • apps/web/src/routers/kilo-pass-router.ts
  • apps/web/src/routers/kiloclaw-billing-router.test.ts
  • apps/web/src/routers/kiloclaw-router.ts
  • packages/db/src/kiloclaw-pricing-catalog.ts
  • packages/db/src/migrations/0166_right_boom_boom.sql
  • packages/db/src/migrations/meta/0166_snapshot.json
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.ts
  • packages/worker-utils/src/cloud-agent-next-client.ts
  • packages/worker-utils/src/index.ts
  • services/cloud-agent-next/src/callbacks/queue-payload.test.ts
  • services/cloud-agent-next/src/callbacks/queue-payload.ts
  • services/cloud-agent-next/src/callbacks/types.ts
  • services/cloud-agent-next/src/execution/types.ts
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts
  • services/cloud-agent-next/src/persistence/schemas.test.ts
  • services/cloud-agent-next/src/persistence/schemas.ts
  • services/cloud-agent-next/src/persistence/session-metadata.test.ts
  • services/cloud-agent-next/src/persistence/session-metadata.ts
  • services/cloud-agent-next/src/router.test.ts
  • services/cloud-agent-next/src/router/handlers/session-execution.ts
  • services/cloud-agent-next/src/router/handlers/session-prepare.ts
  • services/cloud-agent-next/src/router/schemas.test.ts
  • services/cloud-agent-next/src/router/schemas.ts
  • services/cloud-agent-next/src/session-prepare.test.ts
  • services/cloud-agent-next/src/session-service.test.ts
  • services/cloud-agent-next/src/session-service.ts
  • services/cloud-agent-next/src/session/message-settlement-outbox.test.ts
  • services/cloud-agent-next/src/session/message-settlement-outbox.ts
  • services/cloud-agent-next/src/session/pending-messages.test.ts
  • services/cloud-agent-next/src/session/pending-messages.ts
  • services/cloud-agent-next/src/session/session-message-queue.test.ts
  • services/cloud-agent-next/src/session/session-message-queue.ts
  • services/cloud-agent-next/src/session/session-message-state.test.ts
  • services/cloud-agent-next/src/session/session-message-state.ts
  • services/cloud-agent-next/src/session/session-registration.ts
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts
  • services/cloud-agent-next/test/helpers/session-setup.ts
  • services/cloud-agent-next/test/integration/session/start-execution-v2.test.ts
  • services/cloud-agent-next/wrapper/src/kilo-api.ts
  • services/cloud-agent-next/wrapper/src/server.test.ts
  • services/cloud-agent-next/wrapper/src/server.ts
  • services/code-review-infra/src/code-review-orchestrator.ts
  • services/code-review-infra/src/types.ts
  • services/code-review-infra/test/integration/code-review-orchestrator.test.ts
  • services/kiloclaw-billing/src/lifecycle.test.ts
  • services/kiloclaw-billing/src/lifecycle.ts
  • services/kiloclaw/controller/src/index.ts
  • services/kiloclaw/controller/src/model-catalog-refresh.test.ts
  • services/kiloclaw/controller/src/model-catalog-refresh.ts
Previous Review Summary (commit e702339)

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

Previous review (commit e702339)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Adds a secure, capability-token-based system for incrementally resolving addressed GitHub review threads. The implementation includes thorough input validation, HMAC token verification, stale-state guards, and graceful error handling throughout.

Files Reviewed (8 files)
  • apps/web/src/lib/code-reviews/github-review-thread-resolution.ts - Core module with candidate fetching, token derivation/verification, and thread resolution via GitHub GraphQL
  • apps/web/src/lib/code-reviews/github-review-thread-resolution.test.ts - 6 test cases covering happy path, rejection scenarios, and mutation failure
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts - Callback endpoint integration that processes lastAssistantMessageText on review completion
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts - Updated mock setup for new dependency
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.ts - Fetches resolution candidates during incremental review preparation
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.test.ts - Updated mock setup
  • apps/web/src/lib/code-reviews/prompts/generate-prompt.ts - Adds resolution protocol section to incremental review prompts
  • apps/web/src/lib/code-reviews/prompts/generate-prompt.test.ts - 4 new test cases for prompt gating logic

Reviewed by gpt-5.4-2026-03-05 · 583,884 tokens

Review guidance: REVIEW.md from base branch main

@alex-alecu alex-alecu marked this pull request as draft June 18, 2026 15:27
@alex-alecu alex-alecu closed this Jun 18, 2026
@alex-alecu

Copy link
Copy Markdown
Contributor Author

Done here in a less programatic way by using direct gh cli from main agent #4116

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