Skip to content

feat(steward): refine stalled PR signal clock, author-reply bypass, and bucket wakeups - #9207

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/steward-stalled-pr-buckets-20261121
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/steward-stalled-pr-buckets-20261121

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

动机 / Motivation

Scoped Steward PR monitors previously evaluated min_stalled_hours against raw item.updatedAt and recorded only stalled_threshold_met: true, which caused Mergify/bot comments to reset the stall clock, hid external contributor replies awaiting maintainer answers, and prevented bucket-crossing wakeups at 72h / 7d.

改动思路 / Approach

Extract an exact-head REQUEST_CHANGES stall clock (stalled_since) and non-bot author-reply state in github_pr_evidence.py, then classify stalled_bucket and stabilize observeStewardSignalMonitor hashes in steward_managed_mode.ts with awaiting_maintainer_reply priority for external PRs.

具体改动 / Changes

  • loopx/capabilities/native_chat/github_pr_evidence.py: extend _GITHUB_OPEN_PRS_GRAPHQL_QUERY and _normalize_graphql_pr_node with comments(last: 20) and head commit oid, committedDate, pushedDate; add _summarize_request_changes_stall to emit stalled_since, author_replied_after_request_changes, and latest_request_changes_review_id while ignoring bots and stale-commit reviews.
  • loopx/control_plane/collaboration/steward_managed_mode.ts: update filterScopedRepositoryItems and classifyStalledBucket to compute stalled_bucket (awaiting_maintainer_reply | 24h_to_72h | 72h_plus | 7d_plus), allow immediate awaiting_maintainer_reply inclusion under author_mode: "exclude", drop stale-commit REQUEST_CHANGES items when scoped to REQUEST_CHANGES, and exclude updatedAt from observeStewardSignalMonitor hash inputs when stalled_since is present.
  • loopx/capabilities/native_chat/steward_turn.py: document the projected stall clock and bucket fields in the advancement instruction string.
  • tests/control_plane_ts/steward_managed_mode.test.ts & tests/test_steward_pr_merge_and_review_signal.py: add unit coverage for bot updatedAt bumps, external author replies vs maintainer replies, stale-commit exclusion, and 24h/72h/7d bucket wakeups.

验证 / Verification

  • node --test tests/control_plane_ts/steward_managed_mode.test.ts: 17 passed, 0 failed
  • pytest -n 4 tests/test_steward_pr_merge_and_review_signal.py tests/test_steward_generic_monitor_todo.py -q: 15 passed
  • pytest -n 4 tests/test_lark_steward_reports.py -q: 30 passed
  • ruff check: All checks passed
  • mypy: Success: no issues found in 17 source files
  • loopx check --scan-path .: ok=True, 0 errors
  • loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main: passed (3/3 catalog canaries)

对主干的风险 / Risks

Low risk: preserves signal_scope: null feature-off parity and falls back to updatedAt only when stalled_since is absent. Leaves protected PR merge behind independent exact-head review.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审固定提交 fb1c7f6ecf5a393fbe5aa447884aa860f71bae37,merge base d772190747d6d39d7f896ea37a52d518d257e571。与核对时 main 55bae0ac55c8858a09f05fdebd3a1b7b5dcc131f 三方整合无冲突。

[P2 · Blocking] 访客留言会清除作者等待维护者的提醒

经实际 GraphQL 归一化、Python 摘要与 TS effect runtime,作者回复让该 PR 进入 awaiting_maintainer_reply。随后 authorAssociation=NONE 的访客留言就使它退出等待列表,和维护者确实回答的结果一样。已知 bot 后缀正常忽略,但缺后缀的 Bot actor 也产生同一错误。 只有可证实的维护者或授权的实际评审者回复才关闭等待。沿可用角色与 bot 类型读回,保留未知状态。补访客、自动化、维护者和身份缺失的对照。 候选位置

[P2 · Blocking] 无等待阈值的 scoped monitor 也丢失更新时间

两次相同观察只有 updatedAt 不同。原 base 的 hash 改变并产生 material_change=true,候选及 main 整合树剥离 updatedAt,返回 false。非等待的 scoped monitor 会失去既有同头更新信号。 把该降噪限定在使用 stalled_since 的年龄监控,保持无年龄条件的 scoped hash,并加入对应反例。 候选位置

[P2 · Blocking] 允许小于 24h 的配置被错误标成 24–72h

7h 已标成 24h_to_72h,到 24h hash 仍相同。min_stalled_hours 接受任意正有限值,候选和 main 整合的实际 effect runtime 均可见。 为小于 24h 的有效区间提供准确标记,或保留独立的已达自定义阈值状态。保留 24/72/168h 档口测试。 候选位置

动机 / Motivation

Steward 按当前 head 监测等待时长,及时提醒维护者外部作者已回复,并保持已有 scope 的变更信号。 基线依赖 updatedAt 和配置的年龄门槛。年龄以内的作者回复不会立即进入;无年龄筛选的 scoped monitor 能感知 repository item 的更新。 候选关联当前 head 的请求修改及评论,增加作者回复旁路和 24h/72h/7d 档,并对新等待时钟去掉 updatedAt 噪音。

同一合成 GitHub GraphQL 快照经生产读路径和 TS stdio runtime,分别核对作者与不同答者、无等待阈值 scope 和 6h 合法阈值。 真实本地读路径使用合成 GitHub 数据。托管 CI、原生 Steward/Lark 推送及正式安装采用未验证。 现有交付规则

改动思路 / Approach

新等待分类适用于已有年龄条件。无 scope 及其他筛选调用应保留既有监听边界。 GitHub 提供角色和审核证据。TS scope 处理筛选、材料变化和等待分类。合并许可仍由原保护路径判定。 使用现有 current-head review owner 与共享监控 scope。维护者回复分类需要可信角色证据,年龄档要反映配置与实际经过的时间。

具体改动 / Changes

完整 diff 共 5 个文件,新增 500 行、删除 12 行。完整 diff 5 个文件。复用现有 exact-head 审阅摘要、监控哈希和阈值,扩展评论与提交时间读回及提示文案。

  • 外部作者等待维护者。第三方或自动化留言不能消除待维护者处理。

  • 保持 scope 语义。已声明年龄条件才使用新等待降噪。

  • 档位匹配真实年龄。保留原有正数阈值并正确呈现 24h 边界。

  • _summarize_request_changes_stall。从当前 head 的请求修改和评论计算等待事实。 精确代码

  • classifyStalledBucket。投影年龄档或即时等待。 精确代码

  • observeStewardSignalMonitor。规范化 scope、过滤并生成材料变化哈希。 精确代码

对主干的风险 / Risks

精确头 15 项 Python 与 17 项 TS 定向测试通过。独立实际 runtime 复证作者回复使 24h 内的外部贡献进入、维护者答复后退出、已知 bot 后缀不重置。

基线没有作者即时旁路,对没有年龄条件的 scope 保留 same-head updatedAt 的唤醒。已知 bot 降噪正例在候选通过。 回归影响提醒进入、退出和材料变化。

我的整体评价 / Verdict

REQUEST_CHANGES。 先修正回复方鉴别及无年龄筛选的 scope 回归,再让档位可准确表达已有自定义阈值,以同一实际监控链复测。

English verdict: REQUEST_CHANGES. An unrelated commenter can clear an external author's waiting status. The patch also suppresses updates on scoped monitors with no age filter and labels a 7-hour PR as 24–72 hours.

@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Addressed all three P2 review findings in 5e848a5d29bb02f55eef7a8d0538d4fc1266d5b3:

  1. Maintainer / bot reply classification (github_pr_evidence.py): Added authorAssociation and author { __typename login } to the GraphQL query and extracted _is_bot_actor + _post_reply_role. Only OWNER / MEMBER / COLLABORATOR replies or the exact-head REQUEST_CHANGES reviewer (when not tagged with non-maintainer association) clear author_replied_after_request_changes. Visitors (authorAssociation=NONE), contributors, suffixless bot actors (__typename=Bot), and unknown commenters missing authorAssociation no longer clear the awaiting-maintainer flag.
  2. Preserve updatedAt on non-age-filtered scoped monitors (steward_managed_mode.ts): Scoped updatedAt stripping in observeStewardSignalMonitor now triggers only when pr_filter.min_stalled_hours is actively configured; scoped monitors without an age filter retain updatedAt sensitivity on unchanged heads.
  3. Accurate <24h bucket (steward_managed_mode.ts, steward_turn.py): classifyStalledBucket now returns under_24h when stalledAgeMs < 24h (e.g. a 7h PR under min_stalled_hours: 6) and transitions cleanly to 24h_to_72h at 24h.

Verified locally on 5e848a5d29:

  • node --test tests/control_plane_ts/steward_managed_mode.test.ts: 17 passed
  • pytest -n 4 tests/test_steward_pr_merge_and_review_signal.py tests/test_steward_generic_monitor_todo.py: 15 passed
  • pytest -n 4 tests/test_lark_steward_reports.py: 30 passed
  • ruff check, mypy (17 strict files), loopx check --scan-path ., and loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main (3/3 catalog canaries): all passed.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审固定提交 5e848a5d29bb02f55eef7a8d0538d4fc1266d5b3,merge base d772190747d6d39d7f896ea37a52d518d257e571。与核对时 main a6ffb3be6e7bdb48e02311ec58d618200fe0501c 三方整合无冲突。

[P2 · Blocking] 回复滑出 20 条评论窗口后仍待处理的提醒被清掉

GraphQL 只取 comments(last: 20),第 20 条无关留言送入生产解析和 TS effect runtime 后,唯一作者回复从样本被挤出。旧观察为 awaiting_maintainer_reply,新观察把该 PR 移出、将 author_replied_after_request_changes 置 false,并返回 material_change=true。当前头和最新 main 整合树均复现。 读取评论分页完整性并有界追到当前有效求改锚点或最近相关回复;达到预算且仍缺先前覆盖时,沿现有不完整观察路径保留最近验证过的等待状态。补一个前后相差一条无关留言的反例和维护者答复对照。 候选位置 前轮三个发现

动机 / Motivation

Steward 对当前精确 head 按 scope 观察请求修改停滞,及时提示外部作者仍在等维护者回应,并保持其他 scope 的更新信号。 基线以 updatedAt 和配置的等待阈值决定进入提醒,缺作者即时提醒。无年龄筛选时保留同一 head 的材料变化。 候选扩展 current-head review 与评论角色证据,增加作者回复旁路、年龄档,并在有年龄筛选时稳定 hash。

将相同当前 head 的两组 GraphQL 响应交给真实生产解析与监控求值。第一组包含作者回复和随后 19 条访客留言;第二组只返回窗口内的 20 条访客留言,原回复依旧存在且没有维护者回复。 测试用真实本地调用链与合成 GitHub GraphQL。未验收远端评论长尾、安装版 Steward/飞书提醒、生产采样预算或托管 CI。 现有交付规则

改动思路 / Approach

没有 signal_scope 的监控按既有路径处理。只有年龄筛选启用新的等待分类和更新时间降噪。 GitHub 提供精确头 reviews 与评论角色这一只读事实。Python 规范化后由 TS 管理作用域、档位与材料 hash;原有回执与合并权限独立。 scope 归一化和年龄核心继续复用现存 owner。低价值评论不能被解释成待回应事实结束。

具体改动 / Changes

完整 diff 共 5 个文件,新增 670 行、删除 13 行。完整 diff 包含 provider GraphQL 证据、共享 scope 和材料 hash、实际 Steward 提示及定向测试。当前修订修复了上一轮三个具体分支。

  • 角色先后与完整覆盖。没有维护者答复时,访客不能使已观察到的作者等待消失。

  • 无年龄筛选的更新。保持无年龄 scope 的 updatedAt 变更。

  • 真实时间档位。自定义六小时门槛保留,并在第 24 小时取正确年龄档。

  • _GITHUB_OPEN_PRS_GRAPHQL_QUERY。只请求最近 20 条评论,未返回该连接的分页完整性。 精确代码

  • _summarize_request_changes_stall。将可见当前-head 审阅与角色回复折成等待事实。 精确代码

  • classifyStalledBucket。投影精确年龄档或外部作者即时等待。 精确代码

  • observeStewardSignalMonitor。规范化 scope、过滤并产生材料变化 hash。 精确代码

对主干的风险 / Risks

独立 GraphQL + TS stdio 验证前轮三项已修复。访客及无 bot 后缀的 Bot 不消除等待,维护者回复让它退出,无年龄 scope 恢复同 head 更新,7h 正确归为 under_24h 且 24h 触发生效变化。

精确 merge base 无作者即时旁路。基线和新头的无年龄 scope 都继续响应同 head updatedAt,范围外不相关数据不触发。 真实本地反例使用合成 GitHub fixture,当前 head 和 main 整合树的归一化和监控 effect 都会失去同一等待项。

我的整体评价 / Verdict

REQUEST_CHANGES。 请补评论来源的有界完整性判断,再复核无关留言挤出与维护者答复。保持已修好的年龄分档和非年龄作用域更新。

English verdict: REQUEST_CHANGES. The three previous cases are fixed. An irrelevant twentieth comment can still evict the author's unanswered reply and clear the reminder.

This branch has not been deployed

No deployments
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.

1 participant