Skip to content

fix(auto-fix): guard create-pr endpoint against review-comment tickets#946

Merged
alex-alecu merged 2 commits intomainfrom
fix/kilo-fix-it-v2
Mar 9, 2026
Merged

fix(auto-fix): guard create-pr endpoint against review-comment tickets#946
alex-alecu merged 2 commits intomainfrom
fix/kilo-fix-it-v2

Conversation

@alex-alecu
Copy link
Copy Markdown
Contributor

Summary

When @kilo fix it is used on a review comment, cloud-agent-next calls both /api/internal/auto-fix/pr-callback (the correct path) and the legacy /api/internal/auto-fix/create-pr endpoint. The pr-callback route correctly posts the result on the review thread, but create-pr had no guards — it would also try to create a PR and post an issue-level comment on the PR main thread, causing duplicate notifications.

Confirmed via Axiom logs on PR #927: pr-callback handled the failure at 13:36:28, then create-pr fired at 13:36:33 and posted a spurious "Auto-Fix Update" comment on the PR main thread.

This adds two guards to the create-pr endpoint:

  • Review-comment rejection — if the ticket has a review_comment_id, return 400 (these tickets belong in pr-callbackhandleCommentReply).
  • Terminal-state check — if the ticket is already completed/failed/cancelled, return early instead of re-processing.

Verification

  • pnpm typecheck — passes
  • prettier --write — no changes needed
  • eslint — no warnings or errors

Visual Changes

N/A

Reviewer Notes

The create-pr endpoint appears to be legacy — no code in the current orchestrator constructs its URL. It's called by cloud-agent-next externally. Even if that external call is eventually removed, these guards are cheap insurance against the same class of bug.

… tickets

The create-pr endpoint was being called by cloud-agent-next for
review-comment tickets, bypassing the pr-callback route that correctly
routes them to handleCommentReply. This caused duplicate notifications:
a proper reply on the review thread plus a spurious issue-level comment
on the PR main thread.

Add a review_comment_id guard (rejects with 400) and a terminal-state
check (returns early) so the endpoint can no longer interfere with
tickets already handled by pr-callback.
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 9, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/app/api/internal/auto-fix/create-pr/route.ts

@alex-alecu alex-alecu merged commit 1bb1e63 into main Mar 9, 2026
17 of 18 checks passed
@alex-alecu alex-alecu deleted the fix/kilo-fix-it-v2 branch March 9, 2026 16:03
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