Repository navigation
Description
Context
Approved design #3795 §7 puts a "Show n line comments" control on each review event; the November 10 ruling approved revision 2 and the §8 fields. The delivered kit already accepts the count and callback (GitHubReviewProps, packages/ui-kit/src/github/GitHubReview.tsx:21-31; GitHubReview, :33-60).
At inspected main 564a1d57f547e64f8c7f4de0ca57d362fdfc8ac3, the shared review has no count (GITHUB_REVIEW_SCHEMA, packages/ui-sdk/src/tool-contracts/github.ts:204-211), and the initial PR read fetches reviews without review comments (review, packages/ui-server/src/github/host.ts:171-176; read, :327-369). The existing detail route maps pull_request_review_id to review_id (reviewComment, packages/ui-server/src/github/details.ts:146-154) and pages PR review comments (page, :261-299). GITHUB_LIMITS (packages/ui-sdk/src/tool-contracts/github.ts:49-70) bounds comments at 30.
GitHub's REST API description, inspected 2026-11-17, gives review comments a nullable pull_request_review_id and exposes /repos/{owner}/{repo}/pulls/{pull_number}/comments; its review object has no per-review count. Derive counts from validated bounded comment data, never an assumed API count field or review body text.
#3795's active draft #4146 currently uses a single PR-wide "Show line comments" fallback and explicitly files this follow-up. Its renderer is still absent from inspected main. Consume its delivered renderer output for this integration; SDK/server preparation can be independent. This follow-up preserves #3795's approved acceptance criteria and grants no waiver for its draft.
Blocked by #3795
Out of scope
New visual design or ui-kit changes; new GitHub tool names/inputs or general endpoints; unbounded pagination or one count request per review; polling/live updates; exposing comment bodies in the initial tool result; altering credentials, G2 routing, taint, approval, direct-link or avatar rules. Preserve the existing owner-only display route and append-only provider history.
Scope
- Contract: extend the shared review payload with
line_comments: number | null. A number is a known nonnegative integer total for that review;nullis unknown. All producers using this review schema, including display-only review pages, remain valid. Consumers replaying older payloads with no field treat absence as unknown rather than invalidating otherwise valid cards. - Host: group validated PR review comments by
pull_request_review_idwithin existing request, page, response-size and timeout bounds. Emit exact counts only when the bounded collection proves completeness. Missing/malformed association data, truncation, more pages or other incomplete evidence must not produce a partial total or invented zero. Zero is valid only when complete evidence establishes none. Preserve existing typed error handling and request governance. - Renderer: use feat(ui-react): render the host GitHub tools as the ui-kit GitHub components (#3795) #4146's eventual
github-tools.tsx/github-mapping.tsintegration to pass known positive counts to the unchangedGitHubReviewcontrol. Load through ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796's existingreview-commentsdetail route after the reader acts, filter pages to the selectedreview_id, and put only that review's comments in its children. Retain bounded user-driven pagination/retry and the approved S0–S7 states. Replace the PR-wide fallback for this behavior.
Acceptance criteria
- The typed review and contract documentation carry the nullable count; negative, fractional and malformed counts are rejected. Older payloads without it remain renderable as unknown. Initial-read and detail-review producers satisfy the shared schema.
- A complete bounded fixture containing multiple reviews yields each exact total, including a genuine zero. A partial/capped collection or unvalidated membership yields unknown for every count it cannot establish; no partial value is labelled exact. Tests assert bounded request counts and preserve ordinary-issue behavior.
- Each known positive count renders "Show n line comments" on that review. Zero, null and legacy absence show no count control. The global fallback is retired.
- No browser detail request occurs before the reader acts. Loading/paging/retrying one review never renders another review's comments, and sparse filtered pages preserve truthful continuation/empty/error states without automatic unbounded draining.
- Count enrichment adds metadata only to new results. Display-only bodies, loaded state and retries never alter the chat store, "Brain read" provenance or provider-facing history. Existing origin, URL validation, avatar, G2 and taint protections remain effective.
- Line comments can load for every review that has them, including when the read result carries none of the PR's reviews (added 2026-11-17, from feat(ui-react): render the host GitHub tools as the ui-kit GitHub components (#3795) #4146's review).
Verification
Extend packages/ui-sdk/tests/github-tool-contract.test.ts, packages/ui-server/tests/github-tools-host.test.ts and github-details.test.ts, plus #4146's renderer and real browser tests. Use offline Odysseus fixtures for complete/multiple-review, zero, null/missing, malformed association, more-page and cap cases. Assert both truthful totals and bounded calls; a mutation counting a partial page or removing the review_id filter must fail its named assertion. Browser proof covers user-triggered loading, pagination isolation, S0–S7 and unchanged provider history; run the keyless provider-history guard and bun run check:pr --base origin/main for implementation. No new runtime proof is claimed by this triage.
Contract impact
Additive review-result metadata in the shared GitHub tool contract: update docs/integration-contract/mcp.md#host-github-tools-additive-0450-3797, its package-API component as applicable, and the index in the same CONTRACT: commit, with the required minor-release changeset. Keep existing names, input schemas, field meanings and history bytes stable; implement legacy-absence handling. Preserve the current priority p2 ranking and 0.45.0 milestone; the milestone was added concurrently and is retained by triage.
2026-11-17 triage: verified the missing field, upstream association and existing component/detail interfaces; completed scope, exclusions, bounds, compatibility and proof criteria. #3791 owns the full payload/detail/component outcome. The complete brief has no unresolved needs: prerequisite; readiness can coexist with the renderer-delivery blocker above.
Activity
schlessera commentedon Nov 17, 2026
From #4146's review: until this lands, the PR-wide "Show line comments" section mounts only when the read result carries review items (
pr.reviews.items.length > 0). A pull request whose result carries no review items, though GitHub has reviews with line comments (more reviews than the payload holds), cannot load its line comments. The per-review trigger this issue adds replaces that section. Its condition should come from the per-review count, not from whether the result happened to carry reviews.Added criterion: line comments can load for every review that has them, including when the read result carries none of the PR's reviews.
schlessera commentedon Nov 17, 2026
Unblocked: #3795 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Nov 17, 2026
Claimed for implementation. Claim token:
claim-db2c3335. Branch:feat/4147-per-review-line-comment-count.collisions: closure-only overlaps with open drafts; no path collision. #4154 is worked in parallel in the same GitHub UI area.
schlessera commentedon Nov 17, 2026
Decision (maintainer, 2026-11-17): keep the reduced PR-wide fallback that PR #4196 delivers. The full PR-wide "Show line comments" section is retired whenever every review has a known count. A reduced section stays only when some review's count is unknown or the result doesn't carry all of the PR's reviews, and it shows only the comments no review's own control reaches. That way no line comment becomes unreachable.
CONTRACT: feat(ui-sdk, ui-server, ui-react): per-review line-comment …
schlessera commentedon Nov 17, 2026
Merged in #4196 as
ade18f34fthrough the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.