[feat] import --from-mr: include the MR's review threads in the extraction
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- github, typescript
- Domain
- cli
Research direction
Start with the MR fetchers in src/providers/gitlab/mr-fetch.ts and the GitHub path that runs gh pr view, then extractMRLearningPrompt, which receives the title, description, commits and diff. Linked PR #1190 is already open against this work, so check it before starting. Done means threads are fetched on both providers, system and teamai CI notes are filtered out, the prompt gets a separate budgeted thread section, and --no-discussions keeps the old behaviour.
Written by the indexing model from the issue text.
Description
Problem
On our team the review threads of a merge request carry most of what is worth keeping. A reviewer points at a line and names the problem and a fix, the author answers, and the thread ends with a decision. That is the material a learning should be made of.
teamai import --from-mr does not read them. The GitLab fetcher (src/providers/gitlab/mr-fetch.ts) reads the MR, /commits and /changes; the GitHub fetcher runs gh pr view --json title,body,author,mergedAt,commits. extractMRLearningPrompt then receives the title, the description, the commit subjects and the first 3000 characters of the diff. For an MR whose value is in its review, the learning comes out as a summary of the diff, and the decision from the thread is missing. Checked on 0.27.0 and on main (fe3b906).
Proposed Solution
- Fetch the threads:
- GitLab:
GET /projects/:id/merge_requests/:iid/discussions, paginated. - GitHub: review comments (
/pulls/:n/comments), review bodies (/pulls/:n/reviews) and conversation comments (/issues/:n/comments). - TGit: the notes endpoint
teamai cialready uses.
- GitLab:
- Leave out system notes and teamai's own
<!-- teamai:ci-extractcomments, so the CI extraction does not feed its own output back in. - Give the threads their own section in the prompt with its own size budget: per thread the file and line it is anchored to, whether it is resolved, and the notes in order, each marked as MR author or reviewer. Threads with a reply come first and single unanswered remarks last; a long thread is shortened instead of the section being cut off in the middle.
- Tell the model that a decision in a resolved thread outweighs a restatement of the diff.
- On by default, with
--no-discussionsfor the current behaviour.
Alternatives Considered
- An agent reads the threads through an MCP server and writes a learning with
teamai contribute --file. That works, but every team rebuilds the fetch, the duplicate check and the publish path thatimport --from-mralready has. - Asking authors to copy the outcome of the review into the MR description before the import. That depends on discipline and loses the file and line context.
Additional Context
- #1122 (several MR URLs per run) makes this useful for working through a backlog of merged MRs.
- Separate from this request but in the same function: the prompt requires Chinese output (
【必须】用中文撰写). A team that keeps its learnings in English gets Chinese learnings fromimport --from-mrand has no way to change that. Following the language of the existing learnings, or a setting such assharing.learnings.language, would fix it. I can open a separate issue for it if you prefer. - Environment: teamai 0.27.0, self-managed GitLab, single-repo mode.
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 443
- Avg merge
- 20h 8m
- Merged PRs (30d)
- 340
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Tencent/teamai-cli
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Tencent/teamai-cli#1193 · 1 comment ·
Maintainers usually reply within 1 day
-
[feat] Let designated maintainers assign roles instead of each member setting their ownPossibly taken @scpia claimed this 1 day ago. Open
Difficulty 5/5 Over a week Newbie friendliness 8/100
Tencent/teamai-cli#1186 ·
Maintainers usually reply within 1 day
-
codebuddy: project-scope MCP written to .codebuddy/mcp.json instead of .mcp.json (mcpProject unused)Open
Difficulty 3/5 Half a day Newbie friendliness 62/100
Tencent/teamai-cli#1185 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 8/100
Tencent/teamai-cli#1183 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 12/100
Tencent/teamai-cli#1182 ·
Maintainers usually reply within 1 day
All issues in Tencent/teamai-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
TomerAberbach/profiler-md#733 ·
Maintainers usually reply within 1 day
-
bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
brentspine/brents-toasts#143 ·
-
🐛 bug 🗺️ DB Models & Ops
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
LibreChat-AI/LibreChat#17214 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Wavvon/Wavvon-clients#136 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
umami-software/umami#4637 ·
Maintainers usually reply within 3 days