Skip to content

Feature : Support GitLab Code Review - #48

Merged
contrueCT merged 63 commits into
contrueCT:mainfrom
LegendPei:feat/gitlab-review-workflow
May 10, 2026
Merged

Feature : Support GitLab Code Review #48
contrueCT merged 63 commits into
contrueCT:mainfrom
LegendPei:feat/gitlab-review-workflow

Conversation

@LegendPei

@LegendPei LegendPei commented May 8, 2026

Copy link
Copy Markdown
Collaborator

描述 / Summary

本次变更为 Nine1Bot 增加了 GitLab Code Review 的初步工程化能力,在 @nine1bot/platform-gitlab 中实现了 GitLab 平台适配、专用 webhook 触发、@Nine1bot 评论触发审查、MR diff 拉取、Review 结果回写以及平台配置页联调能力。
目标是先打通 GitLab Review 的 MVP 闭环,为后续接入 CI 日志、质量扫描和自动修复能力打基础。

类型 / Type of change

  • 新功能 (feature)
  • Bug 修复 (bugfix)
  • 文档 (docs)
  • 重构 (refactor)
  • 其他 (describe):

关联的 issue(如果有)/ Related issues

/

变更点 / What changed

  • 新增 GitLab 平台适配包中的 Review 领域能力,包括 webhook 解析、diff 构建、上下文组装、finding 聚合、结果发布等
  • 支持 GitLab MR / Commit 评论区通过 @Nine1bot 触发代码审查,并将结果回写到 GitLab
  • 支持 GitLab inline diff comments、summary note、fallback note 等多种评论发布形式
  • 增加 GitLab 平台配置页,支持 GitLab base URL、API token、模型选择、review scope、project/group hook 管理等配置
  • 增加专用 GitLab webhook URL,同步与测试 project/group hooks,并处理本机 IP 变化导致的 webhook 地址失效问题
  • 增加 GitLab review agents / skills / fixtures / dry-run harness,支持本地调试和流程验证
  • 补充 GitLab review 相关单元测试、平台测试和工程总结文档

如何测试 / How to test

  1. 在设置页启用 GitLab 平台并配置 GitLab base URLGitLab API token、模型等基础信息
  2. 同步 GitLab project hook 或 group hook 到当前 Nine1Bot webhook URL
  3. 在 GitLab MR 评论区发送 @Nine1bot review,或通过 webhook 自动触发 review
  4. 预期结果:Nine1Bot 能正确接收 webhook、拉取 MR diff、执行审查,并在 GitLab 中回写 summary comment 和可定位的 inline comments

本地验证命令:

bun test packages/platform-gitlab/test/gitlab-platform.test.ts packages/platform-gitlab/test/gitlab-review.test.ts
bun run --cwd packages/platform-gitlab typecheck

截图(UI 变更时提供)/ Screenshots for UI changed

Checklist(合并前请确认) / Checklist

  • 本地已通过测试

备注 / Notes for reviewers

LegendPei added 30 commits May 2, 2026 10:37

Copilot AI 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.

Pull request overview

This PR adds an MVP GitLab code review integration to Nine1Bot/OpenCode, spanning the GitLab platform adapter, dedicated webhook routes, review-run persistence + runtime orchestration, and web UI surfaces to configure and monitor GitLab review runs.

Changes:

  • Introduces @nine1bot/platform-gitlab “review” domain (webhook parsing, diff manifest building, context blocks, subagent result compilation, and GitLab comment publishing).
  • Adds a dedicated /webhooks/gitlab/... webhook entry plus /webhooks/gitlab/runs run-listing and retry endpoints, backed by a local review-run store and runtime session monitor/publish flow.
  • Updates the web app settings/platform UI and client APIs/tests to support GitLab review run listing + retry and GitLab platform configuration.

Reviewed changes

Copilot reviewed 69 out of 69 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
web/test/config-api.test.ts Adds tests for GitLab review run APIs.
web/src/components/SettingsPanel.vue Passes provider list to platform settings; tab ordering tweak.
web/src/App.vue Refactors useSettings() destructuring formatting.
web/src/api/client.ts Adds gitLabReviewApi + GitLab review run types.
packages/platform-gitlab/tsconfig.json Adds paths + includes scripts in TS config.
packages/platform-gitlab/test/gitlab-review.test.ts Adds unit tests for GitLab review foundation/publisher.
packages/platform-gitlab/test/gitlab-platform.test.ts Extends platform tests for GitLab review actions/assets.
packages/platform-gitlab/src/review/workflow.ts Defines initial GitLab review subagent workflow/task specs.
packages/platform-gitlab/src/review/webhook.ts Implements GitLab webhook token validation helper.
packages/platform-gitlab/src/review/types.ts Adds GitLab review domain types (diff, findings, triggers).
packages/platform-gitlab/src/review/subagent-result-compiler.ts Compiles/aggregates subagent outputs into deterministic findings.
packages/platform-gitlab/src/review/settings.ts Adds GitLab review settings defaults + normalization.
packages/platform-gitlab/src/review/publisher.ts Publishes summary + inline GitLab comments with fallbacks.
packages/platform-gitlab/src/review/output-schema.ts Defines/parses structured review stage output schema.
packages/platform-gitlab/src/review/inline-position.ts Validates inline positions and renders suggestions safely.
packages/platform-gitlab/src/review/index.ts Exports the review module surface.
packages/platform-gitlab/src/review/idempotency.ts Builds stable idempotency keys for GitLab review runs.
packages/platform-gitlab/src/review/finding-aggregator.ts Aggregates duplicate findings deterministically.
packages/platform-gitlab/src/review/event-parser.ts Parses GitLab webhook payloads into review triggers.
packages/platform-gitlab/src/review/diff-builder.ts Builds filtered/budgeted diff manifests and blocked states.
packages/platform-gitlab/src/review/context-builder.ts Builds runtime context blocks for GitLab review runs.
packages/platform-gitlab/src/review/comment-renderer.ts Renders GitLab review summary Markdown.
packages/platform-gitlab/src/review/api-client.ts Adds GitLab API client (diffs, notes, hooks, searches).
packages/platform-gitlab/src/index.ts Re-exports review APIs + refresh helper from runtime.
packages/platform-gitlab/skills/review/verification-matrix/SKILL.md Adds QA verification matrix skill.
packages/platform-gitlab/skills/review/subagent-prompts/tech-architect/SKILL.md Adds tech-architect subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/spec-writer/SKILL.md Adds spec-writer subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/security-agent/SKILL.md Adds security subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/risk-qa/SKILL.md Adds QA/risk subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/frontend-designer/SKILL.md Adds frontend subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/developer/SKILL.md Adds developer fix-mode subagent prompt skill.
packages/platform-gitlab/skills/review/subagent-prompts/auto-fixer/SKILL.md Adds auto-fixer fix-mode subagent prompt skill.
packages/platform-gitlab/skills/review/spec-gate-review/SKILL.md Adds spec-gate skill for review readiness.
packages/platform-gitlab/skills/review/security-review-policy/SKILL.md Adds security review policy skill.
packages/platform-gitlab/skills/review/review-finding-schema/SKILL.md Adds finding schema + final output contract skill.
packages/platform-gitlab/skills/review/pm-risk-routing/SKILL.md Adds PM risk routing skill.
packages/platform-gitlab/skills/review/gitlab-mr-review-workflow/SKILL.md Adds MR review workflow skill.
packages/platform-gitlab/skills/review/gitlab-commit-review-workflow/SKILL.md Adds commit review workflow skill.
packages/platform-gitlab/skills/review/gitlab-comment-rendering/SKILL.md Adds comment rendering skill.
packages/platform-gitlab/scripts/review-dry-run.ts Adds dry-run harness for fixtures/runtime/subagent outputs.
packages/platform-gitlab/README.md Links to GitLab code review plugin design doc.
packages/platform-gitlab/package.json Exports ./review and adds dry-run scripts.
packages/platform-gitlab/GITLAB_REVIEW_ENGINEERING_SUMMARY.md Adds engineering summary documentation.
packages/platform-gitlab/fixtures/review/sample-webhook-mr-note.json Adds webhook fixture with embedded changes.
packages/platform-gitlab/fixtures/review/sample-subagent-outputs.json Adds subagent output fixture for compiler testing.
packages/platform-gitlab/fixtures/review/sample-runtime-output.md Adds runtime-output fixture containing review payload.
packages/platform-gitlab/fixtures/review/sample-mr-overflow.json Adds overflow diff fixture.
packages/platform-gitlab/fixtures/review/sample-mr-changes.json Adds MR changes fixture.
packages/platform-gitlab/fixtures/review/sample-invalid-runtime-output.md Adds invalid runtime output fixture.
packages/platform-gitlab/agents/review/tech-architect.agent.md Adds GitLab tech-architect agent definition.
packages/platform-gitlab/agents/review/spec-writer.agent.md Adds GitLab spec-writer agent definition.
packages/platform-gitlab/agents/review/security-agent.agent.md Adds GitLab security agent definition.
packages/platform-gitlab/agents/review/risk-qa.agent.md Adds GitLab QA/risk agent definition.
packages/platform-gitlab/agents/review/pm-coordinator.agent.md Adds GitLab PM coordinator primary agent definition.
packages/platform-gitlab/agents/review/frontend-designer.agent.md Adds GitLab frontend reviewer agent definition.
packages/platform-gitlab/agents/review/developer.agent.md Adds GitLab developer subagent definition.
packages/nine1bot/src/review/run-store.ts Persists GitLab review run records locally.
packages/nine1bot/src/review/gitlab-controller.ts Handles GitLab webhook -> context -> runtime prompt -> publish flow.
packages/nine1bot/src/platform/manager.ts Fixes runtime source error/status derivation.
packages/nine1bot/src/platform/manager.test.ts Updates tests for runtime source error fields.
opencode/packages/opencode/test/server/webhooks-status.test.ts Adds tests for local webhook URL selection.
opencode/packages/opencode/src/tool/task.ts Allows resolving declared/recommendable subagents for task tool.
opencode/packages/opencode/src/server/routes/webhooks.ts Adds GitLab webhook endpoints, run listing, retry/publish hooks.
opencode/packages/opencode/src/server/routes/nine1bot-platforms.ts Syncs platform manager from config before listing/details.
opencode/packages/opencode/src/server/routes/automated-controller.ts Adds runtime output callbacks and context passing support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/platform-gitlab/src/review/diff-builder.ts Outdated
Comment thread packages/platform-gitlab/skills/review/verification-matrix/SKILL.md Outdated
Comment thread packages/platform-gitlab/skills/review/spec-gate-review/SKILL.md Outdated
Comment thread packages/platform-gitlab/skills/review/security-review-policy/SKILL.md Outdated
Comment thread packages/platform-gitlab/skills/review/pm-risk-routing/SKILL.md Outdated
Comment thread packages/platform-gitlab/skills/review/gitlab-comment-rendering/SKILL.md Outdated
Comment thread packages/platform-gitlab/src/review/workflow.ts
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts Outdated
Comment thread packages/nine1bot/src/review/gitlab-controller.ts Outdated
Comment thread web/src/components/SettingsPanel.vue

Copilot AI 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.

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated 6 comments.

Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts Outdated
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts
Comment thread packages/nine1bot/src/review/gitlab-controller.ts
Comment thread packages/nine1bot/src/review/run-store.ts
Comment thread packages/platform-gitlab/src/review/event-parser.ts
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts

Copilot AI 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.

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated 3 comments.

Comment thread packages/platform-gitlab/src/review/comment-renderer.ts
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts
Comment thread packages/nine1bot/src/review/run-store.ts

Copilot AI 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.

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated 2 comments.

Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts Outdated
Comment thread packages/platform-gitlab/src/runtime.ts

Copilot AI 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.

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated 3 comments.

Comment thread packages/nine1bot/src/review/gitlab-controller.ts Outdated
Comment thread packages/nine1bot/src/review/gitlab-controller.ts
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated 4 comments.

Comment thread packages/platform-gitlab/src/review/finding-aggregator.ts
Comment thread packages/nine1bot/src/review/run-store.ts
Comment thread packages/nine1bot/src/review/run-store.ts
Comment thread opencode/packages/opencode/src/server/routes/webhooks.ts Outdated

@contrueCT contrueCT left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM :D

@contrueCT
contrueCT merged commit c1b0490 into contrueCT:main May 10, 2026
5 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.

3 participants