feat(maintainer): stabilize MR lifecycle, finding triage, and discussion closure - #5
Merged
Merged
Conversation
- 生命周期状态机:按 MR 建档跟踪(active/converged/archived),持久化于 mr-agent-state - 终态感知:merged/closed 自动识别,优雅退出并归档指标到 maintainer-lifecycle/ - 用户中断:识别人工停止指令(/ck stop、停止自动修复等),确认后归档退出 - CI 自治修复:感知 head pipeline 失败,区分基础设施失败(挂起)与代码问题, 在 isolated worktree 中执行最小修复、本地验证并推送,单 head 限 2 次防振荡 - CI 修复进展全程写入 Maintainer 创建的跟踪 discussion - 收敛指标:讨论闭环率、修/辩/挂起统计、修复后人工追评(误修信号)跨轮次记忆 - 新增 MaintainerConfig.ciFixEnabled 开关,默认启用
node-cron v4 自带类型且与默认导出分离,ScheduledTask 需 import type 引入;TaskOptions 移除 scheduled 字段,任务创建即调度。同步移除遗留的 v3 命名空间用法。 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- fix-tool-loop: 只读熔断前注入 already-fixed 回查结论,给最后一轮 带诊断行动机会(finalActingSteps,默认 3 步);失败原因携带回查结论 - maintainer-filter: resolved/不可 resolve 的 thread 不再因「补发无需 修复说明」复活(仅未完成投递可继续),消除 resolved thread 重复评论 - maintainer-filter/runner: 无需修复说明补发一次性熔断 (noFixExplanationBackfilledAt),行号漂移不再导致反复补发; 新人工回复或决策更新自动解除熔断 - prompts: already-fixed 回复去掉「请 Reviewer 复核确认」反问, 改为带证据结论并直接关闭 thread 既有失败说明:maintainer-actor 2 个测试在 HEAD 基线同样失败(非本次 引入);model-server 2 个为全量并发下偶发,单跑通过。 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- commit-pipeline(新模块):commit/push 失败机械归类 (commit-message/lint/test/typecheck/permission/push)+ 蒸馏为 ≤10 行诊断;静态探测 commitlint/husky 得出项目提交规范; 合规默认提交信息(Conventional Commits 形态) - maintainer-actor:提交规范三级兜底(EverOS 记忆 → 静态探测 → 合规默认);commit 失败先归类蒸馏,commit-message 类按项目规则 重写重试,lint/test/typecheck 类回流 FixToolLoop 修复后重试一次; 其余失败只抛蒸馏诊断,发布到 MR 的不再是 hook 原文 - 测试:修复 G1 既有失败(模块级共享 mockDiscussion 被 deliverDiscussionReply 就地污染,跨用例 resolved 串扰); 新增 commit-pipeline 单测 16 个、回流/蒸馏 actor 用例 2 个 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- ask-gate(新模块):识别「仓库内可自查」的索问模式(索要文件内容/ 代码片段),此类提问禁止出现在 MR 上——!1558 实证「请提供 tracker.ts 文件的内容」是框架失职而非信息缺失 - actor 单 finding 路径:门禁拦截后转为修复自查,自查失败才退回 提问且使用修复失败模板而非原索问 - runner 多 finding 路径:门禁拦截的 ask 决策转为 fixableItems 进入批量修复,suggestion 携带门禁说明 - M7:修复循环终局写入 recordFixAttempt(outcome:success/failure, 含 already-fixed 终态),与 brain 决策级记录互补 - M7:Reviewer 推翻此前「无需修复/已修复」判断时写入 recordReflection(outcome:failure),供 already-fixed 回查参考 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
闭环差距 G6:Reviewer 推翻「无需修复/已修复」判断的判定逻辑从 runner 内联抽取为 maintainer-filter 纯函数,新增 6 个单测覆盖 推翻成立/无新人工回复/历史为 fix/新决策非 fix/无历史决策等边界。 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- MrLifecycleMetrics 新增 6 个可选计数字段(兼容旧归档): readOnlyFinalActingRounds(M1)、commitFirstTryPasses(M2)、 commitFirstTryRejections(M3)、duplicateSummarySkips(M4)、 askGateInterceptions(M5)、hookFailureReflows(M6) - FixToolLoop 暴露 wasFinalActingRoundUsed(),actor 在 4 处 loop.run() 后计入 M1 - actor 自增 M2/M3(commit 首试通过/被拒)、M6(hook 失败回流)、 M5(单路 ask 门禁拦截),metrics 未注入时静默跳过 - runner 构造 actor 时注入 lifecycle.metrics;runner 侧自增 M5(多 finding 门禁拦截)与 M4(汇总去重跳过,仅 hasResults 时) - 新增 4 个单测:首试通过计数、lint 回流计数、门禁拦截计数、 未注入 metrics 兼容性 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- 从 GitLab 页面快照提取 25 条讨论的结构化 fixture (tests/fixtures/mr-1558/discussions.json),保留完整评论时间线 - 回放 harness 覆盖该 MR 暴露的三类失控模式: 重复 already-fixed 补发、修复失败索要提问、陈旧 pending 投递 - 分类层断言:真实 note 正文的署名/已修复说明识别(熔断前置条件) - 过滤层断言:15+ 条已闭环讨论基线回放均不 pending; 补发熔断压住行号漂移场景;新人工回复正确解除熔断 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- ask-gate 新增 isRepoContentReply:保守识别「回复本身是仓库内 可查信息」(代码围栏 / 带扩展名文件路径引用) - 交互提问获人工回复后直接转修复,且问题未被门禁拦截、回复含 仓库内容时,判定为疑似漏判,recordReflection 写入 ask-gate-miss-* 反思供 SELF_ANSWERABLE_PATTERNS 扩充参考 - handleInteractiveReply 增加 interactiveQuestion/memoryClient 参数,调用点复用已捕获的提问文本 - 新增 4 个 isRepoContentReply 单测(代码围栏/路径引用/纯讨论/空) Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
- fixture 脱敏:品牌词/真实路径/本地绝对路径/真实 bot id 全部 替换为通用占位(RULES §3), sanitizing 脚本留存于本地分析目录 - fixture 目录与回放测试文件重命名去除真实 MR 编号 - ask-gate/commit-pipeline/回放测试的注释与夹具路径同步脱敏 - src 注释中的真实 MR 编号引用改为「真实现场实证」 Co-Authored-By: Kimi (Moonshot AI) <noreply@moonshot.cn>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the stability of the Maintainer workflow for long-running merge requests with many CI reviews, findings, and Discussion updates.
It focuses on preventing repeated replies, stale finding processing, stalled repair loops, and incomplete Discussion closure without rewriting the existing framework.
What Changed
MrLifecycleMetricsfor repair, explanation, suspension, and follow-up outcomes.Behavior Improvements
Maintainer can now:
Validation
tsc --noEmitpasses.git diff --checkpasses.Scope
This change is intentionally focused on Maintainer lifecycle behavior, repair safety, Discussion processing, and EverOS memory integration. It does not rewrite the framework or change the existing Reviewer/Archiver architecture.