Skip to content

perf(github): load PR conversations without duplicate REST requests - #34747

Merged
OrcaWin merged 5 commits into
mainfrom
OrcaWin/github-conversation-requests
Oct 29, 2026
Merged

OrcaWin merged 5 commits into
mainfrom
OrcaWin/github-conversation-requests

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​258 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​258
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​249 $\color{#cf222e}{\Huge{\mathbf{−}}}$​191 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58

ELI5

Opening a PR conversation currently asks GitHub three times for information already present in one response. Use that response directly: a complete conversation now costs one GraphQL request and zero REST requests, with the same refresh timing.

What Changed

  • Fetch issue comments, review summaries, inline comments, reactions, and thread resolution from the existing GraphQL query. Valid empty lists count as successful results.
  • Recover only missing or failed issue-comment/review sources through REST. Preserve partial GraphQL data even when gh exits nonzero, and retain successful sources when another fails.
  • Ignore comments without usable numeric IDs individually so other inline comments remain available. Use review submission timestamps so submitted drafts sort correctly.
  • Share simultaneous conversation reads, with separate identities for explicit refreshes, repository hosts, credentials, SSH connections, and WSL runtimes. Completed reads are not retained, so subsequent reads still refresh thread resolution immediately.
  • Check REST budget only when a REST fallback is needed; exhausted REST quota no longer prevents a complete GraphQL conversation read. When recovery needs unavailable REST quota, preserve the quota error so callers retain their previous comments.

Why

The existing GraphQL response already contains these sources. Reading it once saves quota and subprocesses at the same refresh cadence, while source-specific fallbacks preserve the conversation when only one API source fails.

Linked Issue

Follow-up to #28778; independently mergeable.

Visual Proof

N/A — no UI or interaction changes; the same conversation data is loaded through fewer API calls.

Testing

  • Existing comment reaction and local/SSH/WSL/Enterprise routing suites: 9 tests passed.
  • Final comment reaction, request reuse, partial failure, nullable-ID, quota-error preservation, review submission ordering, and runtime-routing suites: 19 tests passed across 3 files.
  • Live queries against fix(github): count gh pr and issue commands against the GraphQL rate limit #28778 and this PR: successful, GraphQL cost 1; the latest query returns all three conversation sources and review submission timestamps.
  • pnpm check:changed --maxWorkers=2: all 20 checks passed (895 affected test files recorded without failures). The gate started before the nullable-ID, quota-error, and timestamp follow-ups. Those follow-ups passed the final 19 focused tests and the latest CI aggregate gate, all five unit-test shards, relay integration, and Linux/Windows packaging. Automated review passed. Only JavaScript/TypeScript CodeQL analysis remains running; no checks are failing.
  • Lint and formatting passed. Live production conversation read against this PR returned issue/review/inline comments and reaction subjects successfully.
  • Executed on Linux; cross-platform process routing is unchanged. No RPC changes; desktop, mobile, remote repositories, and folder workspaces keep the existing API contract.

Agent skill upstream boundary

  • Not applicable; no skill-installer source or artifacts changed.

Review

Self-reviewed response validation, per-source recovery, quota independence, and concurrent-read isolation. No provider-neutral or GitLab behavior changes.

Notes

The existing API contract serves desktop, mobile, remote repositories, and folder workspaces; no platform-specific subprocess or RPC changes.

Checklist

  • Focused change with before/after behavior and rationale
  • Automated regression coverage, lint, and formatting
  • Visual proof N/A: no UI changes
  • Cross-platform, remote, mobile, and folder workspace behavior considered
  • Full affected gate passed; later fixes verified separately by focused tests
  • Latest follow-up CI aggregate gate and automated review passed
  • JavaScript/TypeScript CodeQL completed; still running

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds parsers for GraphQL conversation responses and REST comments. Pull request reads use available GraphQL data and request REST data for missing sources. Matching concurrent reads share a request. Tests cover fallback behavior, quota handling, and separation by read options and execution scope.

Priority: Low

Merge Risk: Low · up to bda63

Concurrent PR conversation reads can run with the wrong execution tier; include that option in the coalescing key before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Agent skill upstream boundary, Notes, and Checklist sections. The ELI5 and… Add a real linked issue in the 'Fixes #' line. If the PR cannot link an issue, state why and confirm the maintainer exception applies. Tick or clarify the 'I manually tested these changes locally' item, since the Testing section reports liv…
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "perf(github): load PR conversations without duplicate REST requests" matches the main change. The changeset reads PR conversations from one GraphQL response and uses REST only to recover mi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "perf(github): load PR conversations without duplicate REST requests" matches the main change. The changeset reads PR conversations from one GraphQL response and uses REST only to recover missing or failed issue-comment and review sources, and the new tests cover REST quota and request reuse. The title is specific and follows the conventional-commit style. It does not mention the shared in-flight reads or the quota-error handling, but it does not need to cover every detail.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Agent skill upstream boundary, Notes, and Checklist sections. The ELI5 and What Changed sections explain the before and after behavior and the mechanism. The Why section explains the quota and subprocess savings. The Visual Proof section gives N/A with a reason. The Testing section lists the suites run and the platform tested (Linux). Gaps: the Linked Issue section links only a follow-up to #28778 and does not use the required 'Fixes #' form for an actual issue, which the template says outside contributors must include. The AI Disclosure and Review sections are partly filled. The manual-testing checkbox is not ticked, and the Testing section does not state that manual testing was done. The CodeQL checkbox is open, and the description says so.

Resolution

Add a real linked issue in the 'Fixes #' line. If the PR cannot link an issue, state why and confirm the maintainer exception applies. Tick or clarify the 'I manually tested these changes locally' item, since the Testing section reports live queries and a Linux run but not a manual test. Complete the AI Disclosure section if an AI model was used, or confirm the author is a StablyAI team member. Mark the Review and Testing items in the checklist accurately once CodeQL finishes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96ca1bc4-1fdc-48f5-bb79-d8233b0ae2dc
Commits

Reviewing files that changed from the base of the PR and between 57c2b53 and 7ed8890.

Files selected for processing: 3
  • src/main/github/client-pr-conversation-requests.test.ts
  • src/main/github/client/fetch/get-pr-comments.ts
  • src/main/github/client/fetch/pr-conversation-response.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Use submittedAt for GraphQL review summaries. · pr-conversation-response.ts:63-83

src/main/github/client/fetch/pr-conversation-response.ts:63-83
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use submittedAt for GraphQL review summaries.

GitHub defines PullRequestReview.createdAt as creation time and submittedAt as submission time. When a draft review is submitted later, the current GraphQL path sorts it and displays its relative time using the draft creation time. The REST paths already use submitted_at.

Suggested fix
 const commentSchema = z.object({
   id: z.string(),
   databaseId: z.number().nullable(),
   author: z
     .object({ __typename: z.string().optional(), login: z.string(), avatarUrl: z.string() })
     .nullable(),
   body: z.string().nullish(),
   createdAt: z.string(),
+  submittedAt: z.string().nullish(),
   url: z.string(),
   reactionGroups: z
@@
-    createdAt: comment.createdAt,
+    createdAt: comment.submittedAt ?? comment.createdAt,
           body
           createdAt
+          submittedAt
           url

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2a78862-95a7-471d-b139-a178d9b69c9c
Commits

Reviewing files that changed from the base of the PR and between 7ed8890 and ae66c80.

Files selected for processing: 2
  • src/main/github/client-pr-conversation-requests.test.ts
  • src/main/github/client/fetch/pr-conversation-response.ts
Files skipped from review as they are similar to previous changes: 2
  • src/main/github/client-pr-conversation-requests.test.ts
  • src/main/github/client/fetch/pr-conversation-response.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Include admissionTier in the coalescing key. · get-pr-comments.ts:155-164

src/main/github/client/fetch/get-pr-comments.ts:155-164
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include admissionTier in the coalescing key.

When two non-forced callers use different localGitOptions.admissionTier values, the current key is identical. The second caller can therefore reuse the first caller’s in-flight promise and run with the first caller’s GitHub execution options.

Suggested fix
   const key = JSON.stringify([
     repoPath,
     prNumber,
     options?.prRepo ?? null,
     connectionId ?? null,
+    localGitOptions.admissionTier ?? null,
     githubReadExecutionScope(localGitOptions)
   ])

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: afe22e77-7b19-475d-9ef7-3cff91a027f9
Commits

Reviewing files that changed from the base of the PR and between 3d6eff0 and bda6331.

Files selected for processing: 4
  • src/main/github/client-pr-conversation-requests.test.ts
  • src/main/github/client/fetch/get-pr-comments.ts
  • src/main/github/client/fetch/pr-conversation-response.ts
  • src/main/github/client/fetch/pr-review-threads-query.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@OrcaWin
OrcaWin merged commit 127487f into main Oct 29, 2026
43 checks passed
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