From 467b50d40602ed39058d208aaede69b34f1b4b4c Mon Sep 17 00:00:00 2001 From: Ganesh Kumar Date: Thu, 7 May 2026 21:40:31 +0530 Subject: [PATCH 1/2] Remove Severity Metadata, Refactor GitHub Replies, and Fix ConnectorForm State Management LiveReview Pre-Commit Check: ran (iter:3, coverage:85%) --- internal/api/webhook_orchestrator_v2.go | 3 -- .../provider_output/github/output_client.go | 29 +++++++++---------- .../AIProviders/components/ConnectorForm.tsx | 13 +++++++-- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/internal/api/webhook_orchestrator_v2.go b/internal/api/webhook_orchestrator_v2.go index 76c666dc..add5ec2f 100644 --- a/internal/api/webhook_orchestrator_v2.go +++ b/internal/api/webhook_orchestrator_v2.go @@ -837,9 +837,6 @@ func (wo *WebhookOrchestratorV2) formatReviewComments(comments []UnifiedReviewCo for i, comment := range comments { result += fmt.Sprintf("**%d. %s**", i+1, comment.FilePath) - if comment.Severity != "" { - result += fmt.Sprintf(" (%s)", comment.Severity) - } result += "\n" if comment.LineNumber > 0 { result += fmt.Sprintf(" Line %d: ", comment.LineNumber) diff --git a/internal/provider_output/github/output_client.go b/internal/provider_output/github/output_client.go index d65b2de6..f87184c4 100644 --- a/internal/provider_output/github/output_client.go +++ b/internal/provider_output/github/output_client.go @@ -49,9 +49,9 @@ func (c *APIClient) PostCommentReply(event *UnifiedWebhookEventV2, token, replyT apiURL := fmt.Sprintf("https://api.github.com/repos/%s/issues/%d/comments", event.Repository.FullName, event.MergeRequest.Number) - requestBody := map[string]interface{}{ - "body": replyText, - } + + requestBody := make(map[string]interface{}) + requestBody["body"] = replyText if event.Comment.Position != nil { replyTarget := event.Comment.ID @@ -66,21 +66,20 @@ func (c *APIClient) PostCommentReply(event *UnifiedWebhookEventV2, token, replyT } else { apiURL = fmt.Sprintf("https://api.github.com/repos/%s/pulls/%d/comments", event.Repository.FullName, event.MergeRequest.Number) - requestBody = map[string]interface{}{ - "body": replyText, - "in_reply_to": inReplyToInt, - } + requestBody["in_reply_to"] = inReplyToInt } } - } else if event.Comment.InReplyToID != nil && *event.Comment.InReplyToID != "" { - inReplyToInt, err := strconv.Atoi(*event.Comment.InReplyToID) - if err != nil { - log.Printf("[WARN] Failed to convert in_reply_to ID to integer: %v, using issue comment endpoint without thread linkage", err) - } else { - requestBody = map[string]interface{}{ - "body": replyText, - "in_reply_to": inReplyToInt, + } else { + // For general comments (Position == nil), GitHub doesn't support threaded replies via API for issue comments. + // Prefix the reply with a blockquote of the original comment body to indicate what we are replying to. + bodyText := strings.TrimSpace(event.Comment.Body) + if bodyText != "" { + var quoted strings.Builder + for _, line := range strings.Split(bodyText, "\n") { + quoted.WriteString("> " + line + "\n") } + quoted.WriteString("\n\n") + requestBody["body"] = quoted.String() + replyText } } diff --git a/ui/src/pages/AIProviders/components/ConnectorForm.tsx b/ui/src/pages/AIProviders/components/ConnectorForm.tsx index e04c882a..e0bd4b67 100644 --- a/ui/src/pages/AIProviders/components/ConnectorForm.tsx +++ b/ui/src/pages/AIProviders/components/ConnectorForm.tsx @@ -65,11 +65,18 @@ const ConnectorForm: React.FC = ({ const usesCustomModel = !!currentModelValue && !providerModels.includes(currentModelValue); const shouldShowCustomModelInput = customModelMode || usesCustomModel; + // Sync custom mode when provider changes or model becomes valid React.useEffect(() => { - if (!usesCustomModel) { + setCustomModelMode(false); + }, [currentProvider]); + + React.useEffect(() => { + // Auto-exit custom mode only if the model matches a standard one and is non-empty. + // This prevents the input from disappearing while the user is actively typing. + if (!usesCustomModel && formData.selectedModel !== '') { setCustomModelMode(false); } - }, [currentProvider, usesCustomModel]); + }, [usesCustomModel, formData.selectedModel]); // Validation rules const isValidForm = () => { @@ -199,7 +206,7 @@ const ConnectorForm: React.FC = ({