Skip to content

#337: 源码 English-only 契约系统性收敛#367

Merged
loning merged 4 commits into
auto-refact-devfrom
refactor/issue337-source-english-only
May 31, 2026
Merged

#337: 源码 English-only 契约系统性收敛#367
loning merged 4 commits into
auto-refact-devfrom
refactor/issue337-source-english-only

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented May 31, 2026

摘要

#337 cluster-002 源码 English-only 契约系统性收敛。按 design-consensus r3 structural 共识(test-only guard + default-none refactor-history policy)。

  • Old:源码内中文自然语言(注释/log/error)系统性漂移,无机械守卫;refactor-history 中文注释默认强制。
  • New:新增 test_source_language_policy.py test-only guard(由 required contract-tests 承载);HOST_REFACTOR_COMMENT_POLICY missing/empty/default 收敛 none;删源码历史中文 Refactor 注释,保留 current-code invariant 英文短注释。

范围

60 files(+391/-804,deletion-heavy):新 guard test + SKILL.md hard-rule-3/host.env-matrix/language-details default→none + host.env.example + 5 prompt + 删 bump_version.py/codex_refactor_loop/**/*.py 历史中文注释。

Closes #337

🤖 Auto-loop / codex-refactor-loop

⟦AI:AUTO-LOOP⟧

…T_REFACTOR_COMMENT_POLICY default→none,删历史中文注释(r3 structural consensus)
@loning loning added crnd:lifecycle:managed loop-managed item crnd:phase:reviewing review-gate reviewers in flight crnd:human:auto auto-advancing, no human needed labels May 31, 2026
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — Consensus-rnd Phase review-gate r1(❌ 不需要人介入)

#337 源码 English-only implement 完成(60 files,+391/-804 删历史中文注释 + test-only guard)→ PR #367(draft)开,reviewer r1 派出。3/3 共识后 merge ard。

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Quality review: comment

TL;DR

  • 这是什么: PR 367 的 quality 视角 review,检查命名、简单性、死代码和复杂度。
  • 结论是什么: comment,不是 blocker;整体改动聚焦,但新 scanner 有一个误导性的 unused parameter。
  • 下一步: 建议删掉 repo_root 参数,或让它真正参与扫描路径计算。

详细说明

skills/codex-refactor-loop/scripts/test_source_language_policy.py:193scan_python_source_language(repo_root: Path = REPO_ROOT) 马上在下一行 del repo_root,实际仍使用模块级 PYTHON_SOURCE_ROOTS。这让函数签名看起来支持指定 repo root,但调用方传什么都不会改变扫描范围。

这属于 quality checklist 里的 unused parameter / readability 问题,所以我给 comment,不是 reject。最小修复是把签名改成 scan_python_source_language() 并更新测试调用;如果确实想保留参数,就把它传进 source_filesrelative 的路径计算。


📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: quality
verdict: comment
---

## Verdict
Comment: the diff is focused and readable overall, but the new scanner exposes an unused `repo_root` parameter that makes the helper look more configurable than it is.

## Evidence
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:193`: `scan_python_source_language(repo_root: Path = REPO_ROOT)` immediately deletes `repo_root` on line 194 and still scans the module-level `PYTHON_SOURCE_ROOTS`; per the quality checklist, unused parameters should be surfaced because this makes the helper contract misleading.

## What would change your verdict (only if comment or reject)
Remove the `repo_root` parameter and update the single test caller to call `scan_python_source_language()`, or actually thread the supplied root through `source_files`/`relative` so the argument changes what gets scanned.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:quality:comment

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 tests review: source-language guard 覆盖不足

TL;DR

  • 这是什么: PR #337: 源码 English-only 契约系统性收敛 #367 的 tests 视角 review。
  • 结论: reject, 新增 source-language guard 没有完整覆盖它声明的新 English-only source policy。
  • 下一步: 补 scanner-level 负向测试, 并覆盖非 Python source 扩展或写清楚可验证豁免。

详细说明

我从测试质量角度看到了两个阻塞点。

第一, test_source_language_policy.py 只扫描 .github/scriptsscripts/codex_refactor_loop 下的 *.py, 但这次新规则写的是 source files English-only, 并明确提到 .sh / .py / .ts 这类 source 文件。实现计划也写了 .py/.sh。现在测试只证明 Python 包内部分文件干净, 没证明整个 source policy 被守住。

第二, test_scanner_rejects_han_comments_docstrings_and_refactor_history 没有把临时 source 文件喂给实际 scanner。它只断言 has_han() / has_refactor_history() 这些 helper predicate 会返回 true。这样即使 comment_findings()string_findings() 以后坏掉, 这个负向测试也可能继续绿。

我跑了聚焦测试, 54 个测试通过。但这个问题是覆盖质量问题, 不是当前红绿状态问题。


📎 完整 codex 原始输出(存档备查)

pr: 367
role: tests
verdict: reject

Verdict

Reject: the new source-language regression guard does not fully exercise or cover the source surface promised by the new English-only rule.

Evidence

  • skills/codex-refactor-loop/scripts/test_source_language_policy.py:72: source_files() only scans *.py under .github/scripts and scripts/codex_refactor_loop, while the new SKILL rule names source files broadly, including .sh/.py/.ts style source, and the implementation plan explicitly called for .py/.sh coverage. This leaves the new no-regression policy without coverage for non-Python source files.
  • skills/codex-refactor-loop/scripts/test_source_language_policy.py:215: test_scanner_rejects_han_comments_docstrings_and_refactor_history builds a sample string but only asserts has_han() and has_refactor_history() helper predicates. It never writes/parses a temporary source file through comment_findings(), string_findings(), or scan_python_source_language(), so the scanner could stop reporting prohibited comments/docstrings/error strings and this negative test would still pass.
  • Focused verification command passed: python3 -m unittest skills/codex-refactor-loop/scripts/test_source_language_policy.py skills/codex-refactor-loop/scripts/test_refactor_comment_policy_prompt_contract.py skills/codex-refactor-loop/scripts/test_host_env_surface_matrix.py skills/codex-refactor-loop/scripts/test_skill_reference_anchors.py in .worktrees/impl-issue337 ran 54 tests OK.

What would change your verdict (only if comment or reject)

Add scanner-level negative tests that feed temporary source files through the actual scanner for Han comments, docstrings, log/error strings, and refactor-history tokens, and expand the source file discovery/coverage to include the non-Python source extensions covered by the new policy or document a diff-backed exemption.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:tests:reject

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Architect review: approve

TL;DR

  • 这是什么: PR #337: 源码 English-only 契约系统性收敛 #367 的 architect 视角 review,检查 CLAUDE.md/AGENTS.md 架构合规。
  • 结论是什么: approve;这次改动把源码语言和 refactor-history 策略收敛到同一条主链路,并加了机械守卫。
  • 下一步: controller 可按 review-gate 继续计算共识;我这里没有 blocking finding。

详细说明

我按三点看了实际 diff: HOST_REFACTOR_COMMENT_POLICY 默认从 source comment 转成 noneSKILL.md/prompt/host.env.example 同步,新增 test_source_language_policy.py 作为 test-only guard。这个方向符合 CLAUDE.md 的事实源唯一、变更必须可验证、删除优先和 host.env 边界要求。

没有看到新的 lifecycle authority、.refactor-loop/host.env 生产事实迁移、外部 repo 引用、*WriteActor/*ReadActor 拆分、schema/protocol 变更或 compat shim。Quality reviewer 已指出 scan_python_source_language(repo_root=...) 参数误导的问题,那是 readability/comment 级别,不改变 architect approve。

验证我单独从 PR branch 临时 archive 跑了三组相关测试: test_source_language_policy.py 3 tests OK,test_host_env_surface_matrix.py + test_refactor_comment_policy_prompt_contract.py 13 tests OK。


📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: architect
verdict: approve
---

## Verdict
Approve: PR #367 improves architecture compliance by making the source-language/refactor-history policy explicit, deletion-first, and mechanically guarded without adding runtime authority or host SSOT drift.

## Evidence
- `skills/codex-refactor-loop/SKILL.md:114` maps the changed host surface to the CLAUDE.md fact-source and verifiability clauses: "事实源唯一:同一约束禁止在多处平行声明。版本号 -> `.version-bump.json`;host 运行时事实 -> `host.env`;skill 行为 -> 该 skill 的 SKILL.md 与 `scripts/test_*.py`。" The row now defines `$HOST_REFACTOR_COMMENT_POLICY` as default `none`, documents invalid values as fail-closed, and names `test_host_env_surface_matrix.py`, `test_refactor_comment_policy_prompt_contract.py`, and `test_source_language_policy.py` as test owners.
- `skills/codex-refactor-loop/SKILL.md:726` and `skills/codex-refactor-loop/SKILL.md:3029` align the propagated hard rule with the source-language clause at `skills/codex-refactor-loop/SKILL.md:3034`: "Source files are English-only; external user-facing artifacts are 中文 by default." The PR removes old source refactor-history comments and keeps rationale in external artifacts when policy is `none`.
- `skills/codex-refactor-loop/host.env.example:105` keeps the host.env default on the documented injection surface rather than `.refactor-loop/host.env`, satisfying the host boundary clause: "host 运行时事实由 `host.env` 注入" and "skill **无 host 项目改动权**:不修改 host 的 `.git` 配置 / CI 配置 / policy 文档;只在 `host.env` 暴露的 surface 上工作。"
- `skills/codex-refactor-loop/prompts/reviewer-architect.md:20`, `skills/codex-refactor-loop/prompts/implement.md:24`, `skills/codex-refactor-loop/prompts/verify.md:21`, and related prompt hunks converge on the same policy semantics instead of adding a second pathway. This matches CLAUDE.md: "单一主干,插件扩展:每个 skill 一条权威主链路;新能力以子模块/脚本挂载,禁止平行第二系统。"
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:17` through `skills/codex-refactor-loop/scripts/test_source_language_policy.py:60` adds a narrow test-only scanner plus explicit allowlist for existing Chinese user-facing output literals; `skills/codex-refactor-loop/scripts/test_source_language_policy.py:210` asserts the scanned Python source is clean and `skills/codex-refactor-loop/scripts/test_source_language_policy.py:227` locks allowlist entries to current literals. That satisfies CLAUDE.md: "变更必须可验证:行为约束必须落到机械验证手段(behavior test / source-regression test / 段落 lint)。"
- Diff scope stays within the issue #337 declared plan from the implement log: SKILL.md policy, `host.env.example`, five prompts, source comment deletion, and `test_source_language_policy.py`. No new `*WriteActor`/`*ReadActor` split, no new external repo reference, no schema/protocol surface, no `.refactor-loop/host.env` production SSOT move, and no compat shim/parallel pathway were introduced.
- Verification run from a temporary archive of `origin/refactor/issue337-source-english-only`: `python3 -m unittest discover -s skills/codex-refactor-loop/scripts -p 'test_source_language_policy.py'` passed 3 tests; `python3 -m unittest skills/codex-refactor-loop/scripts/test_host_env_surface_matrix.py skills/codex-refactor-loop/scripts/test_refactor_comment_policy_prompt_contract.py` passed 13 tests.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:architect:approve

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — Consensus-rnd Phase review-gate r1 → FIX(❌ 不需要人介入)

#367(#337 源码English-only)r1:architect approve、tests reject(source-language guard 的 negative test 只断言 helper predicate,未跑真 scanner 入口)、quality comment。fix r2 派出补真 scanner-path 断言。

⟦AI:AUTO-LOOP⟧

…ent_findings/string_findings/scan_python_source_language),applied-1
…337-source-language-guard

# Conflicts:
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/cli.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/monitors/concurrency.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/phase9/router.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/release/publisher.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/release/required_checks.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_plan.py
#	skills/codex-refactor-loop/scripts/codex_refactor_loop/workflow_spec.py
#	skills/codex-refactor-loop/scripts/test_skill_reference_anchors.py
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — review-gate r1(❌ 不需要人介入)

维度
阶段 Consensus-rnd Phase review-gate r1
关联 PR #367(#337 源码 English-only 契约)head b926383
冲突 ✅ 已解(merge auto-refact-dev,含 #104 host-portability + #344/#345);965 测试全绿
Reviewer architect / tests / quality 三角度并行
是否需要人介入 ❌ 否(3/3 真值表自动判 merge/fix)

下一步自动会做:3 reviewer 各审 PR diff(对 base auto-refact-dev = 纯 #337 source-lang 改动)→ reject=0&approve≥1 则 ready+merge;reject≥1 则派 fix。

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Tests reviewer:reject,缺一条 source-regression 覆盖

TL;DR

  • 这是什么: PR #337: 源码 English-only 契约系统性收敛 #367 的 tests 角度独立 review。
  • 结论是什么: reject,因为新增的 source-language guard 漏测了 prompt 明确禁止的 iterN/cluster refactor-history source comment 形式。
  • 下一步: 请补 scanner 负例和检测逻辑,让 iterN/cluster 即使不伴随 Refactor ( / Old pattern / New principle 也会失败。

详细说明

这次改动把默认 HOST_REFACTOR_COMMENT_POLICY 收敛为 none,并在 prompt 中明确禁止新增 Refactor (...)Old patternNew principleiterN/cluster 这类 refactor-history source comments。现有新测试覆盖了 Han 文本、Refactor (Old pattern,但 REF_HISTORY_TOKENS 只包含 Refactor ( / Old pattern / New principle,没有覆盖单独出现的 iterN/cluster

因此一个类似 # iter3/cluster-016 rationale 的源码注释可以逃过当前 scanner,虽然它已经被新 prompt contract 明确列为缺陷。这个是 net-new no-regression rule 的真实覆盖缺口,按 tests 角色语义应为 must-fix reject。


📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: tests
verdict: reject
---

## Verdict
Reject: the new source-language regression guard misses one of the forbidden refactor-history forms introduced by the prompt contract.

## Evidence
- `skills/codex-refactor-loop/prompts/implement.md:35` and `skills/codex-refactor-loop/prompts/verify.md:25` now forbid `iterN/cluster` refactor-history source comments under missing/empty/default/`none`.
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:21` defines `REF_HISTORY_TOKENS = ("Refactor (", "Old pattern", "New principle")`, so the new scanner does not detect the separately named `iterN/cluster` form unless it also contains one of the other tokens.
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:221` exercises Han text plus `Refactor (` / `Old pattern`, but it has no negative sample such as `# iter3/cluster-016 rationale` or `# iterN/cluster guard`; that business outcome can regress while the tests stay green.
- No `[Skip]`/manual test escape, sleep-based pacing, or assertion loosening was found in the changed tests.

## What would change your verdict (only if comment or reject)
Add scanner-level negative coverage for the `iterN/cluster` refactor-history form, and update the detection logic so that form is rejected even when it does not also contain `Refactor (`, `Old pattern`, or `New principle`.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:tests:reject

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 architect review approve

TL;DR


详细说明

我按 CLAUDE.md / AGENTS.md、实际 PR diff、issue #337 design decision 和 implement summary 复核。这个 PR 把 HOST_REFACTOR_COMMENT_POLICY 默认收敛为 none,删除源码里的历史 Refactor/Old pattern/New principle 注释,并用 test_source_language_policy.py 加 test-only source guard 锁住 English-only 源码契约。

架构上没有看到新的 lifecycle authority、外部仓库引用、.refactor-loop 生产事实迁移、*WriteActor / *ReadActor / *Store 拆分或兼容空壳。唯一注意点是本轮 prompt 给的 pathspec 会漏掉 skills/codex-refactor-loop/host.env.example,但 PR body、design decision 和 implement summary 都声明了这个默认值变更,实际 diff 也符合该范围。


📎 完整 codex 原始输出(存档备查)

pr: 367
role: architect
verdict: approve

Verdict

approve — no architectural concerns; merge OK from architect angle.

Evidence

  • CLAUDE.md:37: "事实源唯一:同一约束禁止在多处平行声明。版本号 → .version-bump.json;host 运行时事实 → host.env;skill 行为 → 该 skill 的 SKILL.md 与 scripts/test_*.py。" The PR keeps the policy fact in skills/codex-refactor-loop/SKILL.md:115 and backs it with test_host_env_surface_matrix.py, test_refactor_comment_policy_prompt_contract.py, and test_source_language_policy.py, rather than adding a second registry.
  • CLAUDE.md:42: "变更必须可验证:行为约束必须落到机械验证手段(behavior test / source-regression test / 段落 lint);仅靠"agent 应该记得"承载的约束视为未落地。" The new guard at skills/codex-refactor-loop/scripts/test_source_language_policy.py:215 asserts the tree is clean, and test_source_language_policy.py:221 proves Han comments/docstrings/error strings and refactor-history comments are rejected.
  • CLAUDE.md:41: "删除优先:废弃 skill、deprecated wrapper、*.bak/*.old/*.deprecated 直接删除,不保留兼容空壳;历史由 git 与 CHANGELOG 保留。" The Python diff is deletion-heavy and removes historical Refactor/Old pattern/New principle source comments without adding a compat shim, wrapper, or parallel pathway.
  • CLAUDE.md:65: "Daemon 是经共识授权的 narrow allowlist 例外,默认不持 lifecycle authority..." The PR does not add any daemon, public lifecycle command, *WriteActor / *ReadActor / *Store split, or new git/GitHub mutation authority; changed command/test references are source-regression adjustments around existing surfaces.
  • CLAUDE.md:66: "skill 无 host 项目改动权:不修改 host 的 .git 配置 / CI 配置 / policy 文档;只在 host.env 暴露的 surface 上工作。" The only host-env-surface change is the skill-owned example/default at skills/codex-refactor-loop/host.env.example:108, matching SKILL.md:115; no production facts move into .refactor-loop/ or .refactor-loop/host.env.
  • Scope honesty: .refactor-loop/runs/design-decision-issue337.md and .refactor-loop/runs/implement-issue-337.md declare the source-language guard, SKILL/prompt/default changes, source-comment deletion, and documented SCOPE_EXTEND records for stale source-regression tests. The actual PR diff stays within that implementation envelope; the prompt pathspec omitted host.env.example, but the implement summary and design decision include it.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:architect:approve

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Quality review r1:comment,当前只剩一个小型死代码清理

TL;DR

  • 这是什么: PR #337: 源码 English-only 契约系统性收敛 #367 的 quality 视角 review,检查命名、简单性、死代码和复杂度。
  • 结论是什么: comment,不是 blocker;整体改动聚焦可读,但新 guard 留了一个未使用常量。
  • 下一步: 建议删掉 PYTHON_SOURCE_ROOTS,并在无其它 reader 时一起收掉 SKILL_ROOT

详细说明

这条评论 supersede 我前面那条 stale quality comment: 当前 branch 已经修掉了 scan_python_source_language(repo_root=...) 不生效的问题。现在看到的 quality 问题更小。

skills/codex-refactor-loop/scripts/test_source_language_policy.py:17 新增了模块级 PYTHON_SOURCE_ROOTS,但当前 branch 已经在 source_files() 内部按传入的 repo_root 重新构造 root-aware tuple,模块级常量没有 reader。结果是 SKILL_ROOT 也只为了这个未使用常量存在。按本轮 checklist,这是新引入 dead code,所以给 comment


📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: quality
verdict: comment
---

## Verdict
Comment: the diff is focused and readable overall, with one small dead-code cleanup left in the new test guard.

## Evidence
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:17`: `PYTHON_SOURCE_ROOTS` is introduced as a module-level tuple, but the current branch never reads it; `source_files()` now builds its own root-aware tuple locally. This is trivial, but it is newly introduced dead code and also leaves `SKILL_ROOT` only alive to feed the unused constant.

## What would change your verdict (only if comment or reject)
Delete the unused module-level `PYTHON_SOURCE_ROOTS` constant and inline/remove the now-unneeded module-level `SKILL_ROOT` if no other reader remains.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:quality:comment

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — review-gate r1 完成(❌ 不需要人介入)

维度
阶段 Consensus-rnd Phase review-gate → fix r1
PR #367(#337 源码 English-only)head b926383
评审 r1 architect=approve · tests=reject · quality=comment
真值表 reject≥1 → FIX(派 fix r1)
tests reject scanner 漏检 iterN/cluster refactor-history 形式(不含 Refactor (/Old pattern/New principle 时);需加 scanner 级负向覆盖 + 检测逻辑
是否需要人介入 ❌ 否(fix→re-review 自动循环)

下一步自动会做:fix codex 读 3 reviewer artifact 修 tests reject → controller commit+push → 重派 3 reviewer r2。

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 PR 367 round 1 fix 已完成

TL;DR

  • 这是什么: fix-codex 已处理 PR 367 第 1 轮 reviewer reject。
  • 结论: 唯一 blocking reject 已修复;quality 的 dead-code comment 也顺手清掉。
  • 下一步: controller 可重新派发 Consensus-rnd Phase review-gate。

详细说明

tests reviewer 指出 skills/codex-refactor-loop/scripts/test_source_language_policy.py 只拦 Refactor ( / Old pattern / New principle,没有拦 prompt contract 里同样禁止的 standalone iterN/cluster refactor-history source comment。现在 scanner 增加了 iterN/cluster / iter3/cluster-016 检测,并在临时 fixture 里断言 # iter3/cluster-016 rationale 会被 comment-level 和 full-scan 两层拦住。

同时删除了同文件中新引入但未使用的 SKILL_ROOT / PYTHON_SOURCE_ROOTS,这是 quality reviewer 的 advisory comment,不作为 blocking demand 计数。验证已通过: bash -lc "true"python3 -m unittest skills/codex-refactor-loop/scripts/test_source_language_policy.pypython3 -m unittest discover -s skills/codex-refactor-loop/scripts -p 'test_*.py',其中 discovery 为 965 tests、skipped=1。


📎 完整 codex 原始输出(存档备查)
# Fix report for PR 367 round 1

## Applied
- (A) `skills/codex-refactor-loop/scripts/test_source_language_policy.py:18`: added `REF_HISTORY_ITER_CLUSTER_RE` so standalone `iterN/cluster` and numbered `iter3/cluster-016` refactor-history comment forms are detected (addresses reviewer:tests evidence #1).
- (A) `skills/codex-refactor-loop/scripts/test_source_language_policy.py:65`: updated `has_refactor_history()` to reject both the existing `Refactor (`/`Old pattern`/`New principle` tokens and the standalone `iterN/cluster` form (addresses reviewer:tests evidence #2).
- (A) `skills/codex-refactor-loop/scripts/test_source_language_policy.py:226`: added a scanner-level negative fixture for `# iter3/cluster-016 rationale`, with assertions at `:243` and `:249` proving comment-level and full-scan rejection (addresses reviewer:tests evidence #3).
- (A) `skills/codex-refactor-loop/scripts/test_source_language_policy.py:15`: removed unused module-level `SKILL_ROOT` and `PYTHON_SOURCE_ROOTS` while editing the same file; this addresses reviewer:quality's advisory dead-code comment, not a blocking reject.

## Rejected as false positive
- None.

## Blocked (cannot fix this round)
- None.

## Build status
- build: pass (`bash -lc "true"`)
- tests: pass (`python3 -m unittest skills/codex-refactor-loop/scripts/test_source_language_policy.py`: 3 tests)
- tests: pass (`python3 -m unittest discover -s skills/codex-refactor-loop/scripts -p 'test_*.py'`: 965 tests, skipped=1)

## Recommendation for next round
- Expect merge: the only reject demand was fixed in-scope, the advisory quality cleanup was included, and no false-positive/conflict/human-decision blockers remain.

refactor self-doc: not applicable (HOST_REFACTOR_COMMENT_POLICY=none)

⟦AI:AUTO-LOOP⟧
FIX_DONE:367:round-1:applied-1:rejected-0:blocked-0

⟦AI:AUTO-LOOP⟧

…向覆盖 + 检测逻辑(applied-1,addr tests reject)
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — fix r1 完成 → review-gate r2(❌ 不需要人介入)

维度
阶段 fix r1 done → review-gate r2
PR #367 head 55a8405(fix r1: source-lang guard 负向覆盖 + 检测逻辑)
fix r1 applied-1:rejected-0:blocked-0,source-lang test OK
下一步 重派 architect/tests/quality r2 审 55a8405
是否需要人介入 ❌ 否

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 tests reviewer 通过

TL;DR

  • 这是什么:PR #337: 源码 English-only 契约系统性收敛 #367 的 tests 角度独立 review。
  • 结论:approve, 覆盖和测试质量足够支撑这次源码 English-only 收敛。
  • 下一步:controller 可按 review-gate 继续汇总;tests 角度没有 must-fix。

详细说明

我按三点检查:新增/变更测试是否断言真实行为、是否引入 sleep/skip/manual 逃逸、是否把断言变松。没有发现阻塞项。

关键覆盖在 test_source_language_policy.py:一条测试跑完整生产源码扫描并要求无未豁免发现,另一条用临时违规样本验证 Han comment、refactor-history comment、Han docstring、selected error string 都会被识别;allowlist 也有当前 literal 匹配测试,避免豁免变成死名单。HOST_REFACTOR_COMMENT_POLICY 的默认 none 和显式 self-doc-comment 两条路径由 prompt contract 测试和 host env matrix 测试锁住。

📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: tests
verdict: approve
---

## Verdict
Test coverage and test quality are adequate for the source English-only policy cleanup.

## Evidence
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:213` asserts the full production Python source scan returns no unallowlisted findings, so this is not a bump-only test.
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:218` creates a temporary prohibited sample and asserts detection of Han comments, refactor-history comments, Han docstrings, and selected error strings.
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:252` verifies every allowlist entry still matches a current literal, preventing stale exemptions from silently accumulating.
- `skills/codex-refactor-loop/scripts/test_refactor_comment_policy_prompt_contract.py:20` and `:48` cover both default `none` policy behavior and explicit `self-doc-comment` opt-in behavior across implement, verify, architect, quality, and review-fix prompts.
- `skills/codex-refactor-loop/scripts/test_host_env_surface_matrix.py:221` pins the host env matrix/default/export/test-owner contract for `HOST_REFACTOR_COMMENT_POLICY`.
- `skills/codex-refactor-loop/scripts/test_github_body_renderer.py:135` keeps the renderer authority contract covered after docstring cleanup by asserting read-artifact-only registration and forbidden lifecycle/write tokens.
- Diff scan found no added `sleep`/delay pacing, no added skip/manual-test escape, and no clear assertion loosening that would hide behavior.

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Quality review r2: comment

TL;DR

  • 这是什么:PR 367 的 code quality/readability 复审。
  • 结论:整体可读且聚焦;只有一个小的 clarity comment。
  • 下一步:建议把 degradation.py 的 broad filename exclusion 改成 exact documented exclusion 或纳入现有 allowlist 模型。

详细说明

我按三点 diff 打开了 PR 分支上的所有 touched files,并重点看了新增的 skills/codex-refactor-loop/scripts/test_source_language_policy.py。主要实现思路是清晰的:大部分变更是删除历史 refactor source comments,新增的 scanner 也基本保持在 test-only surface。

唯一质量问题在 test_source_language_policy.py:79source_files()path.name != "degradation.py" 静默跳过同名文件。这个例外比下面的 AllowlistEntry(relative_path, owner, reason) 粗很多,后续如果出现另一个同名文件也会被隐藏。建议改成 exact repo-relative exclusion 并写 reason,或者把允许保留的 literal 按现有 allowlist 的 path/owner/reason 模型表达。


📎 完整 codex 原始输出(存档备查)
---
pr: 367
role: quality
verdict: comment
---

## Verdict
Comment: the diff is readable and focused overall, but the new source-language guard has one magic filename exclusion that should be made explicit.

## Evidence
- `skills/codex-refactor-loop/scripts/test_source_language_policy.py:79`: `source_files()` silently excludes every file named `degradation.py`, while the rest of the scanner uses exact `AllowlistEntry(relative_path, owner, reason)` entries. That broad filename exception is harder to review and can hide future files with the same basename; the intent would be clearer as an exact documented exclusion or exact allowlist entries.

## What would change your verdict (only if comment or reject)
Replace the basename-only `path.name != "degradation.py"` filter with an exact repo-relative exclusion that carries a reason, or model the remaining accepted literals through the existing `AllowlistEntry` path/owner/reason structure.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:quality:comment

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

🤖 Architect review: 架构角度通过

TL;DR

  • 这是什么: PR #337: 源码 English-only 契约系统性收敛 #367 的 architect/CLAUDE.md compliance 独立审查。
  • 结论: approve, 未发现会降低架构合规性的新增问题。
  • 下一步: controller 可把本 reviewer 结果纳入共识;无需 maintainer 处理。

详细说明

我按 CLAUDE.md / AGENTS.md、三点 diff、实施摘要和 scope 记录检查了这次 source English-only / refactor comment policy 收敛。关键点是 $HOST_REFACTOR_COMMENT_POLICY 的事实源仍在 SKILL.md host env surface matrix,host.env.example 和 reviewer/implement/verify prompt 同步到 missing/empty/default=none,没有把 host production SSOT 搬进 .refactor-loop/

新增的 test_source_language_policy.py 是测试侧 guard,用来抓 Python source 里的 Han 文本和 Refactor/Old/New/iter history source comments;配套 prompt contract source-regression 覆盖了 default none、explicit self-doc-comment 和 invalid fail-closed。diff 没有新增 actor 拆分、外部 repo 依赖、schema/protocol authority、lifecycle authority 或 compat shim。广泛 runtime 文件变化主要是删除 source refactor-history comment/docstring,不是新增行为路径。


📎 完整 codex 原始输出(存档备查)

pr: 367
role: architect
verdict: approve

Verdict

approve - no architectural compliance regression found in the source English-only/comment-policy convergence.

Evidence

  • skills/codex-refactor-loop/SKILL.md:128 keeps $HOST_REFACTOR_COMMENT_POLICY as the single documented contract for refactor-history source comments: default/missing is none, explicit self-doc-comment remains a compatibility opt-in, and rationale stays in external artifacts.
  • skills/codex-refactor-loop/host.env.example:108 mirrors that contract in the copyable host.env template without moving host production facts into .refactor-loop/.
  • skills/codex-refactor-loop/prompts/reviewer-architect.md:20 updates the architect checklist to the same policy, so reviewer behavior now follows the SKILL.md fact source instead of reintroducing the old empty-as-self-doc rule.
  • skills/codex-refactor-loop/scripts/test_source_language_policy.py:213 adds a mechanical guard for Python source Han text/refactor-history comments, and :218 proves the scanner catches comments, docstrings, selected strings, and iteration/cluster history tokens. This supports CLAUDE.md: "变更必须可验证:行为约束必须落到机械验证手段(behavior test / source-regression test / 段落 lint)".
  • skills/codex-refactor-loop/scripts/test_refactor_comment_policy_prompt_contract.py:20 source-regresses the prompt contract for default none, external rationale, explicit self-doc-comment, and fail-closed invalid policy.
  • The diff adds no *WriteActor/*ReadActor/*Store split, no new external repo dependency, no schema/protocol authority, and no new lifecycle-authority or compatibility wrapper path. The broad runtime diffs are comment/docstring removals rather than behavioral expansions.
  • Scope drift is documented by .refactor-loop/runs/implement-issue-337.md SCOPE_EXTEND records for stale source-regression tests, matching the touched test files.

⟦AI:AUTO-LOOP⟧
REVIEW_DONE:367:architect:approve

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 31, 2026

📊 当前状态 — review-gate r2 共识 MERGE_WITH_COMMENTS,合并中(❌ 不需要人介入)

维度
阶段 review-gate r2 → MERGE_WITH_COMMENTS
PR #367(#337 源码 English-only)head 55a8405
r2 真值表 architect=approve · tests=approve(r1 reject 已解)· quality=comment(advisory)
CI contract-tests / manifest-version-sync / skill-degradation / lint-advisory 全绿
quality comment advisory only(不阻塞 merge),已 surface 供后续参考
下一步 ready+merge 到 auto-refact-dev → close #337 → post-merge trunk 重跑 TEST_CMD
是否需要人介入 ❌ 否

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning loning marked this pull request as ready for review May 31, 2026 19:53
@loning loning merged commit 48fca9a into auto-refact-dev May 31, 2026
4 checks passed
@loning loning deleted the refactor/issue337-source-english-only branch May 31, 2026 19:53
@loning loning added the crnd:phase:merged merged label May 31, 2026
loning added a commit that referenced this pull request May 31, 2026
* #344: 发版目标 issue 存在时默认进入版本倒计时(crnd:milestone:release-target label + release-gate/wakeup-plan 倒计时投影,r4 minimal consensus) (#366)

* #345: skill 身份重定位 — audit 降为 fallback issue-producer (#365)

* #345: skill 身份重定位 — audit 降为 fallback issue-producer,主路径=issue resolution(r6 structural consensus,no-CLAUDE-change skill-local main-path)

* #365 fix r2: SKILL.md 详细 Producer Contract 改为 audit-fallback 一致,消除同源 competing facts(applied-1)

* #104: host-portability fold setup owner surface (#363)

* #104: host-portability — fold setup owner surface 进 codex-refactor-loop(HostWorkflowSpec 七面投影/non-admin merge/host-env release checks)

* #363 fix r2: 补 host-required release checks fail-closed denial-path behavior tests(applied-2)

* #363 fix r4: 补 missing/empty HOST_GITHUB_RELEASE_REQUIRED_CHECKS default-projection behavior test(applied-1)

* #337: 源码 English-only 契约系统性收敛 (#367)

* #337: 源码 English-only 契约系统性收敛 — test-only source-language guard + HOST_REFACTOR_COMMENT_POLICY default→none,删历史中文注释(r3 structural consensus)

* #367 fix r2: source-language guard negative test 改走真实 scanner 入口(comment_findings/string_findings/scan_python_source_language),applied-1

* #367 fix r1: source-language guard 加 iterN/cluster refactor-history 负向覆盖 + 检测逻辑(applied-1,addr tests reject)

* #364: Path-A divergent-source contract-only locator(SKILL solver source contract + 3 solver prompt + source-regression;无新 module/parser/header) (#368)

* fix(#369 review r1): source-lang guard honor HOST_REFACTOR_COMMENT_POLICY + 删 workflow_spec ValidatedWorkflowSpec.as_dict dead alias(quality reject,applied-2)
@loning loning removed the crnd:phase:reviewing review-gate reviewers in flight label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crnd:human:auto auto-advancing, no human needed crnd:lifecycle:managed loop-managed item crnd:phase:merged merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant