Skip to content

Conversation

@Shironex
Copy link
Collaborator

@Shironex Shironex commented Dec 28, 2025

Summary

  • Add comments section to issue detail panel with lazy loading (50 comments at a time with pagination)
  • Include comments in AI validation analysis when "Include in AI analysis" checkbox is enabled
  • Pass linked PRs info to AI validation for context awareness
  • Add prominent "Work in Progress" badge in validation dialog when there's an open PR linked
  • If PR is valid for the issue the create task button is hidden and alert is shown from ai analysis about pr

Changes

New Files

  • apps/server/src/routes/github/routes/list-comments.ts - GraphQL endpoint to fetch issue comments
  • apps/ui/src/components/views/github-issues-view/components/comment-item.tsx - Comment display component
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts - Hook for fetching comments with pagination

Modified Files

  • Extended types to include GitHubComment, IssueCommentsResult, LinkedPRInfo
  • Updated validation schema to include comments and linked PRs in AI prompt
  • Added "Work in Progress" badge to validation dialog
  • Updated API client with getIssueComments method

Test plan

  • View an issue with comments - comments section should display
  • Click "Load More" - pagination should work
  • Enable "Include in AI analysis" and validate - server logs should show comments count
  • Validate issue with linked open PR - "Work in Progress" badge should appear
  • AI analysis should mention linked PRs in its reasoning

Preview

image image image

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Display GitHub issue comments in the issue detail view with pagination, per-comment rendering, and an “Include in AI analysis” toggle.
    • Option to include comments and linked PRs in AI validation; revalidate flow preserves these options via the confirmation dialog.
    • PR analysis and Work-in-Progress badges in validation results with recommendation-aware UI.
    • New client & server APIs to fetch issue comments and new types for comments and PR analysis.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add comments section to issue detail panel with lazy loading
- Fetch comments via GraphQL API with pagination (50 at a time)
- Include comments in AI validation analysis when checkbox enabled
- Pass linked PRs info to AI validation for context
- Add "Work in Progress" badge in validation dialog for open PRs
- Add debug logging for validation requests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds backend endpoint to fetch paginated GitHub issue comments, extends validation schema/prompt to include comments and linked PRs, and wires UI (components, hooks, API clients, types) to display, paginate, and include comments/PRs in AI validation flows.

Changes

Cohort / File(s) Summary
Backend — Router
apps/server/src/routes/github/index.ts
Registers new POST /issue-comments route and imports createListCommentsHandler.
Backend — Comment fetching handler
apps/server/src/routes/github/routes/list-comments.ts
New handler: validates request, resolves owner/repo, spawns gh api graphql with variables, parses nodes into typed comments, returns paginated IssueCommentsResult, and handles/logs errors.
Backend — Validation flow & schema
apps/server/src/routes/github/routes/validate-issue.ts
apps/server/src/routes/github/routes/validation-schema.ts
Validation request accepts comments and linkedPRs; buildValidationPrompt accepts and renders linked PRs and recent comments; adds prAnalysis to the validation schema and propagates transformed data into runValidation.
UI — Issue detail & comments UI
apps/ui/src/components/views/github-issues-view/components/comment-item.tsx
apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
New CommentItem component; IssueDetailPanel adds comments UI (expand, include toggle, pagination via hook) and surfaces PR analysis badges in validation dialog with conditional Convert button.
UI — Hooks & types
apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
apps/ui/src/components/views/github-issues-view/hooks/index.ts
apps/ui/src/components/views/github-issues-view/types.ts
New useIssueComments hook (fetch/paginate); handleValidateIssue now accepts comments and linkedPRs; introduces ValidateIssueOptions and updates callback signatures to carry options.
UI — API clients / Electron
apps/ui/src/lib/http-api-client.ts
apps/ui/src/lib/electron.ts
Adds getIssueComments to HttpApiClient and GitHubAPI (Electron), posts to /api/github/issue-comments, updates mocks and re-exports GitHubComment / IssueCommentsResult.
Types (shared)
libs/types/src/issue-validation.ts
libs/types/src/index.ts
Adds GitHubCommentAuthor, GitHubComment, IssueCommentsResult, LinkedPRInfo, PRAnalysis, PRRecommendation; extends IssueValidationInput (comments, linkedPRs) and IssueValidationResult (prAnalysis).
UI — View wiring
apps/ui/src/components/views/github-issues-view.tsx
Adds pendingRevalidateOptions state to capture and pass ValidateIssueOptions through the revalidate confirmation flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as IssueDetailPanel
    participant Hook as useIssueComments / useIssueValidation
    participant Client as HttpApiClient
    participant Server as Server (/issue-comments, /validate-issue)
    participant GH as GitHub CLI

    User->>UI: Click "Load comments"
    UI->>Hook: fetchComments(issueNumber)
    Hook->>Client: POST /api/github/issue-comments { projectPath, issueNumber, cursor? }
    Client->>Server: receive request
    Server->>GH: spawn `gh api graphql` with variables
    GH-->>Server: GraphQL response (stdout)
    Server->>Client: { success, comments[], totalCount, hasNextPage, endCursor }
    Client->>Hook: return comments + pagination
    Hook->>UI: update state -> render CommentItem list

    User->>UI: Click "Validate" (include comments)
    UI->>Hook: handleValidateIssue(issue, { comments, linkedPRs, forceRevalidate? })
    Hook->>Client: POST /api/github/validate-issue (includes comments & linkedPRs)
    Client->>Server: deliver validation request
    Server->>Server: buildValidationPrompt(issue, comments?, linkedPRs?)
    Server-->>Client: validation result (may include prAnalysis)
    Client->>Hook: return result
    Hook->>UI: show ValidationDialog (PR analysis)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Ready-To-Merge

Poem

🐰 I nibble at the code with cheer,
New comments hop in, page by page,
PRs and prompts now clearer here,
Pagination bounds the stage,
Hooray — the validation blooms with sage!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: adding GitHub issue comments display and integrating them into AI validation.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/github-issue-comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the GitHub issues viewing and AI validation experience. It allows users to view issue comments directly within the application, providing a more complete picture of an issue's discussion. Furthermore, it enriches the AI validation process by feeding it crucial context from issue comments and linked pull requests, leading to more informed and accurate AI analyses. The addition of a 'Work in Progress' badge also improves visibility into the development status of issues.

Highlights

  • GitHub Issue Comments Display: Introduced a new section in the issue detail panel to display GitHub issue comments, featuring lazy loading with pagination (50 comments at a time) for efficient retrieval.
  • AI Validation Enhancement: Integrated GitHub issue comments and linked Pull Request (PR) information into the AI validation analysis. Users can now opt to include comments in the AI analysis via a checkbox, providing more context to the AI model.
  • Work in Progress Indicator: Added a prominent 'Work in Progress' badge to the validation dialog when an issue has an open linked PR, alerting users that active development might be underway.
  • New API Endpoint: A new GraphQL endpoint (/api/github/issue-comments) was added to the server to fetch issue comments, supporting pagination.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Shironex Shironex self-assigned this Dec 28, 2025
@Shironex Shironex added Enhancement Improvements to existing functionality or UI. Do Not Merge Use this label if something should not be merged. labels Dec 28, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great addition, enabling the display of issue comments and integrating them into the AI validation process. The implementation is solid, with new backend endpoints, frontend hooks, and components that are well-structured. I've identified a few areas for improvement:

  • In list-comments.ts, the GraphQL query should use variables instead of string interpolation for better security and robustness.
  • There's some code duplication of TypeScript interfaces between validate-issue.ts and validation-schema.ts that can be refactored.
  • The date formatting for comments in the AI prompt should be standardized to avoid locale-specific issues.
  • A minor bug in the useIssueComments hook could cause stale error messages to persist in the UI.

Addressing these points will enhance the maintainability, correctness, and robustness of the new features. Overall, excellent work on this feature!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (10)
apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx (1)

153-168: Remove unnecessary duplicate filtering and case check.

The open PR filtering logic is performed twice—once in the conditional (line 154) and again when displaying PR numbers (lines 160-162). Additionally, the check for both 'open' and 'OPEN' is unnecessary because the PR state is always normalized to lowercase at the source (in list-issues.ts line 168 where it uses .toLowerCase()).

🔎 Proposed refactor to compute open PRs once
-            {/* Work in Progress Badge - Show when there's an open PR linked */}
-            {issue.linkedPRs?.some((pr) => pr.state === 'open' || pr.state === 'OPEN') && (
+            {(() => {
+              const openPRs = issue.linkedPRs?.filter((pr) => pr.state === 'open');
+              if (!openPRs || openPRs.length === 0) return null;
+              return (
               <div className="flex items-center gap-2 p-3 rounded-lg bg-purple-500/10 border border-purple-500/20">
                 <GitPullRequest className="h-5 w-5 text-purple-500 shrink-0" />
                 <div className="flex-1">
                   <span className="text-sm font-medium text-purple-500">Work in Progress</span>
                   <p className="text-xs text-muted-foreground mt-0.5">
-                    {issue.linkedPRs
-                      .filter((pr) => pr.state === 'open' || pr.state === 'OPEN')
-                      .map((pr) => `PR #${pr.number}`)
-                      .join(', ')}{' '}
+                    {openPRs.map((pr) => `PR #${pr.number}`).join(', ')}{' '}
                     is open for this issue
                   </p>
                 </div>
               </div>
-            )}
+              );
+            })()}

Note: The same dual-case check issue appears in apps/server/src/routes/github/routes/validation-schema.ts line 168 and should be simplified to pr.state === 'open'.

apps/server/src/routes/github/routes/validate-issue.ts (1)

38-54: Consider importing types from validation-schema.ts instead of redefining them.

The ValidationComment and ValidationLinkedPR interfaces are also defined in validation-schema.ts (per the relevant code snippets showing buildValidationPrompt signature). Importing them from there would reduce duplication.

apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (2)

65-72: Remove or guard debug console.log for production.

The console.log statement exposes internal state details. Consider removing it or guarding with a development-only check.

🔎 Suggested fix
-    console.log('[IssueDetailPanel] getValidationOptions:', {
-      includeCommentsInAnalysis,
-      commentsCount: comments.length,
-      linkedPRsCount: issue.linkedPRs?.length ?? 0,
-      willIncludeComments: !!options.comments,
-      willIncludeLinkedPRs: !!options.linkedPRs,
-    });
+    // Debug logging removed for production
     return options;

41-52: Comments expanded by default may impact performance on issues with many comments.

Starting with commentsExpanded: true and includeCommentsInAnalysis: true means comments are always fetched on mount. For issues with many comments, consider defaulting to collapsed or lazy-loading only when expanded.

libs/types/src/issue-validation.ts (1)

24-31: Consider a stricter type for state field.

The state field is typed as string, but GitHub PR states have a known set of values. A union type would provide better type safety.

🔎 Suggested improvement
 export interface LinkedPRInfo {
   number: number;
   title: string;
-  state: string;
+  state: 'open' | 'closed' | 'merged' | 'OPEN' | 'CLOSED' | 'MERGED';
 }
apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts (2)

219-226: Remove or guard debug console.log for production.

Similar to the issue-detail-panel, this debug logging should be removed or guarded for production builds.

🔎 Suggested fix
     const { forceRevalidate = false, comments, linkedPRs } = options;
-    console.log('[useIssueValidation] handleValidateIssue called with:', {
-      issueNumber: issue.number,
-      forceRevalidate,
-      commentsProvided: !!comments,
-      commentsCount: comments?.length ?? 0,
-      linkedPRsProvided: !!linkedPRs,
-      linkedPRsCount: linkedPRs?.length ?? 0,
-    });

264-269: Remove debug logging before API call.

This console.log should also be removed for production.

🔎 Suggested fix
           };
-          console.log('[useIssueValidation] Sending validation request:', {
-            hasComments: !!validationInput.comments,
-            commentsCount: validationInput.comments?.length ?? 0,
-            hasLinkedPRs: !!validationInput.linkedPRs,
-            linkedPRsCount: validationInput.linkedPRs?.length ?? 0,
-          });
           const result = await api.github.validateIssue(
apps/server/src/routes/github/routes/validation-schema.ts (3)

156-165: Consider standardizing the date format for AI consumption.

Line 161 uses toLocaleDateString(), which depends on the server's locale settings and may produce inconsistent formats across different environments. For AI prompts, a standardized format (e.g., ISO 8601 or a consistent pattern like YYYY-MM-DD) would be more reliable.

🔎 Proposed refactor to use ISO date string
     const commentsText = recentComments
-      .map((c) => `**${c.author}** (${new Date(c.createdAt).toLocaleDateString()}):\n${c.body}`)
+      .map((c) => `**${c.author}** (${new Date(c.createdAt).toISOString().split('T')[0]}):\n${c.body}`)
       .join('\n\n---\n\n');

158-164: Extract magic number to a named constant.

The value 10 for limiting comments appears in both the slice operation (line 159) and the display message (line 164). Extracting this to a named constant (e.g., MAX_COMMENTS_IN_PROMPT) would improve maintainability.

🔎 Proposed refactor
+const MAX_COMMENTS_IN_PROMPT = 10;
+
 /**
  * Build the user prompt for issue validation.
...
   let commentsSection = '';
   if (comments && comments.length > 0) {
     // Limit to most recent 10 comments to control prompt size
-    const recentComments = comments.slice(-10);
+    const recentComments = comments.slice(-MAX_COMMENTS_IN_PROMPT);
     const commentsText = recentComments
       .map((c) => `**${c.author}** (${new Date(c.createdAt).toLocaleDateString()}):\n${c.body}`)
       .join('\n\n---\n\n');

-    commentsSection = `\n\n### Comments (${comments.length} total${comments.length > 10 ? ', showing last 10' : ''})\n\n${commentsText}`;
+    commentsSection = `\n\n### Comments (${comments.length} total${comments.length > MAX_COMMENTS_IN_PROMPT ? `, showing last ${MAX_COMMENTS_IN_PROMPT}` : ''})\n\n${commentsText}`;
   }

187-187: Consider refactoring for improved readability.

Line 187 is complex with multiple conditional concatenations, making it harder to read and maintain. While functionally correct, breaking this into separate string building steps would improve clarity.

🔎 Proposed refactor for readability
+  // Build the closing instruction with contextual guidance
+  let closingInstruction = 'Scan the codebase to verify this issue. Look for the files, components, or functionality mentioned. Determine if this issue is valid, invalid, or needs clarification.';
+  
+  if (comments && comments.length > 0) {
+    closingInstruction += ' Consider the context provided in the comments as well.';
+  }
+  
+  if (hasWorkInProgress) {
+    closingInstruction += ' Also note in your analysis if there is already work in progress on this issue.';
+  }
+
   return `Please validate the following GitHub issue by analyzing the codebase:
 
 ## Issue #${issueNumber}: ${issueTitle}
 ${labelsSection}
 ${linkedPRsSection}
 
 ### Description
 
 ${issueBody || '(No description provided)'}
 ${commentsSection}
 ${workInProgressNote}
 
 ---
 
-Scan the codebase to verify this issue. Look for the files, components, or functionality mentioned. Determine if this issue is valid, invalid, or needs clarification.${comments && comments.length > 0 ? ' Consider the context provided in the comments as well.' : ''}${hasWorkInProgress ? ' Also note in your analysis if there is already work in progress on this issue.' : ''}`;
+${closingInstruction}`;
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61881d9 and 96196f9.

📒 Files selected for processing (17)
  • apps/server/src/routes/github/index.ts
  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view.tsx
  • apps/ui/src/components/views/github-issues-view/components/comment-item.tsx
  • apps/ui/src/components/views/github-issues-view/components/index.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/index.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
  • apps/ui/src/components/views/github-issues-view/types.ts
  • apps/ui/src/lib/electron.ts
  • apps/ui/src/lib/http-api-client.ts
  • libs/types/src/index.ts
  • libs/types/src/issue-validation.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always import from shared packages (@automaker/*), never from old relative paths

Files:

  • apps/server/src/routes/github/index.ts
  • apps/ui/src/components/views/github-issues-view/components/index.ts
  • apps/ui/src/components/views/github-issues-view.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/index.ts
  • apps/ui/src/components/views/github-issues-view/components/comment-item.tsx
  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/lib/electron.ts
  • apps/ui/src/lib/http-api-client.ts
  • apps/ui/src/components/views/github-issues-view/types.ts
  • libs/types/src/index.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • libs/types/src/issue-validation.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
apps/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket

Files:

  • apps/server/src/routes/github/index.ts
  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use resolveModelString() from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names

Files:

  • apps/server/src/routes/github/index.ts
  • apps/ui/src/components/views/github-issues-view/components/index.ts
  • apps/ui/src/components/views/github-issues-view.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/index.ts
  • apps/ui/src/components/views/github-issues-view/components/comment-item.tsx
  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/lib/electron.ts
  • apps/ui/src/lib/http-api-client.ts
  • apps/ui/src/components/views/github-issues-view/types.ts
  • libs/types/src/index.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • libs/types/src/issue-validation.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
🧬 Code graph analysis (5)
apps/server/src/routes/github/index.ts (2)
apps/server/src/middleware/validate-paths.ts (1)
  • validatePathParams (22-69)
apps/server/src/routes/github/routes/list-comments.ts (1)
  • createListCommentsHandler (139-183)
apps/server/src/routes/github/routes/list-comments.ts (3)
libs/types/src/index.ts (2)
  • IssueCommentsResult (100-100)
  • GitHubComment (99-99)
libs/types/src/issue-validation.ts (2)
  • IssueCommentsResult (177-186)
  • GitHubComment (161-172)
apps/server/src/routes/github/routes/check-github-remote.ts (1)
  • checkGitHubRemote (15-49)
apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (2)
apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts (1)
  • useIssueComments (16-133)
apps/ui/src/components/views/github-issues-view/components/comment-item.tsx (1)
  • CommentItem (10-40)
apps/server/src/routes/github/routes/validate-issue.ts (3)
libs/types/src/index.ts (2)
  • GitHubComment (99-99)
  • LinkedPRInfo (90-90)
libs/types/src/issue-validation.ts (2)
  • GitHubComment (161-172)
  • LinkedPRInfo (27-31)
apps/server/src/routes/github/routes/validation-schema.ts (1)
  • buildValidationPrompt (138-188)
libs/types/src/issue-validation.ts (2)
libs/types/src/index.ts (4)
  • LinkedPRInfo (90-90)
  • GitHubComment (99-99)
  • GitHubCommentAuthor (98-98)
  • IssueCommentsResult (100-100)
apps/ui/src/lib/electron.ts (2)
  • GitHubComment (29-29)
  • IssueCommentsResult (30-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e
🔇 Additional comments (20)
apps/server/src/routes/github/index.ts (1)

31-31: LGTM!

The new /issue-comments route follows the established pattern for list operations in this router, using the validatePathParams middleware consistently with other endpoints.

apps/ui/src/components/views/github-issues-view/components/comment-item.tsx (1)

1-40: LGTM!

The CommentItem component is well-structured with proper fallbacks for missing data (avatar and body). The use of the Markdown component for rendering comment bodies ensures rich content is displayed correctly.

apps/ui/src/components/views/github-issues-view.tsx (1)

21-22: LGTM!

The revalidation options flow is well-implemented with proper state management. The guard clause at line 241 ensures that revalidation only proceeds when both selectedIssue and pendingRevalidateOptions are present, preventing potential issues. The cleanup logic when the dialog closes (lines 231-233) is also correct, and the debug logging will be helpful for troubleshooting.

Also applies to: 209-246

apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts (1)

1-133: LGTM!

The useIssueComments hook is well-implemented with proper state management, error handling, and cleanup. Key strengths include:

  • Correct use of isMountedRef to prevent state updates after unmount
  • Proper distinction between initial loading and pagination (loading vs loadingMore)
  • State reset when issueNumber changes
  • Accurate dependency arrays in all useCallback and useEffect calls

The pagination logic correctly appends comments when loading more and replaces them on initial fetch or refresh.

apps/server/src/routes/github/routes/validate-issue.ts (2)

267-289: LGTM on the transformation logic.

The transformation from raw GitHubComment[] to ValidationComment[] correctly handles the optional author login with a 'ghost' fallback, matching the pattern used in the list-comments handler.


140-150: No action needed—model resolution already occurs within createSuggestionsOptions.

The model parameter is passed to createSuggestionsOptions(), which internally calls getModelForUseCase('suggestions', config.model) (line 303 of sdk-options.ts). The getModelForUseCase() function handles alias resolution by calling resolveModelString() regardless of whether an explicit model, environment variable, or default is used. This pattern is consistent across all factory functions like createSpecGenerationOptions().

Likely an incorrect or invalid review comment.

apps/ui/src/lib/http-api-client.ts (1)

769-770: LGTM!

The new getIssueComments method follows the established pattern for GitHub API methods and correctly passes the pagination cursor as an optional parameter.

apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (1)

273-341: Well-structured comments section with proper loading and error states.

The implementation correctly handles:

  • Expandable/collapsible UI with toggle state
  • Loading indicator during initial fetch
  • Error display
  • Empty state messaging
  • Pagination with disabled state during loading
libs/types/src/issue-validation.ts (1)

149-186: LGTM on new type definitions.

The GitHubCommentAuthor, GitHubComment, and IssueCommentsResult interfaces are well-structured with appropriate optional fields and comprehensive JSDoc documentation.

apps/server/src/routes/github/routes/list-comments.ts (1)

120-136: LGTM on the response mapping.

The transformation from GraphQL response to GitHubComment[] correctly handles nullable author with the 'ghost' fallback, and properly converts pagination info.

apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts (1)

256-263: LGTM on validation input construction.

The validationInput object correctly assembles all required fields and conditionally includes comments and linkedPRs when provided.

apps/ui/src/lib/electron.ts (3)

14-15: LGTM on type imports and re-exports.

The new types are correctly imported from @automaker/types (per coding guidelines) and re-exported for use by UI components.

Also applies to: 29-30


241-253: LGTM on GitHubAPI interface extension.

The getIssueComments method signature correctly includes the optional cursor parameter and returns a comprehensive result type with pagination info.


2806-2814: LGTM on mock implementation.

The mock correctly returns an empty comments array with appropriate pagination defaults, suitable for development/testing scenarios.

apps/ui/src/components/views/github-issues-view/types.ts (2)

16-24: LGTM on ValidateIssueOptions interface.

The new interface cleanly encapsulates all validation options, making the API more maintainable and extensible.


30-30: LGTM on updated prop types.

The signature changes for onValidateIssue and onShowRevalidateConfirm correctly propagate the new options structure through the component hierarchy.

Also applies to: 34-35

apps/server/src/routes/github/routes/validation-schema.ts (4)

106-122: LGTM!

The internal interfaces are well-structured and clearly document the shape of data expected for prompt building.


134-145: LGTM!

The function signature extension is backwards-compatible and well-documented. The optional parameters cleanly integrate comments and linked PR data into the validation workflow.


148-154: LGTM!

The linked PRs section formatting is clear and properly guarded against empty/undefined arrays.


167-171: The PR state is already normalized at the API boundary; simplify the check to only test for lowercase 'open'.

State normalization is already implemented in list-issues.ts where linked PRs are fetched:

state: (pr.state || '').toLowerCase()

Since the state is guaranteed to be lowercase at this point, the check for both 'open' and 'OPEN' is redundant. Update line 168 to:

linkedPRs && linkedPRs.some((pr) => pr.state === 'open')

Likely an incorrect or invalid review comment.

- Replace HTML checkbox with proper UI Checkbox component
- Add system prompt instructions for AI to check PR changes via gh CLI
- Add PRAnalysis schema field with recommendation (wait_for_merge, pr_needs_work, no_pr)
- Show detailed PR analysis badge in validation dialog
- Hide "Convert to Task" button when PR fix is ready (wait_for_merge)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/server/src/routes/github/routes/validation-schema.ts (1)

205-214: Date formatting should use locale-independent format.

Line 210 uses toLocaleDateString(), which can produce inconsistent formats depending on the server's locale. A previous review already flagged this issue.

Use ISO format for consistency:

🔎 Proposed fix
-      .map((c) => `**${c.author}** (${new Date(c.createdAt).toLocaleDateString()}):\n${c.body}`)
+      .map((c) => `**${c.author}** (${new Date(c.createdAt).toISOString().slice(0, 10)}):\n${c.body}`)
🧹 Nitpick comments (1)
apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx (1)

155-206: PR analysis UI looks good.

The conditional rendering and color-coding logic is correct. The nested ternaries are manageable, but if additional recommendation states are added in the future, consider extracting the icon/color/label mapping into a configuration object similar to verdictConfig.

🔎 Optional refactor: Extract PR analysis config
+const prAnalysisConfig: Record<
+  PRRecommendation,
+  { icon: typeof Clock; color: string; bgColor: string; borderColor: string; label: string }
+> = {
+  wait_for_merge: {
+    icon: Clock,
+    color: 'text-green-500',
+    bgColor: 'bg-green-500/10',
+    borderColor: 'border-green-500/20',
+    label: 'Fix Ready - Wait for Merge',
+  },
+  pr_needs_work: {
+    icon: Wrench,
+    color: 'text-yellow-500',
+    bgColor: 'bg-yellow-500/10',
+    borderColor: 'border-yellow-500/20',
+    label: 'PR Needs Work',
+  },
+  no_pr: {
+    icon: GitPullRequest,
+    color: 'text-purple-500',
+    bgColor: 'bg-purple-500/10',
+    borderColor: 'border-purple-500/20',
+    label: 'Work in Progress',
+  },
+};

Then simplify the rendering:

-            {validationResult.prAnalysis && validationResult.prAnalysis.hasOpenPR && (
+            {validationResult.prAnalysis && validationResult.prAnalysis.hasOpenPR && (() => {
+              const config = prAnalysisConfig[validationResult.prAnalysis.recommendation];
+              const Icon = config.icon;
+              return (
-              <div
-                className={cn(
-                  'p-3 rounded-lg border',
-                  validationResult.prAnalysis.recommendation === 'wait_for_merge'
-                    ? 'bg-green-500/10 border-green-500/20'
-                    : validationResult.prAnalysis.recommendation === 'pr_needs_work'
-                      ? 'bg-yellow-500/10 border-yellow-500/20'
-                      : 'bg-purple-500/10 border-purple-500/20'
-                )}
-              >
+                <div className={cn('p-3 rounded-lg border', config.bgColor, config.borderColor)}>
-                <div className="flex items-start gap-2">
-                  {validationResult.prAnalysis.recommendation === 'wait_for_merge' ? (
-                    <Clock className="h-5 w-5 text-green-500 shrink-0 mt-0.5" />
-                  ) : validationResult.prAnalysis.recommendation === 'pr_needs_work' ? (
-                    <Wrench className="h-5 w-5 text-yellow-500 shrink-0 mt-0.5" />
-                  ) : (
-                    <GitPullRequest className="h-5 w-5 text-purple-500 shrink-0 mt-0.5" />
-                  )}
+                  <div className="flex items-start gap-2">
+                    <Icon className={cn('h-5 w-5 shrink-0 mt-0.5', config.color)} />
-                  <div className="flex-1">
-                    <span
-                      className={cn(
-                        'text-sm font-medium',
-                        validationResult.prAnalysis.recommendation === 'wait_for_merge'
-                          ? 'text-green-500'
-                          : validationResult.prAnalysis.recommendation === 'pr_needs_work'
-                            ? 'text-yellow-500'
-                            : 'text-purple-500'
-                      )}
-                    >
-                      {validationResult.prAnalysis.recommendation === 'wait_for_merge'
-                        ? 'Fix Ready - Wait for Merge'
-                        : validationResult.prAnalysis.recommendation === 'pr_needs_work'
-                          ? 'PR Needs Work'
-                          : 'Work in Progress'}
-                    </span>
+                    <div className="flex-1">
+                      <span className={cn('text-sm font-medium', config.color)}>
+                        {config.label}
+                      </span>
                     {validationResult.prAnalysis.prNumber && (
                       <p className="text-xs text-muted-foreground mt-0.5">
                         PR #{validationResult.prAnalysis.prNumber}
                         {validationResult.prAnalysis.prFixesIssue && ' appears to fix this issue'}
                       </p>
                     )}
                     {validationResult.prAnalysis.prSummary && (
                       <p className="text-xs text-muted-foreground mt-1">
                         {validationResult.prAnalysis.prSummary}
                       </p>
                     )}
                   </div>
                 </div>
               </div>
+              );
+            })()}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96196f9 and 97ae4b6.

📒 Files selected for processing (5)
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • libs/types/src/index.ts
  • libs/types/src/issue-validation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/types/src/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always import from shared packages (@automaker/*), never from old relative paths

Files:

  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • libs/types/src/issue-validation.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use resolveModelString() from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names

Files:

  • apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx
  • libs/types/src/issue-validation.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
apps/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket

Files:

  • apps/server/src/routes/github/routes/validation-schema.ts
🧬 Code graph analysis (3)
apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx (2)
apps/ui/src/lib/utils.ts (1)
  • cn (5-7)
apps/ui/src/components/ui/button.tsx (1)
  • Button (108-108)
libs/types/src/issue-validation.ts (2)
libs/types/src/index.ts (6)
  • PRRecommendation (90-90)
  • PRAnalysis (91-91)
  • LinkedPRInfo (92-92)
  • GitHubComment (101-101)
  • GitHubCommentAuthor (100-100)
  • IssueCommentsResult (102-102)
apps/ui/src/lib/electron.ts (2)
  • GitHubComment (29-29)
  • IssueCommentsResult (30-30)
apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (3)
apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts (1)
  • useIssueComments (16-133)
apps/ui/src/components/views/github-issues-view/components/comment-item.tsx (1)
  • CommentItem (10-40)
apps/ui/src/components/views/github-issues-view/components/index.ts (1)
  • CommentItem (4-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e
🔇 Additional comments (16)
apps/ui/src/components/views/github-issues-view/dialogs/validation-dialog.tsx (2)

208-224: LGTM! Fallback badge logic is correct.

The fallback Work in Progress badge correctly displays when prAnalysis doesn't indicate an open PR but linkedPRs data shows open PRs. The case-insensitive state check handles potential API variations well.


295-302: LGTM! Convert to Task button condition is correct.

The additional check to hide the button when prAnalysis.recommendation === 'wait_for_merge' is logical. If a PR is ready to merge and fixes the issue, converting to a task would be redundant.

apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (5)

42-53: LGTM! Comments state and hook integration looks good.

The state initialization and useIssueComments hook integration is correct. The hook properly handles null issue numbers, and all destructured values are used in the UI.


55-74: LGTM! Validation options helper is well-structured.

The getValidationOptions helper correctly builds validation options with conditional comment inclusion and linked PR mapping. The debug logging is helpful for development.


111-111: LGTM! Validation handler updates are consistent.

All validation handlers now correctly pass enriched options (including comments and linked PRs) via getValidationOptions. The forceRevalidate flag is appropriately set for re-validation scenarios.

Also applies to: 130-130, 140-148


274-303: LGTM! Comments section header implementation is solid.

The collapsible header with loading states, comment count, and the conditional AI analysis checkbox is well-implemented. Good use of semantic HTML and accessibility patterns.


305-340: LGTM! Comments content rendering is well-structured.

The conditional rendering handles error, empty, and loaded states appropriately. The pagination with "Load More" button and proper loading states provides good UX.

libs/types/src/issue-validation.ts (3)

24-52: LGTM! PR-related types are well-defined.

The new PR analysis types are properly structured with appropriate required/optional fields and clear JSDoc comments.


173-209: LGTM! Comment types align with GitHub API structure.

The comment-related types properly model GitHub's comment structure and pagination mechanism with cursor-based pagination.


58-67: LGTM! Validation type extensions are backward compatible.

The additions to IssueValidationInput and IssueValidationResult are properly typed and maintain backward compatibility with all fields being optional.

Also applies to: 77-99

apps/server/src/routes/github/routes/validation-schema.ts (6)

52-79: LGTM! PR analysis schema is correctly defined.

The schema extension for prAnalysis properly matches the TypeScript types and allows for optional fields within the object.


120-146: LGTM! PR analysis instructions are comprehensive.

The system prompt clearly guides the AI to analyze linked PRs using GitHub CLI commands and provides well-defined recommendation criteria. The emphasis on critical analysis is appropriate.


155-171: LGTM! Internal validation interfaces are appropriately simplified.

These internal interfaces provide a lightweight representation for prompt construction, reducing token usage while preserving essential context.


187-194: LGTM! Function signature extension is backward compatible.

The addition of optional comments and linkedPRs parameters maintains backward compatibility and is properly documented.


197-203: LGTM! Linked PRs section construction is clear.

The linked PRs are formatted clearly for the AI prompt with PR number, state, and title.


216-236: LGTM! Prompt assembly logic is well-structured.

The work-in-progress detection and conditional prompt assembly correctly incorporate comments and PR context. The case-insensitive state check handles API variations appropriately.

- Use GraphQL variables instead of string interpolation for safety
- Add cursor validation to prevent potential GraphQL injection
- Add 30s timeout for spawned gh process to prevent hanging
- Export ValidationComment and ValidationLinkedPR from validation-schema
- Remove duplicate interface definitions from validate-issue.ts
- Use ISO date format instead of locale-dependent toLocaleDateString()
- Reset error state when issue is deselected in useIssueComments hook

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/server/src/routes/github/routes/validate-issue.ts (1)

99-101: Debug logging exposes comment author usernames.

This concern was previously flagged. Logging author names (comments.map((c) => c.author).join(', ')) could be considered PII in certain compliance contexts. Consider logging only the count instead.

🧹 Nitpick comments (2)
apps/server/src/routes/github/routes/validation-schema.ts (2)

52-79: Consider adding internal required fields to prAnalysis.

The prAnalysis object doesn't specify which of its properties are required when present. If Claude returns a prAnalysis object, it might omit critical fields like hasOpenPR or recommendation. Consider adding a nested required array.

🔎 Suggested improvement
     prAnalysis: {
       type: 'object',
       properties: {
         hasOpenPR: {
           type: 'boolean',
           description: 'Whether there is an open PR linked to this issue',
         },
         prFixesIssue: {
           type: 'boolean',
           description: 'Whether the PR appears to fix the issue based on the diff',
         },
         prNumber: {
           type: 'number',
           description: 'The PR number that was analyzed',
         },
         prSummary: {
           type: 'string',
           description: 'Brief summary of what the PR changes',
         },
         recommendation: {
           type: 'string',
           enum: ['wait_for_merge', 'pr_needs_work', 'no_pr'],
           description:
             'Recommendation: wait for PR to merge, PR needs more work, or no relevant PR',
         },
       },
+      required: ['hasOpenPR', 'recommendation'],
       description: 'Analysis of linked pull requests if any exist',
     },

218-219: Consider normalizing state comparison with toLowerCase().

The current check handles 'open' and 'OPEN' explicitly, but API responses might vary. Using toLowerCase() would be more robust against case variations.

🔎 Suggested improvement
   const hasWorkInProgress =
-    linkedPRs && linkedPRs.some((pr) => pr.state === 'open' || pr.state === 'OPEN');
+    linkedPRs && linkedPRs.some((pr) => pr.state.toLowerCase() === 'open');
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97ae4b6 and 6bdac23.

📒 Files selected for processing (4)
  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always import from shared packages (@automaker/*), never from old relative paths

Files:

  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
apps/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket

Files:

  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use resolveModelString() from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names

Files:

  • apps/server/src/routes/github/routes/list-comments.ts
  • apps/server/src/routes/github/routes/validation-schema.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts
  • apps/server/src/routes/github/routes/validate-issue.ts
🧬 Code graph analysis (2)
apps/server/src/routes/github/routes/list-comments.ts (3)
libs/types/src/index.ts (2)
  • IssueCommentsResult (102-102)
  • GitHubComment (101-101)
libs/types/src/issue-validation.ts (2)
  • IssueCommentsResult (200-209)
  • GitHubComment (184-195)
apps/server/src/routes/github/routes/check-github-remote.ts (1)
  • checkGitHubRemote (15-49)
apps/server/src/routes/github/routes/validate-issue.ts (3)
libs/types/src/index.ts (2)
  • GitHubComment (101-101)
  • LinkedPRInfo (92-92)
libs/types/src/issue-validation.ts (2)
  • GitHubComment (184-195)
  • LinkedPRInfo (48-52)
apps/server/src/routes/github/routes/validation-schema.ts (3)
  • ValidationComment (158-162)
  • ValidationLinkedPR (167-171)
  • buildValidationPrompt (187-239)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e
🔇 Additional comments (12)
apps/server/src/routes/github/routes/validate-issue.ts (4)

11-26: LGTM! Imports are correctly organized.

The imports properly use @automaker/types for external types (GitHubComment, LinkedPRInfo) and import the internal validation types (ValidationComment, ValidationLinkedPR) from the local schema file. This aligns with the coding guidelines requiring shared package imports.


51-54: LGTM!

The request body extension correctly uses the types from @automaker/types and makes both fields optional, which aligns with backward compatibility.


255-267: LGTM!

The transformation logic correctly maps the external types to internal validation types. Using 'ghost' as a fallback for missing authors follows GitHub's convention for deleted users.


320-333: LGTM!

The validation call correctly passes the transformed comments and linked PRs while maintaining the existing fire-and-forget pattern with proper error handling in the .catch() and .finally() blocks.

apps/server/src/routes/github/routes/validation-schema.ts (4)

89-153: LGTM!

The system prompt is well-structured with clear instructions for analyzing linked PRs. The guidance for using gh pr diff and gh pr view commands is appropriate, and the recommendation values match the schema enum.


155-171: LGTM!

The interfaces are well-defined and exported, which resolves the prior DRY concern about duplicate definitions. The types correctly represent the minimal data needed for prompt construction.


205-216: LGTM!

The comments section correctly limits to the 10 most recent comments to control prompt size, uses locale-independent ISO date formatting (addressing prior feedback), and clearly indicates when comments are truncated.


224-238: LGTM!

The prompt construction is well-organized with clear markdown sections. The conditional suffixes appropriately guide the AI to consider comments and ongoing work when relevant.

apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts (1)

1-134: LGTM! Past review feedback has been addressed.

The hook implementation is well-structured with proper state management, error handling, and cleanup. The previous issue regarding error state not being reset when an issue is deselected has been resolved (line 104 now includes setError(null)). The use of isMountedRef to prevent state updates on unmounted components is a good pattern, and all React hooks are used correctly with appropriate dependencies.

apps/server/src/routes/github/routes/list-comments.ts (3)

52-69: LGTM! Security validation properly implemented.

The cursor validation addresses the previous security concern about potential GraphQL injection. The base64 pattern check is appropriate for GraphQL cursors.


72-137: LGTM! Previous review feedback has been fully addressed.

The implementation now properly:

  • Uses GraphQL variables instead of string interpolation (lines 97-102), improving security and handling of special characters
  • Implements a 30-second timeout (lines 112-116) to prevent hanging requests
  • Clears the timeout on process completion (line 124)

All previous security and reliability concerns have been resolved.


168-212: Verify if event emission is required per coding guidelines.

The handler implementation is solid with proper validation and error handling. However, the coding guidelines specify: "Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket."

Since this is a server operation, please verify whether event emission should be added for consistency with other server operations, or if this guideline applies only to long-running operations.

As per coding guidelines, server operations should use createEventEmitter() for streaming updates to the frontend.

Remove console.log and logger.debug calls that were added during
development. Keep essential logger.info and logger.error calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/server/src/routes/github/routes/validate-issue.ts (1)

236-254: LGTM! PII logging concern resolved.

The transformation logic correctly converts public API types to internal validation types, using safe optional chaining with the GitHub-standard 'ghost' fallback for deleted users.

The logging at lines 250-254 now uses counts instead of author names, properly addressing the PII exposure concern raised in previous reviews.

💡 Optional: Extract transformation logic for testability

The transformation logic is simple and correct as-is, but if you anticipate more complex transformations in the future, consider extracting these into testable helper functions:

function toValidationComment(comment: GitHubComment): ValidationComment {
  return {
    author: comment.author?.login || 'ghost',
    createdAt: comment.createdAt,
    body: comment.body,
  };
}

function toValidationLinkedPR(pr: LinkedPRInfo): ValidationLinkedPR {
  return {
    number: pr.number,
    title: pr.title,
    state: pr.state,
  };
}

// Then use:
const validationComments = rawComments?.map(toValidationComment);
const validationLinkedPRs = rawLinkedPRs?.map(toValidationLinkedPR);

This would make the transformations easier to unit test and maintain.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bdac23 and d028932.

📒 Files selected for processing (3)
  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always import from shared packages (@automaker/*), never from old relative paths

Files:

  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
apps/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket

Files:

  • apps/server/src/routes/github/routes/validate-issue.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use resolveModelString() from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names

Files:

  • apps/server/src/routes/github/routes/validate-issue.ts
  • apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts
  • apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx
🧬 Code graph analysis (2)
apps/server/src/routes/github/routes/validate-issue.ts (3)
libs/types/src/index.ts (2)
  • GitHubComment (101-101)
  • LinkedPRInfo (92-92)
libs/types/src/issue-validation.ts (2)
  • GitHubComment (184-195)
  • LinkedPRInfo (48-52)
apps/server/src/routes/github/routes/validation-schema.ts (3)
  • ValidationComment (158-162)
  • ValidationLinkedPR (167-171)
  • buildValidationPrompt (187-239)
apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (2)
apps/ui/src/components/views/github-issues-view/hooks/use-issue-comments.ts (1)
  • useIssueComments (16-134)
apps/ui/src/components/views/github-issues-view/components/comment-item.tsx (1)
  • CommentItem (10-40)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e
🔇 Additional comments (10)
apps/server/src/routes/github/routes/validate-issue.ts (2)

24-25: LGTM! Duplicate interfaces resolved.

The interfaces are now properly imported from validation-schema.ts instead of being duplicated, addressing the DRY concern raised in previous reviews.


72-74: LGTM! Integration of comments and linked PRs is sound.

The new optional parameters are correctly threaded through the validation pipeline:

  • Function signature extended at lines 72-74
  • Prompt building updated at lines 93-101 to include the new context
  • Transformed parameters passed through at lines 311-313

The implementation properly maintains backward compatibility while enabling richer validation context.

Also applies to: 93-101, 311-313

apps/ui/src/components/views/github-issues-view/components/issue-detail-panel.tsx (5)

1-26: LGTM!

Imports are well-organized. The new icons (MessageSquare, ChevronDown, ChevronUp), Checkbox component, and the custom hooks/components are appropriately imported from their respective locations. As per coding guidelines, the shared packages use the @/ alias pattern correctly.


42-53: LGTM!

State initialization and hook integration look good. The defaults (commentsExpanded: true, includeCommentsInAnalysis: true) provide a sensible default UX. The refresh function from the hook is available if needed later for manual refresh functionality.


55-66: LGTM!

The helper function cleanly centralizes validation options construction. The conditional inclusion of comments (includeCommentsInAnalysis && comments.length > 0) and the selective mapping of linkedPRs (extracting only number, title, state) are appropriately implemented.


100-140: LGTM!

The validation handlers consistently use getValidationOptions() with appropriate forceRevalidate values. The pattern correctly differentiates between re-validation (line 103, 122) and initial validation (line 135).


266-332: Well-structured comments section with proper state handling.

The UI correctly handles all states: loading, error, empty, and populated with pagination. The expand/collapse toggle, conditional checkbox visibility, and load-more functionality are cleanly implemented.

apps/ui/src/components/views/github-issues-view/hooks/use-issue-validation.ts (3)

1-13: LGTM!

Import changes follow the coding guidelines correctly. LinkedPRInfo is imported from the shared package @automaker/types as required, and GitHubComment is imported from the local electron abstraction layer.


209-218: LGTM!

The updated signature is backward-compatible with the default empty object. The inline type definition clearly documents the expected options structure. This aligns well with the getValidationOptions helper in IssueDetailPanel.


248-259: LGTM!

The validationInput object is cleanly constructed with proper fallbacks (issue.body || ''). The optional comments and linkedPRs fields will be passed through to the API, where undefined values are appropriately handled by not being included in the request payload.

@Shironex Shironex merged commit cc42b79 into main Dec 28, 2025
8 checks passed
@Shironex Shironex deleted the feat/github-issue-comments branch December 28, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Use this label if something should not be merged. Enhancement Improvements to existing functionality or UI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants