This is an automated email from the ASF dual-hosted git repository.
terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 31d22dead07 Require full Markdown reviews and commit messages after
coding (#40186)
31d22dead07 is described below
commit 31d22dead078c06ed04c18b184b2504cb1383e02
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Oct 13 23:36:03 2026 +0800
Require full Markdown reviews and commit messages after coding (#40186)
---
.codex/context/change-completion.md | 18 +++--
.codex/harness/agents/cases.toml | 69 ++++++++--------
.codex/harness/agents/code_handoff_hook.py | 47 +++++++++--
.codex/harness/agents/test_code_handoff_hook.py | 103 ++++++++++++++++++++----
.codex/skills/review-pr/SKILL.md | 4 +-
5 files changed, 177 insertions(+), 64 deletions(-)
diff --git a/.codex/context/change-completion.md
b/.codex/context/change-completion.md
index c4587d1e7a9..f7bec81ac4d 100644
--- a/.codex/context/change-completion.md
+++ b/.codex/context/change-completion.md
@@ -27,10 +27,9 @@ For every authorized code-writing task, including a
restoration or rollback that
Treat scripts, searches, formatters, compilation, tests, benchmarks, and
review tools as evidence rather than proof, and fix every safe in-scope
violation.
3. Run the applicable verification and non-regression checks that lack valid
current-state evidence.
An invalidated, unmatched, missing, or inconclusive required result keeps
the task incomplete.
-4. Select the review route from the existing code-implementation risk
preflight and current owner, contract, and verification evidence.
- Use one bounded self-review only for an ordinary local implementation whose
preflight and current evidence establish low risk, with no public or shared
contract change, cross-owner impact, architecture change, security,
concurrency, lifecycle or SPI impact, or credible functional or performance
risk.
- Invoke `$review-pr` in Formal Review Mode for explicit code or PR reviews,
PR-backed candidates, policy or harness changes, and tasks with security,
concurrency, lifecycle or SPI impact or high or unproved risk.
- Existing authority, architecture, safety, and triggered high-risk gates
remain required on either route.
+4. Invoke `$review-pr` in Formal Review Mode for every code-writing task,
including ordinary low-risk local changes, without requiring a separate user
request.
+ Also use Formal Review for explicit code or PR reviews, PR-backed
candidates, and policy or harness changes.
+ Existing authority, architecture, safety, and triggered high-risk gates
remain required.
For Formal Review, use Code Correctness Review for a standalone local
candidate unless the user requests another focus.
For Formal Review of a PR-backed candidate, apply the public-head,
remote-evidence, and mandatory style-verification gates.
For Formal Review of a standalone candidate, review only the original task
baseline and attributed task-owned delta.
@@ -38,12 +37,13 @@ For every authorized code-writing task, including a
restoration or rollback that
Do not assign this audit when no such defensive change remains in the
final task delta.
5. Hand off only when the selected review and all required current-state
checks pass and no later code-affecting write or new evidence invalidates them.
For a required Formal Review, the latest complete review must return
`Review Result: Mergeable`.
-6. When either review route identifies a safe in-scope required finding, fix
it, rerun only invalidated audits and checks, and repeat the selected review.
+6. When Formal Review identifies a safe in-scope required finding, fix it,
rerun only invalidated audits and checks, and repeat the complete review.
Retain the selected Formal Review route through its finding-fix loop.
Continue until the selected review passes; a Formal Review must return
`Review Result: Mergeable`.
7. A scope expansion, missing authority, unresolved architecture choice,
high-risk action, `Review Incomplete`, or `Needs Discussion` result keeps the
task incomplete.
Yield to the user only for the exact decision, authority, or unavailable
evidence needed to continue; do not claim successful completion or provide
commit artifacts while the task remains incomplete.
-8. Provide a commit message or manual Git commands only when the user requests
them; this never authorizes Git mutation.
+8. After every code-writing task completes, provide a nonempty `Commit
Message:` without requiring a separate user request; this never authorizes Git
mutation.
+ Provide manual Git commands only when the user requests them.
For requested manual Git commands, propose `git commit --dry-run --only`
and `git commit --only` for only task-owned files without unrelated hunks.
Include `git add -- <new-task-paths>` first only when requested manual
instructions need to add untracked task files.
Never execute a Git write without exact current-task authorization.
@@ -59,8 +59,10 @@ Otherwise report the minimum additional scope instead of
changing policy to just
The final response must lead with the outcome and include changed files and
rationale, verification status, remaining risks, and the next action only when
one is still required.
For a completed task, include exactly one `Task Status: Completed` line and a
non-empty `Evidence:` summary of the current audit, verification and selected
review.
-When Formal Review is required, also include exactly one `Review Result:
Mergeable` line from the actual completed review and retain its substantive
required evidence and coverage without repeating its complete report.
-Do not manufacture a Formal Review verdict for a task completed by bounded
self-review.
+Include the actual completed Formal Review as one complete fenced `markdown`
report with exactly one `Review Result: Mergeable` line and nonempty `###
Result`, `### Evidence`, and `### Coverage` sections.
+Report confirmed findings and required changes, or explicitly state that no
blocking issues or recommended changes remain.
+Keep `Task Status: Completed`, the outer `Evidence:` summary, and `Commit
Message:` outside the review block.
+Do not substitute bounded self-review for the required Formal Review or
fabricate a passing verdict.
The project Stop hook checks the textual completion state after supported
write tools change a non-prose repository artifact.
Any later code-affecting write marks the task pending again and requires
current checks and the applicable passing review before completion.
diff --git a/.codex/harness/agents/cases.toml b/.codex/harness/agents/cases.toml
index 1ea20f8c1b7..ac2a61958b3 100644
--- a/.codex/harness/agents/cases.toml
+++ b/.codex/harness/agents/cases.toml
@@ -375,7 +375,7 @@ allowed_actions = ["inspect_local", "edit_non_code",
"run_local_checks", "wrap_h
forbidden_actions = ["mutate_git", "mutate_remote"]
required_reasons = ["explicit_non_code_authorization",
"pre_handoff_review_required"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for explicit code or PR reviews, PR-backed
candidates, policy or harness changes, and tasks with security, concurrency,
lifecycle or SPI impact or high or unproved risk.", "For Formal Review, use
Code Correctness Review for a standalone local candidate unless the user
requests another focus.", "For a required Formal Review, the latest complete
review must return `Review Result: Me [...]
+policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for every code-writing task, including
ordinary low-risk local changes, without requiring a separate user request.",
"Also use Formal Review for explicit code or PR reviews, PR-backed candidates,
and policy or harness changes.", "For Formal Review, use Code Correctness
Review for a standalone local candidate unless the user requests another
focus.", "For a required Formal Review, [...]
critical = true
[[cases]]
@@ -989,15 +989,16 @@ description = "Keeps an unrelated pre-existing
verification failure outside the
phase = "scope gate and ordinary completion loop"
ordinary_loop = true
semantic_policy_assertions = true
-prompt = "The authorized FooService fix and focused verification pass, and its
pre-handoff review finds no in-scope issue. A broader check also exposes a
pre-existing failure in unrelated BarService. Complete the FooService task
without changing BarService. The user did not request commit artifacts."
+prompt = "The authorized FooService fix and focused verification pass, and its
complete `$review-pr` Formal Review returned `Review Result: Mergeable`. A
broader check also exposes a pre-existing failure in unrelated BarService.
Complete the FooService task without changing BarService. The user did not
request commit artifacts."
decision = "proceed"
-required_actions = []
-allowed_actions = ["inspect_local"]
+required_actions = ["propose_commit_message"]
+allowed_actions = ["inspect_local", "propose_commit_message"]
forbidden_actions = ["edit_code", "edit_non_code", "edit_unrelated_changes",
"mutate_git", "mutate_remote"]
required_reasons = ["preserve_unrelated_work", "review_passed"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Hand off
only when the selected review and all required current-state checks pass and no
later code-affecting write or new evidence invalidates them.", "For a required
Formal Review, the latest complete review must return `Review Result:
Mergeable`.", "For a completed task, include exactly one `Task Status:
Completed` line and a non-empty `Evidence:` summary of the current audit,
verification and selected review.", "When [...]
+policy_assertions = [{source = "change-completion", statements = ["Hand off
only when the selected review and all required current-state checks pass and no
later code-affecting write or new evidence invalidates them.", "For a required
Formal Review, the latest complete review must return `Review Result:
Mergeable`.", "For a completed task, include exactly one `Task Status:
Completed` line and a non-empty `Evidence:` summary of the current audit,
verification and selected review.", "Inclu [...]
critical = true
+required_summary_terms = ["Commit Message:", "```markdown", "### Result", "###
Evidence", "### Coverage"]
[[cases]]
id = "manual_exception"
@@ -1452,7 +1453,7 @@ forbidden_actions = ["edit_code", "edit_non_code",
"run_bounded_adversarial_revi
required_reasons = ["pre_handoff_review_required"]
required_summary_terms = ["$review-pr", "Formal Review"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for explicit code or PR reviews, PR-backed
candidates, policy or harness changes, and tasks with security, concurrency,
lifecycle or SPI impact or high or unproved risk.", "For Formal Review, use
Code Correctness Review for a standalone local candidate unless the user
requests another focus.", "For a required Formal Review, the latest complete
review must return `Review Result: Me [...]
+policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for every code-writing task, including
ordinary low-risk local changes, without requiring a separate user request.",
"For Formal Review, use Code Correctness Review for a standalone local
candidate unless the user requests another focus.", "For a required Formal
Review, the latest complete review must return `Review Result: Mergeable`."]}]
critical = true
[[cases]]
@@ -2090,39 +2091,39 @@ critical = true
[[cases]]
id = "preflight_pass_allows_handoff"
group = "coding / regular"
-description = "Hands off completed task files using current passing evidence
without repeating checks or proposing unrequested Git artifacts."
+description = "Hands off completed task files using current passing evidence
without repeating checks and with an automatic commit message."
phase = "ordinary completion loop"
ordinary_loop = true
profile = "code-write"
semantic_policy_assertions = true
prompt = "All authorized code changes and current-state checks are complete,
the latest `$review-pr` Formal Review returned `Review Result: Mergeable`, and
no later write or new evidence invalidated it. The only task-owned tracked
files are `module-a/src/main/java/example/Foo.java` and
`module-a/src/test/java/example/FooTest.java`, neither contains unrelated
hunks. Complete the task without repeating an unchanged check, audit, or
review. The user did not request commit artifacts or autho [...]
decision = "proceed"
-required_actions = []
-allowed_actions = ["inspect_local"]
+required_actions = ["propose_commit_message"]
+allowed_actions = ["inspect_local", "propose_commit_message"]
forbidden_actions = ["edit_code", "edit_non_code", "run_local_checks",
"run_pre_handoff_review", "mutate_git", "mutate_remote"]
required_reasons = ["review_passed", "git_read_only"]
-required_summary_terms = ["Foo.java", "FooTest.java"]
+required_summary_terms = ["Foo.java", "FooTest.java", "Commit Message:",
"```markdown", "### Result", "### Evidence", "### Coverage"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["The final
response must lead with the outcome and include changed files and rationale,
verification status, remaining risks, and the next action only when one is
still required.", "Provide a commit message or manual Git commands only when
the user requests them; this never authorizes Git mutation.", "For requested
manual Git commands, propose `git commit --dry-run --only` and `git commit
--only` for only task-owned files [...]
+policy_assertions = [{source = "change-completion", statements = ["The final
response must lead with the outcome and include changed files and rationale,
verification status, remaining risks, and the next action only when one is
still required.", "Include the actual completed Formal Review as one complete
fenced `markdown` report with exactly one `Review Result: Mergeable` line and
nonempty `### Result`, `### Evidence`, and `### Coverage` sections.", "After
every code-writing task comple [...]
critical = true
[[cases]]
id = "completed_bounded_review_is_reported"
group = "operations"
-description = "Reports the actual passing Formal Review without repeating its
complete report in a routine handoff."
+description = "Reports the actual passing Formal Review as a complete Markdown
report with an automatic commit message."
phase = "completion output gate"
ordinary_loop = true
profile = "code-write"
semantic_policy_assertions = true
prompt = "A routine authorized code task is complete. Its implementation and
applicable verification are finished, the latest `$review-pr` Formal Review
returned `Review Result: Mergeable`, and no later write occurred. Deliver the
final handoff."
decision = "proceed"
-required_actions = []
-allowed_actions = []
+required_actions = ["propose_commit_message"]
+allowed_actions = ["propose_commit_message"]
forbidden_actions = ["edit_code", "edit_non_code"]
required_reasons = []
-required_summary_terms = ["Review Result: Mergeable"]
+required_summary_terms = ["Review Result: Mergeable", "Commit Message:",
"```markdown", "### Result", "### Evidence", "### Coverage"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Hand off
only when the selected review and all required current-state checks pass and no
later code-affecting write or new evidence invalidates them.", "For a required
Formal Review, the latest complete review must return `Review Result:
Mergeable`.", "For a completed task, include exactly one `Task Status:
Completed` line and a non-empty `Evidence:` summary of the current audit,
verification and selected review.", "When [...]
+policy_assertions = [{source = "change-completion", statements = ["Hand off
only when the selected review and all required current-state checks pass and no
later code-affecting write or new evidence invalidates them.", "For a required
Formal Review, the latest complete review must return `Review Result:
Mergeable`.", "For a completed task, include exactly one `Task Status:
Completed` line and a non-empty `Evidence:` summary of the current audit,
verification and selected review.", "Inclu [...]
critical = true
[[cases]]
@@ -2145,7 +2146,7 @@ max_summary_chars = 35
required_summary_term_groups = [["remove", "may not keep", "must not keep",
"cannot keep"], ["fallback-only test", "test that only protects the fallback",
"test that exists only to preserve the fallback", "test that exists solely to
protect the fallback", "test whose sole purpose is protecting the unsupported
fallback", "test that protects only the fallback", "test whose only purpose is
preserving that fallback", "test whose only purpose is preserving that
unsupported behavior", "test th [...]
forbidden_summary_terms = ["defense=keep", "fallback_test=keep"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "defensive-code", statements = ["Apply this
gate to every defensive construct that the current task adds, extends, or
strengthens; touching nearby code does not authorize changing a pre-existing
defensive construct that the task does not alter.", "Do not add, extend, or
strengthen defensive code unless qualifying evidence proves that the defended
condition occurs on a supported production path or an explicit existing
contract requires the defense.", "A muta [...]
+policy_assertions = [{source = "defensive-code", statements = ["Apply this
gate to every defensive construct that the current task adds, extends, or
strengthens; touching nearby code does not authorize changing a pre-existing
defensive construct that the task does not alter.", "Do not add, extend, or
strengthen defensive code unless qualifying evidence proves that the defended
condition occurs on a supported production path or an explicit existing
contract requires the defense.", "A muta [...]
critical = true
[[cases]]
@@ -2855,7 +2856,7 @@ forbidden_actions = ["edit_code", "edit_non_code",
"run_bounded_adversarial_revi
required_reasons = ["pre_handoff_review_required"]
required_summary_terms = ["Formal Review", "Mergeable"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for explicit code or PR reviews, PR-backed
candidates, policy or harness changes, and tasks with security, concurrency,
lifecycle or SPI impact or high or unproved risk.", "For Formal Review, use
Code Correctness Review for a standalone local candidate unless the user
requests another focus.", "For a required Formal Review, the latest complete
review must return `Review Result: Me [...]
+policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for every code-writing task, including
ordinary low-risk local changes, without requiring a separate user request.",
"For Formal Review, use Code Correctness Review for a standalone local
candidate unless the user requests another focus.", "For a required Formal
Review, the latest complete review must return `Review Result: Mergeable`."]}]
critical = true
[[cases]]
@@ -2875,7 +2876,7 @@ required_reasons = ["safe_in_scope_review_finding",
"pre_handoff_review_required
required_summary_terms = ["Spotless", "Checkstyle"]
required_summary_term_groups = [["Formal Review", "review"], ["Mergeable",
"passing"]]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "code-verification", statements = ["Capture
high-volume output according to `.codex/context/token-efficiency.md`; report
commands, exit codes, and decisive log excerpts instead of dumping raw logs.",
"Any later edit invalidates only the Spotless, Checkstyle, or RAT evidence
whose governed files or configuration changed; rerun those checks before the
applicable review."]}, {source = "change-completion", statements = ["When
either review route identifies a sa [...]
+policy_assertions = [{source = "code-verification", statements = ["Capture
high-volume output according to `.codex/context/token-efficiency.md`; report
commands, exit codes, and decisive log excerpts instead of dumping raw logs.",
"Any later edit invalidates only the Spotless, Checkstyle, or RAT evidence
whose governed files or configuration changed; rerun those checks before the
applicable review."]}, {source = "change-completion", statements = ["When
Formal Review identifies a safe in- [...]
critical = true
[[cases]]
@@ -2921,20 +2922,20 @@ critical = true
[[cases]]
id = "final_review_and_git_artifacts_are_separate"
group = "operations"
-description = "Reports the actual passing Formal Review and task files without
unrequested Git artifacts or a duplicated report."
+description = "Reports the actual passing Formal Review and task files with an
automatic commit message outside the complete Markdown report."
phase = "completion output gate"
ordinary_loop = true
profile = "code-write"
semantic_policy_assertions = true
prompt = "The latest `$review-pr` Formal Review of a standalone local code
task returned `Review Result: Mergeable` with zero blocking issues and no
recommended changes. The only task-owned tracked files are
`module-a/src/main/java/example/Foo.java` and
`module-a/src/test/java/example/FooTest.java`, neither contains unrelated
hunks, and no Git write is authorized. The user did not request commit
artifacts. Deliver the final handoff."
decision = "proceed"
-required_actions = []
-allowed_actions = ["inspect_local"]
+required_actions = ["propose_commit_message"]
+allowed_actions = ["inspect_local", "propose_commit_message"]
forbidden_actions = ["edit_code", "edit_non_code", "mutate_git",
"mutate_remote"]
required_reasons = ["review_passed", "git_read_only"]
-required_summary_terms = ["Review Result: Mergeable", "Foo.java",
"FooTest.java"]
+required_summary_terms = ["Review Result: Mergeable", "Foo.java",
"FooTest.java", "Commit Message:", "```markdown", "### Result", "### Evidence",
"### Coverage"]
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["The final
response must lead with the outcome and include changed files and rationale,
verification status, remaining risks, and the next action only when one is
still required.", "Hand off only when the selected review and all required
current-state checks pass and no later code-affecting write or new evidence
invalidates them.", "For a required Formal Review, the latest complete review
must return `Review Result: Mergea [...]
+policy_assertions = [{source = "change-completion", statements = ["The final
response must lead with the outcome and include changed files and rationale,
verification status, remaining risks, and the next action only when one is
still required.", "Hand off only when the selected review and all required
current-state checks pass and no later code-affecting write or new evidence
invalidates them.", "For a required Formal Review, the latest complete review
must return `Review Result: Mergea [...]
critical = true
[[cases]]
@@ -2951,12 +2952,13 @@ required_actions = []
allowed_actions = []
forbidden_actions = ["edit_code", "edit_non_code", "propose_commit_message",
"mutate_git", "mutate_remote"]
required_reasons = []
-required_summary_terms = ["### Result", "Review Result: Mergeable", "###
Evidence", "### Coverage"]
+required_summary_terms = ["### Result", "Review Result: Mergeable", "###
Evidence", "### Coverage", "```markdown", "\n```"]
required_summary_term_groups = [["standalone", "no public PR"], ["baseline",
"established task-local delta", "attributed local candidate"]]
forbidden_summary_terms = ["git commit"]
policy_binding_profile = "review-pr"
-policy_assertions = [{source = "review-pr", statements = ["For a standalone
local candidate, use the active task's original working-tree baseline plus only
its attributed local commits, index changes, and working-tree changes as the
effective candidate.", "Use the frozen task boundary and task-delta audit as
authoritative scope, exclude unrelated local changes, and do not require a
public head, GitHub metadata, or public lineage.", "Return the selected mode's
complete result without requ [...]
+policy_assertions = [{source = "review-pr", statements = ["For a standalone
local candidate, use the active task's original working-tree baseline plus only
its attributed local commits, index changes, and working-tree changes as the
effective candidate.", "Use the frozen task boundary and task-delta audit as
authoritative scope, exclude unrelated local changes, and do not require a
public head, GitHub metadata, or public lineage.", "Return every review output
as one complete copy-ready M [...]
critical = true
+required_summary_prefix = "```markdown\n"
[[cases]]
id = "java_preconditions_use_specialized_methods"
@@ -3287,7 +3289,7 @@ policy_assertions = [{source = "review-pr", statements =
["Invalidate Checkstyle
[[cases]]
id = "proven_low_risk_local_completion_uses_self_review"
group = "coding / regular"
-description = "Uses one bounded self-review for a proved ordinary local
low-risk implementation."
+description = "Requires complete Formal Review even for a proved ordinary
local low-risk implementation."
phase = "ordinary completion loop"
ordinary_loop = true
profile = "code-write"
@@ -3298,12 +3300,12 @@ required_actions = ["run_pre_handoff_review"]
allowed_actions = ["inspect_local", "run_pre_handoff_review"]
forbidden_actions = ["edit_code", "edit_non_code", "mutate_git",
"mutate_remote", "propose_commit_message", "run_local_checks"]
required_reasons = ["pre_handoff_review_required"]
-required_summary_terms = ["review=self"]
-required_summary_prefix = "review=self"
-max_summary_chars = 11
+required_summary_terms = ["review=formal"]
+required_summary_prefix = "review=formal"
+max_summary_chars = 13
critical = true
policy_binding_profile = "code-write"
-policy_assertions = [{source = "change-completion", statements = ["Select the
review route from the existing code-implementation risk preflight and current
owner, contract, and verification evidence.", "Use one bounded self-review only
for an ordinary local implementation whose preflight and current evidence
establish low risk, with no public or shared contract change, cross-owner
impact, architecture change, security, concurrency, lifecycle or SPI impact, or
credible functional or perfo [...]
+policy_assertions = [{source = "change-completion", statements = ["Invoke
`$review-pr` in Formal Review Mode for every code-writing task, including
ordinary low-risk local changes, without requiring a separate user request.",
"Existing authority, architecture, safety, and triggered high-risk gates remain
required.", "Every Formal Review in this loop, including the first review and
each rerun after a fix, must execute the complete `$review-pr` workflow over
the entire current task-owned c [...]
[[cases]]
id = "standalone_multiround_review_uses_task_evidence"
@@ -3319,11 +3321,12 @@ required_actions = []
allowed_actions = []
forbidden_actions = ["edit_code", "edit_non_code", "mutate_git",
"mutate_remote", "propose_commit_message", "inspect_local", "run_local_checks",
"run_pre_handoff_review"]
required_reasons = []
-required_summary_terms = ["Previous Finding", "Current Status: Withdrawn",
"Reason", "### Result", "Review Result: Mergeable", "### Evidence", "###
Coverage"]
+required_summary_terms = ["Previous Finding", "Current Status: Withdrawn",
"Reason", "### Result", "Review Result: Mergeable", "### Evidence", "###
Coverage", "```markdown", "\n```"]
forbidden_summary_terms = ["Review Result: Not Mergeable", "Review Result:
Review Incomplete", "Current Status: Retained", "Current Status: Changed to
Review Incomplete"]
critical = true
policy_binding_profile = "review-pr"
-policy_assertions = [{source = "review-pr", statements = ["For a standalone
local candidate, use the active task's original working-tree baseline plus only
its attributed local commits, index changes, and working-tree changes as the
effective candidate. Use the frozen task boundary and task-delta audit as
authoritative scope, exclude unrelated local changes, and do not require a
public head, GitHub metadata, or public lineage.", "Return the selected mode's
complete result without requiri [...]
+policy_assertions = [{source = "review-pr", statements = ["For a standalone
local candidate, use the active task's original working-tree baseline plus only
its attributed local commits, index changes, and working-tree changes as the
effective candidate. Use the frozen task boundary and task-delta audit as
authoritative scope, exclude unrelated local changes, and do not require a
public head, GitHub metadata, or public lineage.", "Return every review output
as one complete copy-ready Mark [...]
+required_summary_prefix = "```markdown\n"
[[cases]]
id = "gen_ut_reuses_valid_current_task_evidence"
diff --git a/.codex/harness/agents/code_handoff_hook.py
b/.codex/harness/agents/code_handoff_hook.py
index 2b93d83d575..52da447860a 100644
--- a/.codex/harness/agents/code_handoff_hook.py
+++ b/.codex/harness/agents/code_handoff_hook.py
@@ -34,6 +34,7 @@ PATCH_FILE_PATTERN = re.compile(r"^\*\*\*
(?:Add|Delete|Update) File: (.+)$", re
FIELD_PATTERN = r"(?P<emphasis>\*\*)?{label}:(?(emphasis)(?:\*\*)?)[
\t]*(?P<value>.*?)"
FIELD_PREFIX_PATTERN = re.compile(r"^[ \t]*(?:[-*][ \t]+)?(?:#{1,6}[ \t]+)?")
FENCE_PATTERN = re.compile(r"(?:`{3,}[^`]*|~{3,}.*)")
+FENCE_OPEN_PATTERN = re.compile(r"^ {0,3}(?P<fence>`{3,}|~{3,})(?P<info>.*)$")
SHELL_TOOL_NAMES = frozenset({"Bash", "exec_command", "write_stdin"})
PASSING_RESULT = "Mergeable"
PAUSED_RESULTS = frozenset({"Not Mergeable", "Review Incomplete"})
@@ -220,7 +221,7 @@ def _path_digest(path: Path) -> str:
def validate_handoff(message: Any) -> list[str]:
"""Return every missing or invalid successful code handoff element."""
- failures = _validate_handoff_evidence(message, frozenset({PASSING_RESULT}))
+ failures = _validate_handoff_evidence(message,
frozenset({PASSING_RESULT}), require_review=True)
if not isinstance(message, str):
return failures
statuses = _field_values(message, "Task Status")
@@ -228,6 +229,8 @@ def validate_handoff(message: Any) -> list[str]:
legacy_passing_review = not statuses and results == [PASSING_RESULT]
if ["Completed"] != statuses and not legacy_passing_review:
failures.append("exactly one Task Status: Completed or legacy Review
Result: Mergeable")
+ if not _field_value(message, "Commit Message"):
+ failures.append("nonempty Commit Message")
return failures
@@ -246,18 +249,52 @@ def validate_paused_handoff(message: Any) -> list[str]:
return failures
-def _validate_handoff_evidence(message: Any, allowed_results: frozenset[str])
-> list[str]:
+def _validate_handoff_evidence(message: Any, allowed_results: frozenset[str],
require_review: bool = False) -> list[str]:
if not isinstance(message, str) or not message.strip():
return ["nonempty handoff"]
failures = []
results = _field_values(message, "Review Result")
if results and (len(results) != 1 or results[0] not in allowed_results):
failures.append("exactly one allowed Review Result when declared")
- if not _field_value(message, "Evidence") and not _section_content(message,
"### Evidence"):
+ if require_review and not results:
+ failures.append("exactly one Review Result: Mergeable")
+ reports = _markdown_review_reports(message)
+ if results and len(reports) != 1:
+ failures.append("one complete review report in a markdown-labelled
fenced block")
+ if require_review and len(reports) == 1:
+ for section in ("Result", "Evidence", "Coverage"):
+ if not _section_content(reports[0], f"### {section}"):
+ failures.append(f"review {section}")
+ if _field_values(reports[0], "Commit Message"):
+ failures.append("Commit Message must be separate from the review
report")
+ if not require_review and not _field_value(message, "Evidence") and not
_section_content(message, "### Evidence"):
failures.append("Evidence")
return failures
+def _markdown_review_reports(message: str) -> list[str]:
+ result = []
+ fence = ""
+ language = ""
+ content = []
+ for line in message.splitlines():
+ if fence:
+ if re.fullmatch(rf" {{0,3}}{re.escape(fence[0])}{{{len(fence)},}}[
\t]*", line):
+ report = "\n".join(content)
+ if language == "markdown" and _field_values(report, "Review
Result"):
+ result.append(report)
+ fence = ""
+ else:
+ content.append(line)
+ continue
+ opening = FENCE_OPEN_PATTERN.fullmatch(line)
+ if opening and not (opening.group("fence").startswith("`") and "`" in
opening.group("info")):
+ fence = opening.group("fence")
+ language = opening.group("info").strip()
+ content = []
+ return result
+
+
def _field_values(message: str, label: str) -> list[str]:
result: list[str] = []
pattern = re.compile(FIELD_PATTERN.format(label=re.escape(label)),
re.IGNORECASE)
@@ -297,9 +334,9 @@ def _continuation_reason(passing_failures: list[str],
paused_failures: list[str]
passing = ", ".join(passing_failures)
paused = ", ".join(paused_failures)
return (
- "The code-writing task has an unresolved handoff. Report Task Status:
Completed with Evidence after required checks and review. "
+ "The code-writing task has an unresolved handoff. Report Task Status:
Completed with a nonempty Commit Message after required checks and full review.
"
f"Passing handoff failures: {passing}. "
- "A declared Formal Review must be Mergeable before completion. "
+ "Completion requires one actual Review Result: Mergeable report in a
markdown-labelled fenced block with Result, Evidence and Coverage. "
"If an exact user decision, authority, or unavailable evidence blocks
continuation, report "
f"Task Status: Awaiting User with Evidence and Required User Action;
pause failures: {paused}."
)
diff --git a/.codex/harness/agents/test_code_handoff_hook.py
b/.codex/harness/agents/test_code_handoff_hook.py
index e21d4b6026c..353fe34bf45 100644
--- a/.codex/harness/agents/test_code_handoff_hook.py
+++ b/.codex/harness/agents/test_code_handoff_hook.py
@@ -45,7 +45,7 @@ class CodeHandoffHookTest(unittest.TestCase):
self.assertEqual("block", actual["decision"])
self.assertIn("Task Status: Completed", actual["reason"])
self.assertEqual({},
code_handoff_hook.process_event(self._stop_event(
- "Task Status: Completed\nEvidence: Focused tests passed;
bounded self-review found no issue.",
+ "Task Status: Completed\n" + self._mergeable_handoff(),
), state_directory))
self.assertEqual([], list(state_directory.iterdir()))
@@ -64,33 +64,94 @@ class CodeHandoffHookTest(unittest.TestCase):
actual =
code_handoff_hook.process_event(self._stop_event("Documentation updated."),
state_directory)
self.assertEqual("block", actual["decision"])
- def test_bounded_formal_review_summary_is_accepted(self) -> None:
+ def test_completed_handoff_requires_full_report_and_commit_message(self)
-> None:
actual = code_handoff_hook.validate_handoff(
"Task Status: Completed\nReview Result: Mergeable\n"
"Evidence: Focused tests passed; Formal Review covered the
original baseline and task delta."
)
- self.assertEqual([], actual)
+ self.assertEqual([
+ "one complete review report in a markdown-labelled fenced block",
"nonempty Commit Message",
+ ], actual)
def test_passing_formal_review_requires_evidence(self) -> None:
actual = code_handoff_hook.validate_handoff(self._mergeable_handoff(
evidence="", commit_message="",
))
- self.assertEqual(["Evidence"], actual)
+ self.assertEqual(["review Evidence", "nonempty Commit Message"],
actual)
- def test_legacy_formal_review_accepts_unfenced_unbold_report(self) -> None:
- actual = code_handoff_hook.validate_handoff(
- self._mergeable_handoff().replace("**Review Result: Mergeable**",
"Review Result: Mergeable")
- .replace("```markdown\n", "").replace("```text\n",
"").replace("```bash\n", "").replace("```", ""),
+ def test_formal_review_requires_markdown_fence(self) -> None:
+ handoff = self._mergeable_handoff()
+ invalid_messages = (
+ handoff.replace("```markdown", "```"),
handoff.replace("```markdown", "```text"),
+ handoff.replace("```markdown\n", "").replace("```text\n",
"").replace("```bash\n", "").replace("```", ""),
+ handoff[:handoff.index("```\n\n```text")],
+ handoff.replace("```markdown", "````markdown", 1),
+ "```text\n" + handoff + "\n```",
)
- self.assertEqual([], actual)
+ for message in invalid_messages:
+ with self.subTest(message=message):
+ self.assertIn("one complete review report in a
markdown-labelled fenced block", code_handoff_hook.validate_handoff(message))
- def test_legacy_formal_review_accepts_no_git_artifacts(self) -> None:
+ def test_formal_review_accepts_no_git_commands(self) -> None:
handoff = self._mergeable_handoff()
- actual =
code_handoff_hook.validate_handoff(handoff[:handoff.index("```text")])
+ actual =
code_handoff_hook.validate_handoff(handoff[:handoff.index("```bash")])
self.assertEqual([], actual)
+ def
test_formal_review_accepts_standard_fence_lengths_and_indentation(self) -> None:
+ handoff = self._mergeable_handoff()
+ report, artifacts = handoff.split("```\n\n```text", 1)
+ for opening, closing in (("````markdown", "````"), ("```markdown",
"````"), ("~~~markdown", "~~~"), (" ```markdown", " ```")):
+ with self.subTest(opening=opening, closing=closing):
+ message = report.replace("```markdown", opening, 1) + closing
+ "\n\n```text" + artifacts
+ self.assertEqual([],
code_handoff_hook.validate_handoff(message))
+
+ def test_review_sections_cannot_be_supplied_outside_report(self) -> None:
+ handoff = self._mergeable_handoff()
+ for section, content in (
+ ("Result", "**Review Result: Mergeable**\n\nThe complete
standalone Code Correctness Review found no blocking issue."),
+ ("Evidence", "- Focused tests and task-delta inspection passed."),
+ ("Coverage", "Standalone local candidate; original baseline and
every attributed task file were reviewed."),
+ ):
+ with self.subTest(section=section):
+ message = handoff.replace(f"### {section}\n\n{content}", "") +
f"\n### {section}\n\n{content}"
+ self.assertTrue(code_handoff_hook.validate_handoff(message))
+
+ def test_completed_handoff_requires_separate_nonempty_commit_message(self)
-> None:
+ handoff = self._mergeable_handoff()
+ invalid_messages = (
+ self._mergeable_handoff(commit_message=""),
self._mergeable_handoff(commit_message="```"),
+ self._mergeable_handoff(commit_message="~~~markdown"),
handoff[:handoff.index("```text")],
+ handoff[:handoff.index("```text")].replace("### Coverage", "Commit
Message: Complete implementation\n\n### Coverage"),
+ )
+ for message in invalid_messages:
+ with self.subTest(message=message):
+ self.assertTrue(code_handoff_hook.validate_handoff(message))
+
+ def test_missing_review_keeps_pending_until_handoff_is_complete(self) ->
None:
+ with tempfile.TemporaryDirectory() as directory:
+ state_directory = Path(directory)
+ code_handoff_hook.process_event(self._post_tool_event("*** Update
File: Foo.java"), state_directory)
+ message = "Task Status: Completed\n" +
self._mergeable_handoff().replace("**Review Result: Mergeable**", "")
+ actual =
code_handoff_hook.process_event(self._stop_event(message), state_directory)
+ self.assertEqual("block", actual["decision"])
+ self.assertIn("exactly one Review Result: Mergeable",
actual["reason"])
+ self.assertEqual(1, len(list(state_directory.glob("*.pending"))))
+ self.assertEqual({},
code_handoff_hook.process_event(self._stop_event(self._mergeable_handoff()),
state_directory))
+ self.assertEqual([], list(state_directory.iterdir()))
+
+ def
test_missing_commit_message_keeps_pending_until_handoff_is_complete(self) ->
None:
+ with tempfile.TemporaryDirectory() as directory:
+ state_directory = Path(directory)
+ code_handoff_hook.process_event(self._post_tool_event("*** Update
File: Foo.java"), state_directory)
+ actual =
code_handoff_hook.process_event(self._stop_event(self._mergeable_handoff(commit_message="")),
state_directory)
+ self.assertEqual("block", actual["decision"])
+ self.assertIn("nonempty Commit Message", actual["reason"])
+ self.assertEqual(1, len(list(state_directory.glob("*.pending"))))
+ self.assertEqual({},
code_handoff_hook.process_event(self._stop_event(self._mergeable_handoff()),
state_directory))
+ self.assertEqual([], list(state_directory.iterdir()))
+
def test_legacy_formal_review_accepts_triple_emphasis(self) -> None:
- for result_line in ("***Review Result: Mergeable***", "- ***Review
Result: Mergeable***", "* ***Review Result: Mergeable***"):
+ for result_line in ("Review Result: Mergeable", "***Review Result:
Mergeable***", "- ***Review Result: Mergeable***", "* ***Review Result:
Mergeable***"):
with self.subTest(result_line=result_line):
actual = code_handoff_hook.validate_handoff(
self._mergeable_handoff().replace("**Review Result:
Mergeable**", result_line),
@@ -114,7 +175,7 @@ class CodeHandoffHookTest(unittest.TestCase):
with self.subTest(field=field), tempfile.TemporaryDirectory() as
directory:
state_directory = Path(directory)
code_handoff_hook.process_event(self._post_tool_event("***
Update File: Foo.java"), state_directory)
- message = f"Task Status: Completed\nEvidence: Focused tests
passed.\n{field}"
+ message = f"Task Status:
Completed\n{self._mergeable_handoff()}\n{field}"
actual =
code_handoff_hook.process_event(self._stop_event(message), state_directory)
self.assertEqual("block", actual["decision"])
self.assertEqual(1,
len(list(state_directory.glob("*.pending"))))
@@ -179,7 +240,7 @@ class CodeHandoffHookTest(unittest.TestCase):
"Required User Action: Authorize publishing the reviewed
candidate."
)
if result is not None:
- message += f"\nReview Result: {result}"
+ message += f"\n```markdown\n### Result\nReview Result:
{result}\n```"
self.assertEqual({},
code_handoff_hook.process_event(self._stop_event(message), state_directory))
self.assertEqual(1,
len(list(state_directory.glob("*.pending"))))
@@ -194,7 +255,7 @@ class CodeHandoffHookTest(unittest.TestCase):
state_directory = Path(directory)
code_handoff_hook.process_event(self._post_tool_event("***
Update File: Foo.java"), state_directory)
message = (
- f"{status_line}\nReview Result: Mergeable\n"
+ f"{status_line}\n```markdown\n### Result\nReview Result:
Mergeable\n```\n"
"***Evidence: Verification and Formal Review passed;
publishing needs authority.***\n"
"***Required User Action: Authorize publishing the
reviewed candidate.***"
)
@@ -225,13 +286,23 @@ class CodeHandoffHookTest(unittest.TestCase):
state_directory = Path(directory)
code_handoff_hook.process_event(self._post_tool_event("***
Update File: Foo.java"), state_directory)
message = (
- f"{status_line}\nReview Result: Mergeable\n"
+ f"{status_line}\n```markdown\n### Result\nReview Result:
Mergeable\n```\n"
"Evidence: Verification and Formal Review passed;
publishing needs authority.\n"
"Required User Action: Authorize publishing the reviewed
candidate."
)
self.assertEqual({},
code_handoff_hook.process_event(self._stop_event(message), state_directory))
self.assertEqual(1,
len(list(state_directory.glob("*.pending"))))
+ def test_user_wait_requires_markdown_for_declared_review(self) -> None:
+ for result in ("Mergeable", "Not Mergeable", "Review Incomplete"):
+ with self.subTest(result=result):
+ actual = code_handoff_hook.validate_paused_handoff(
+ "Task Status: Awaiting User\nEvidence: Publishing needs
the user's authority.\n"
+ "Required User Action: Authorize publishing the reviewed
candidate.\n"
+ f"Review Result: {result}",
+ )
+ self.assertEqual(["one complete review report in a
markdown-labelled fenced block"], actual)
+
def
test_handoff_without_completed_status_or_legacy_passing_result_is_rejected(self)
-> None:
invalid_messages = (
None, "", "Evidence: Focused tests passed.", "Task Status:
Completed",
diff --git a/.codex/skills/review-pr/SKILL.md b/.codex/skills/review-pr/SKILL.md
index 6a5324f6f08..42ac09cfb87 100644
--- a/.codex/skills/review-pr/SKILL.md
+++ b/.codex/skills/review-pr/SKILL.md
@@ -280,8 +280,8 @@ Read
[review-corrections.md](references/review-corrections.md) for previous feed
## Output Contract
-Return the selected mode's complete result without requiring an outer Markdown
fence or bold labels.
-Use a copy-ready fenced block when the user requests one.
+Return every review output as one complete copy-ready Markdown report in a
fenced block labelled `markdown`, in both output modes and every review round.
+Keep the selected mode's complete result inside that block, including
corrections, findings, evidence, and coverage, without requiring a separate
user request.
The outer completion workflow adds its required task status and evidence
without repeating the complete review report.
Use the user's language for formal results. Draft GitHub-facing discussion