已关闭
Support PR review discussions with unresolved thread metadata #13
urandon创建于 6月27日关闭于 6月28日
6月27日 添加了label:enhancement
urandon
6月28日 评论:
6月28日 评论:
Design proposal for #13.
Scope: implement this as a cache-first read feature on top of the existing PR comments collection before adding any speculative GitCode endpoint. The current adapter already reads GET /api/v5/repos/{owner}/{repo}/pulls/{number}/comments; #13 should make the payload richer, durable, and agent-friendly.
Architecture:
flowchart TD A["GitCode PR comments API"] --> B["gitcode.PRComment normalizer"] B --> C["BulkSyncPRComments"] C --> D["cache: pr_comment source + review metadata"] D --> E["service.ListPRDiscussions"] E --> F["CLI read command"] E --> G["MCP list_pr_discussions"]
Data shape:
erDiagram
PULL_REQUEST ||--o{ PR_COMMENT : has
PR_DISCUSSION ||--o{ PR_COMMENT : groups
PR_COMMENT {
string id
string discussion_id
string kind
string body
string author
string path
int line
int start_line
bool resolved
string parent_id
}
Proposed changes:
- Extend
gitcode.PRCommentnormalization to preserve optional review metadata when GitCode provides it: inline/general kind, path/file path, line/range/position fields, parent/reply id, resolvable/resolved state, author, timestamps, and discussion id. - Persist the metadata during
BulkSyncPRCommentsso normal reads do not need live network access. - Add a service read API that returns discussions grouped by
discussion_id, with fallback grouping for general comments that do not have a discussion id. Replies should stay in the same group through parent/discussion ids. - Add unresolved-only filtering. Because
resolvedmay be absent from some GitCode payloads, use tri-state semantics internally: absent metadata should not be treated as resolved. - Expose the read through MCP as
list_pr_discussionsand through a CLI command with JSON output. Empty PR/comment state should returndiscussions: []. - Update docs with a sanitized public-safe example and note that inline path/line/resolution fields are present only when GitCode includes them.
Test plan:
- GitCode model/client fixture test for inline review comment metadata decoding.
- Service test for grouping replies under discussions and separating general vs inline comments.
- Service/MCP test for
unresolved_onlyfiltering and empty-state behavior. - CLI test for JSON output shape.
- Regression test that existing PR comment sync still creates searchable
pr_commentsources.
Main design choice: I would keep the live API surface narrow for this PR and avoid endpoint discovery churn. If later evidence shows GitCode has a better discussions endpoint than /pulls/{number}/comments, the provider can swap to it behind the same service/MCP contract.


6月28日 关联了pull request:Implement cached PR review discussions
6月28日 关闭了 issue
Problem
The request in pimenovdmitry/gckit#1 describes a PR review workflow that agents need but
gitcode-mcpdoes not currently expose as a complete user-facing capability.Today we can read a PR record and some flat comment-like data, but we do not provide a reliable way for an agent to ask: "what review comments still need action, where are they in the diff, and what replies belong to the same thread?"
Required capability
Support reading PR/MR review discussions in a form that is useful for agent follow-up work:
Acceptance
Out of scope