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

未关闭 适合新手
#40,428 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #40457 来自 @gek0v —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
66/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
backend

调研方向

从 packages/source-control-forgejo/src/server/forgejoPullRequestJson.ts 的 L145 附近开始,在那里 mergeability 会被折叠为 "unknown",只要 pr.mergeable 不为 true,并阅读来自 #15145 的周边 draft/WIP 处理。然后查看 PR-watch 冲突路径,了解哪些 mergeability 值会唤醒 agent,并查看 packages/source-control-forgejo 下现有的 forgejo 映射测试,以了解 fixture 形态。完成意味着在非 draft、settled 的 PR 上 mergeable: false 会产生 "conflicting"(WIP/still-checking 仍为 "unknown"),并且有测试覆盖这两种情况。注意,一个已关闭、未合并的 pull request(#40457)已经针对此问题,所以开始前先检查它。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
2 小时 18 分钟
30 天内合并 PR
448

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。