fix:stalled 分類同步 agents#44——子項全關閉的父追蹤項一律標 parent-tracking(#47)

considerIssue 原先僅在 anyOpen(children) 時標 parent-tracking,子項全關閉時
退回通用原因(如 assignee-idle),與 gitea.py(agents#44 修正)不一致,
導致巡邏「父項收尾」規則永不觸發。改為 children 非空一律 parent-tracking,
並移除已無引用的 anyOpen。

回歸測試 TestScanStalledParentWrapup 補子項全關閉 fixture;
fakeSource.OpenIssues 過濾 closed 以對齊真實 API 語義。
This commit is contained in:
ceo
2026-09-14 08:04:37 +08:00
parent d45a8243c8
commit d89caf4af2
2 changed files with 48 additions and 10 deletions
+5 -10
View File
@@ -530,7 +530,11 @@ func considerIssue(src Source, org, repo string, issue Issue, comments []Comment
case lastCommentBy == "":
reason = "no-commenter"
}
if len(children) > 0 && anyOpen(children) {
if len(children) > 0 {
// 父追蹤項一律標 parent-tracking(agents #44,與 gitea.py 同步):
// 有 open 子項在推進時,父項留言閒置屬等待子項;子項全關閉時只剩
// 父項收尾(回報驗收並關閉),兩者都不是 assignee 停滯。統一標記
// 讓「父項收尾」規則能正確匹配,不退回通用原因(如 assignee-idle)。
reason = "parent-tracking"
}
item := Item{
@@ -606,15 +610,6 @@ func considerPull(src Source, org, repo string, pr PullRequest, comments []Comme
return item, true
}
func anyOpen(children []Child) bool {
for _, c := range children {
if c.State == "open" {
return true
}
}
return false
}
// round1 舍入到小數一位(對應 Python round(x, 1))。
// 經 strconv 的十進位正確舍入(半偶數),與 Python 的浮點 round 行為一致,
// 避免 (x*10+0.5) 截斷在 .x5 邊界產生偏差。