[Bug]: Gitea/Forgejo mergeable:false maps to unknown, so PR watch never reports merge conflicts

Đang mở Phù hợp với người mới
#40,428 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #40457 của @gek0v — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại packages/source-control-forgejo/src/server/forgejoPullRequestJson.ts quanh L145, nơi mergeability bị gộp thành "unknown" mỗi khi pr.mergeable không phải true, và đọc phần xử lý draft/WIP xung quanh đến từ #15145. Sau đó xem đường xử lý xung đột của PR-watch để biết những giá trị mergeability nào đánh thức agent, và các test mapping forgejo hiện có dưới packages/source-control-forgejo để xem hình dạng fixture. Hoàn thành nghĩa là mergeable: false trên một PR non-draft, settled tạo ra "conflicting" (với WIP/still-checking vẫn là "unknown") và một test bao phủ cả hai trường hợp. Lưu ý một pull request đã đóng, chưa merge (#40457) đã nhắm đến việc này, nên hãy kiểm tra nó trước khi bắt đầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

packages/source-control-forgejo (Forgejo/Gitea PR mapping), PR watch conflict wakes

Steps to reproduce
  1. Open a Gitea PR and watch it with watch_pull_request.
  2. Merge a commit into the base branch that conflicts with the PR. Gitea's GET /repos/{o}/{r}/pulls/{n} then returns "mergeable": false.
Expected behavior

The PR shows as conflicting and the watch wakes the agent on the conflict, as it does for GitHub.

Actual behavior

The PR is mapped to mergeability: "unknown", so no conflict is ever reported. In our case the thread's PR snapshot showed "unknown" at two syncs while the PR conflicted, and returned to "mergeable" after the conflict was resolved.

// packages/source-control-forgejo/src/server/forgejoPullRequestJson.ts (main @ efea1aa, L145)
mergeability: pr.mergeable === true ? "mergeable" : "unknown",

This looks like the fix for #15145 (WIP PRs shown as conflicting). That fix collapsed every false to "unknown", so Forgejo/Gitea PRs can never be "conflicting".

Suggested fix

Map mergeable: false to "conflicting" when the PR is not WIP/draft (title prefix or draft) and its status is settled, and keep "unknown" only for the WIP and still-checking cases. Alternatively, confirm a conflict another way, for example by comparing merge_base with base.sha or calling GET /pulls/{n}/merge.

Impact

Minor to moderate: on Forgejo/Gitea, agents watching a PR are never told it needs a rebase, and the UI never shows a conflict.

Version or commit

Observed on v0.1.10-nightly.20261115.4749; unchanged on main @ efea1aabe7a5657f5c78f71c12dd49f375886a78.

Environment

Self-hosted Gitea (API reports 28.4.0), tea 0.16.0.

Ngôn ngữ chính
TypeScript
Star
24.8k
Fork
6.4k
Merge trung bình
2 giờ 18 phút
Pull request đã merge (30 ngày)
448

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pingdotgg/t3code

Tất cả issue của pingdotgg/t3code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.