feat(governance): 新增風險比例審查 shadow mode - #483
Conversation
Apply the hermes-review-shadow patch from origin/main 89ff9c8: deterministic risk classifier, bounded review packet, read-only reviewer result contract, bounded loop, 20-case golden corpus, 32 tests, and idea-genesis / Hermes adapter docs. authority=advisory_shadow, merge_authority=false. No GitHub workflow, CODEOWNERS, branch protection, PR gate, verification manifest, or skill manifest changes. Verified: node --check x2 OK; node --test 32/32 pass; golden replay 20/20 pass; git diff --check clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TR36xLMWPrGAVFyUDGGFLW
|
Warning Review limit reached
Next review available in: 55 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a deterministic, advisory-only Hermes risk-proportional review system. It defines policy contracts, classifies risk, builds bounded packets, validates reviewer results, advances evidence loops, provides a read-only CLI, and adds documentation, fixtures, replay evidence, and tests. ChangesRisk-proportional review shadow
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant ReviewEngine
participant Evidence
participant Reviewer
CLI->>ReviewEngine: Submit repository input and policy
ReviewEngine->>Evidence: Evaluate exact-head evidence
Evidence-->>ReviewEngine: Return evidence status
ReviewEngine-->>CLI: Return advisory decision
CLI->>ReviewEngine: Build bounded review packet
ReviewEngine-->>Reviewer: Provide packet
Reviewer->>ReviewEngine: Submit validated result
ReviewEngine-->>CLI: Advance, hold, or finish loop
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a PR-A shadow-mode implementation of a "Hermes risk-proportional review" control plane. It introduces a deterministic, self-validating risk classifier that maps bounded change facts (topology, consequence, evidence strength, trust surface, detectability, horizon) into one of four review modes, then compiles a byte-bounded, exact-head-bound review packet and drives a bounded review loop. Everything is advisory_shadow with merge_authority = false; it deliberately does not touch workflows, CODEOWNERS, branch protection, or the verification manifest, so it fits the repo's self-referential bootstrap governance as a report-only baseline.
Changes:
- New policy contract + Draft-07 schemas, a deterministic classifier, packet/result validators, and a bounded loop in
scripts/lib/risk-proportional-review.mjs. - A read-only advisory CLI (
scripts/dev/review-risk-shadow.mjs) with strict realpath containment and exclusive-create output underartifacts/. - A 20-case golden corpus, a standalone sample, 48 focused Node tests, plus evidence/design documentation.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/lib/risk-proportional-review.mjs | Core classifier, packet builder, result/loop validators, stable hashing — contains the CODEOWNERS pattern bug. |
| scripts/dev/review-risk-shadow.mjs | Advisory CLI with realpath containment and non-overwriting output. |
| scripts/tests/test-review-risk.mjs | 48 focused tests over classifier, packet, result, loop, and CLI. |
| scripts/tests/review-risk.schema.json | Draft-07 schema for input/decision/packet/result/loop/corpus. |
| scripts/tests/fixtures/review-risk-golden.json | 20-case golden corpus of risk shapes. |
| scripts/tests/fixtures/review-risk-sample.json | Standalone sample input for the CLI. |
| agent-contracts/risk-proportional-review.contract.json | The shipped advisory policy. |
| agent-contracts/risk-proportional-review.contract.schema.json | Draft-07 schema for the policy. |
| docs/agent-tooling/hermes-risk-proportional-review.md | Runbook/contract documentation for the capability. |
| docs/evidence/.../verification-summary.md | Verification evidence — reports a stale test count (32 vs 48). |
| docs/evidence/.../replay-summary.json | Golden replay evidence (20/20). |
| docs/evidence/.../idea-genesis-reconstruction.md | Design rationale and decision genealogy. |
Key issues found: a functional bug where the .github/CODEOWNERS self-referential pattern can never match because paths are lowercased before regex testing (so CODEOWNERS changes miss the intended human_critical floor), and a stale test count (32 vs 48) in the verification evidence document.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (8)
scripts/lib/risk-proportional-review.mjs (2)
1061-1093: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winValidate
expected.verdict,expected.topology, andexpected.consequenceas enums.Line 1077 validates
expected.review_modeagainstMODE_SETand Line 1078 validatesexpected.specialists_includeagainstSPECIALISTS. The sibling fieldsverdict,topology, andconsequencereceive no enum check. A typographical error in a golden fixture, for exampletopology: "contractal", is reported as a case mismatch rather than as a corpus contract error. The replay then fails with a misleading reason.Add the enum assertions so a malformed corpus fails validation.
♻️ Proposed refactor
assertEnum(testCase.expected.review_mode, MODE_SET, `${label}.expected.review_mode`); + assertEnum(testCase.expected.verdict, new Set(['advisory_pass', 'advisory_review', 'human_required', 'held', 'blocked']), `${label}.expected.verdict`); + assertEnum(testCase.expected.topology, TOPOLOGIES, `${label}.expected.topology`); + assertEnum(testCase.expected.consequence, new Set(['low', 'medium', 'high', 'critical']), `${label}.expected.consequence`); assertUniqueEnumArray(testCase.expected.specialists_include, SPECIALISTS, `${label}.expected.specialists_include`, { max: 2 });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/lib/risk-proportional-review.mjs` around lines 1061 - 1093, In replayCorpus, add enum validation for testCase.expected.verdict, topology, and consequence alongside the existing review_mode assertion, using the corresponding established enum sets and field labels. Keep the specialists_include validation and mismatch comparison unchanged so malformed corpus values fail during validation.
726-728: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winPrecompute the path priority before sorting.
The comparator on Line 727 calls
pathPriorityfor both operands on every comparison.pathPrioritycallspathFacts(Line 683), which allocates aSetand runs 15 regular expressions plus two extra tests per call.validateInputallows up to 1000 changed paths (Line 271), so a single packet build performs roughly 20,000pathFactscalls and several hundred thousand regex evaluations.Compute the priority once per entry.
♻️ Proposed refactor
- const selectedPaths = [...input.changed_paths] - .sort((a, b) => pathPriority(a) - pathPriority(b) || a.path.localeCompare(b.path)) - .slice(0, budgetPolicy.max_changed_paths); + const selectedPaths = input.changed_paths + .map((entry) => ({ entry, priority: pathPriority(entry) })) + .sort((a, b) => a.priority - b.priority || a.entry.path.localeCompare(b.entry.path)) + .slice(0, budgetPolicy.max_changed_paths) + .map(({ entry }) => entry);Also applies to: 682-690
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/lib/risk-proportional-review.mjs` around lines 726 - 728, Update the selectedPaths ordering flow and pathPriority/pathFacts helpers to compute each changed path’s priority once before sorting, retain the path value for the existing lexical tie-breaker, then sort the precomputed entries and unwrap paths before applying max_changed_paths. Preserve the current priority and tie-breaking behavior.agent-contracts/risk-proportional-review.contract.schema.json (1)
48-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider binding mode identity and order in the schema.
The schema accepts four
review_modesentries with duplicateidvalues, arbitraryrankvalues, and any order.validatePolicyinscripts/lib/risk-proportional-review.mjs(Lines 204-213) is stricter: it requires canonical order,rank === index,max_model_reviewers === 0formechanical_only, andhuman_required === trueforhuman_critical. A policy file can pass the schema and still fail the validator.Add a tuple constraint so the schema matches the validator.
♻️ Optional tightening with a Draft-07 tuple form
"review_modes": { "type": "array", "minItems": 4, "maxItems": 4, - "items": { + "uniqueItems": true, + "items": [ + {"$ref": "`#/definitions/reviewMode`", "properties": {"id": {"const": "mechanical_only"}, "rank": {"const": 0}, "max_model_reviewers": {"const": 0}}}, + {"$ref": "`#/definitions/reviewMode`", "properties": {"id": {"const": "focused_semantic"}, "rank": {"const": 1}}}, + {"$ref": "`#/definitions/reviewMode`", "properties": {"id": {"const": "risk_scoped_specialists"}, "rank": {"const": 2}}}, + {"$ref": "`#/definitions/reviewMode`", "properties": {"id": {"const": "human_critical"}, "rank": {"const": 3}, "human_required": {"const": true}}} + ] + }, + "_reviewModeShape": {Note: a
definitions/reviewModeblock holding the sharedtype/required/additionalPropertiesis needed if you take this route.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@agent-contracts/risk-proportional-review.contract.schema.json` around lines 48 - 63, Update the review_modes schema to enforce the canonical four-entry order and identity expected by validatePolicy: mechanical_only, focused_semantic, risk_scoped_specialists, and human_critical. Use a tuple constraint with per-index properties enforcing each mode’s fixed id, rank, max_model_reviewers, and human_required values, while preserving the shared object requirements and disallowing additional properties.docs/evidence/hermes-risk-proportional-review-shadow/idea-genesis-reconstruction.md (1)
89-90: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAlign the claim labels with the taxonomy defined in this file.
Lines 27-29 define
direct_factas a claim directly present in a tracked contract, implementation, test, PR record, or supplied research material. Lines 89-90 and 114-115 label an "initially plausible solution" asdirect_fact, but a rejected design alternative is not such a record. Usesupported_inferenceor an explicit "considered alternative" marker for these two entries. This keeps the file consistent with its own evidence discipline.Also applies to: 114-115
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/evidence/hermes-risk-proportional-review-shadow/idea-genesis-reconstruction.md` around lines 89 - 90, Update the claim labels for the “Initially plausible solution” entries near `direct_fact` at both affected locations, since rejected design alternatives are not direct facts from tracked evidence. Relabel them as `supported_inference` or use an explicit “considered alternative” marker, while preserving the solution descriptions and the taxonomy defined earlier in the file.scripts/tests/test-review-risk.mjs (1)
47-53: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAdd a timeout to the CLI subprocess calls.
spawnSynchas notimeout. Ifreview-risk-shadow.mjsblocks, the test run hangs instead of failing. A bounded timeout keeps the suite deterministic.♻️ Proposed change
return spawnSync(process.execPath, [cliPath, ...args], { cwd: repoRoot, encoding: 'utf8', windowsHide: true, + timeout: 30_000, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/tests/test-review-risk.mjs` around lines 47 - 53, Update runShadowCli to pass a bounded timeout option to spawnSync, ensuring blocked review-risk-shadow.mjs subprocesses terminate and cause the tests to fail rather than hang. Preserve the existing command arguments and process options.scripts/tests/review-risk.schema.json (1)
516-518: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThe Draft-07 schema is a looser mirror of the runtime validators, and nothing keeps the two in sync.
scripts/lib/risk-proportional-review.mjsenforces the authoritative constraints invalidateInput,validateReviewPacket, andnormalizeRepositoryPath. This schema restates a subset of them by hand, so documents that the runtime rejects can still pass schema validation.
scripts/tests/review-risk.schema.json#L516-L518: apply the same^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$pattern andmaxLength: 200todecision.repositorythatinput.repositoryandpacket.repositoryalready use.scripts/tests/review-risk.schema.json#L42-L47: tighten thepathpattern to also reject single-dot segments, leading or trailing whitespace, and control characters, matchingnormalizeRepositoryPath.Consider adding a test that feeds the negative cases from
scripts/tests/test-review-risk.mjsthrough this schema, so schema and runtime divergence fails the suite.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/tests/review-risk.schema.json` around lines 516 - 518, Update scripts/tests/review-risk.schema.json at lines 516-518 for decision.repository to enforce the same repository pattern and maxLength 200 used by input.repository and packet.repository. Also update scripts/tests/review-risk.schema.json at lines 42-47 so path rejects single-dot segments, leading or trailing whitespace, and control characters, matching normalizeRepositoryPath; add schema coverage for the negative cases from scripts/tests/test-review-risk.mjs if the existing suite supports it.docs/evidence/hermes-risk-proportional-review-shadow/replay-summary.json (1)
2-11: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThis summary is hand-maintained and can drift from
replayCorpusoutput.
replayCorpusemitsschema_version: "review-risk-replay-report/v1"with aresultsarray. This file declaresreview-risk-replay-summary/v1with a flattenedcasesarray, and no definition for it exists inscripts/tests/review-risk.schema.json. Nothing in the test suite compares the two. If a classifier change alters a verdict, this evidence file stays stale and still reports"passed": 20.Consider generating this file from the CLI replay output, or adding a test that derives
casesfromreplayCorpus(corpus, policy).resultsand compares it against this file.I verified the 20 case entries against
scripts/tests/fixtures/review-risk-golden.json; allreview_mode,verdict,topology, andconsequencevalues match the corpusexpectedblocks today.As per coding guidelines: "不得把
docs/內任何文件或舊 evidence 當成 runtime/API 已完成證據;當 docs 與實作不一致時,以實作為準".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/evidence/hermes-risk-proportional-review-shadow/replay-summary.json` around lines 2 - 11, Prevent replay-summary.json from becoming stale by generating it from replayCorpus(corpus, policy) or adding a test that compares its cases and aggregate counts with the CLI replay output’s results. Align the summary schema with the emitted review-risk-replay-report/v1 structure, or explicitly derive the flattened representation from results, and ensure classifier verdict changes cause the test or generation step to update or fail.Source: Coding guidelines
scripts/tests/fixtures/review-risk-golden.json (1)
729-731: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winOnly
credentialsis exercised inregulated_data.The input contract accepts
pii,payment,health,audit,customer_model, andother_regulated. No golden case covers these values, so a future change to consequence derivation for those categories would replay clean. Consider adding one case that carriespiiorpaymentand asserts the expected consequence and specialists.Also applies to: 1104-1106
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/tests/fixtures/review-risk-golden.json` around lines 729 - 731, Add a golden fixture case alongside the existing regulated_data coverage that uses one currently untested accepted value, such as "pii" or "payment", and asserts its expected consequence and specialists. Update both corresponding fixture sections, including the occurrence near the existing "credentials" entry, so consequence derivation for these categories is replay-tested.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@docs/evidence/hermes-risk-proportional-review-shadow/verification-summary.md`:
- Around line 1-6: Add an explicit document-nature declaration to the header of
the verification summary, identifying it as a working note that records
historical verification evidence. Keep the existing verification date and
authority statements unchanged.
- Around line 20-29: Update
docs/evidence/hermes-risk-proportional-review-shadow/verification-summary.md
(lines 20-29) to report the current 48-case suite count, or explicitly mark both
test-count rows as historical evidence. Update
docs/evidence/hermes-risk-proportional-review-shadow/replay-summary.json (lines
2-11) so its cases array is generated from replayCorpus(corpus, policy).results,
or add an executable test comparing the file with that output; keep the evidence
aligned with implementation and test truth.
- Line 20: Update the evidence rows for scripts/tests/test-review-risk.mjs in
verification-summary.md to report the current suite’s 48 passing tests, or
explicitly label the existing 32-test results as historical evidence.
In `@scripts/dev/review-risk-shadow.mjs`:
- Around line 108-118: Update emit so artifact creation remains confined to
artifactsRoot at write time, not only during assertContained and
ensureSafeOutputParent validation. Replace the open(absolute, 'wx') path with an
output mechanism that prevents substituted parent directories from redirecting
the write outside the trusted root, while preserving exclusive creation and
existing stdout behavior.
In `@scripts/lib/risk-proportional-review.mjs`:
- Line 820: Update validateReviewPacket to enforce the packet’s declared policy
caps instead of hardcoded limits: compare selected_paths, evidence refs,
evidence gaps, and questions against the corresponding declared caps already
validated around the packet cap cross-checks. Retain the absolute policy bounds
so standalone validation still rejects values above the supported maxima, while
allowing buildReviewPacket outputs to honor larger valid policy settings.
- Around line 585-599: Update buildQuestions to collect and return every unique
candidate question without enforcing maxQuestions; retain the mechanical_only
behavior and fallback question. Let buildReviewPacket apply the max_questions
slice so its existing overflow detection and budget_exceeded handling can
observe omitted questions, and add omitted_question_count only if the packet
contract requires explicit truncation accounting.
- Around line 739-751: Update the evidence_refs overflow check near
selectedEvidence and selectedQuestions to evaluate the deduplicated selection
result, not input.evidence.length. Compare the count of unique selected refs
against budgetPolicy.max_evidence_refs, or track whether the prioritized
selection was truncated, so packets fitting the unique-ref budget are not marked
budget_exceeded.
In `@scripts/tests/review-risk.schema.json`:
- Around line 516-518: Update decision.repository in the schema to match the
validation constraints used by input.repository and packet.repository: enforce
the owner/name pattern and the same maxLength, while retaining its string type.
In `@scripts/tests/test-review-risk.mjs`:
- Line 851: Replace the junction cleanup’s unlinkSync call with rmSync(linkPath,
{ recursive: true, force: true }) so Windows junction removal cannot mask the
test result or prevent subsequent container and external cleanup.
---
Nitpick comments:
In `@agent-contracts/risk-proportional-review.contract.schema.json`:
- Around line 48-63: Update the review_modes schema to enforce the canonical
four-entry order and identity expected by validatePolicy: mechanical_only,
focused_semantic, risk_scoped_specialists, and human_critical. Use a tuple
constraint with per-index properties enforcing each mode’s fixed id, rank,
max_model_reviewers, and human_required values, while preserving the shared
object requirements and disallowing additional properties.
In
`@docs/evidence/hermes-risk-proportional-review-shadow/idea-genesis-reconstruction.md`:
- Around line 89-90: Update the claim labels for the “Initially plausible
solution” entries near `direct_fact` at both affected locations, since rejected
design alternatives are not direct facts from tracked evidence. Relabel them as
`supported_inference` or use an explicit “considered alternative” marker, while
preserving the solution descriptions and the taxonomy defined earlier in the
file.
In `@docs/evidence/hermes-risk-proportional-review-shadow/replay-summary.json`:
- Around line 2-11: Prevent replay-summary.json from becoming stale by
generating it from replayCorpus(corpus, policy) or adding a test that compares
its cases and aggregate counts with the CLI replay output’s results. Align the
summary schema with the emitted review-risk-replay-report/v1 structure, or
explicitly derive the flattened representation from results, and ensure
classifier verdict changes cause the test or generation step to update or fail.
In `@scripts/lib/risk-proportional-review.mjs`:
- Around line 1061-1093: In replayCorpus, add enum validation for
testCase.expected.verdict, topology, and consequence alongside the existing
review_mode assertion, using the corresponding established enum sets and field
labels. Keep the specialists_include validation and mismatch comparison
unchanged so malformed corpus values fail during validation.
- Around line 726-728: Update the selectedPaths ordering flow and
pathPriority/pathFacts helpers to compute each changed path’s priority once
before sorting, retain the path value for the existing lexical tie-breaker, then
sort the precomputed entries and unwrap paths before applying max_changed_paths.
Preserve the current priority and tie-breaking behavior.
In `@scripts/tests/fixtures/review-risk-golden.json`:
- Around line 729-731: Add a golden fixture case alongside the existing
regulated_data coverage that uses one currently untested accepted value, such as
"pii" or "payment", and asserts its expected consequence and specialists. Update
both corresponding fixture sections, including the occurrence near the existing
"credentials" entry, so consequence derivation for these categories is
replay-tested.
In `@scripts/tests/review-risk.schema.json`:
- Around line 516-518: Update scripts/tests/review-risk.schema.json at lines
516-518 for decision.repository to enforce the same repository pattern and
maxLength 200 used by input.repository and packet.repository. Also update
scripts/tests/review-risk.schema.json at lines 42-47 so path rejects single-dot
segments, leading or trailing whitespace, and control characters, matching
normalizeRepositoryPath; add schema coverage for the negative cases from
scripts/tests/test-review-risk.mjs if the existing suite supports it.
In `@scripts/tests/test-review-risk.mjs`:
- Around line 47-53: Update runShadowCli to pass a bounded timeout option to
spawnSync, ensuring blocked review-risk-shadow.mjs subprocesses terminate and
cause the tests to fail rather than hang. Preserve the existing command
arguments and process options.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7d357997-950d-4da1-a87a-9da555ca81a5
📒 Files selected for processing (12)
agent-contracts/risk-proportional-review.contract.jsonagent-contracts/risk-proportional-review.contract.schema.jsondocs/agent-tooling/hermes-risk-proportional-review.mddocs/evidence/hermes-risk-proportional-review-shadow/idea-genesis-reconstruction.mddocs/evidence/hermes-risk-proportional-review-shadow/replay-summary.jsondocs/evidence/hermes-risk-proportional-review-shadow/verification-summary.mdscripts/dev/review-risk-shadow.mjsscripts/lib/risk-proportional-review.mjsscripts/tests/fixtures/review-risk-golden.jsonscripts/tests/fixtures/review-risk-sample.jsonscripts/tests/review-risk.schema.jsonscripts/tests/test-review-risk.mjs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b48a321715
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6dc29c441
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fb6b28ffe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/agent-tooling/hermes-risk-proportional-review.md`:
- Line 167: Update the topology sentence in the production service path
requirements to say that two or more distinct production service roots “raise
the topology classification” to at least distributed, replacing only the
ambiguous “raise topology” wording.
In
`@docs/evidence/hermes-risk-proportional-review-shadow/verification-summary.md`:
- Line 54: Update the topology claim in the production service paths sentence to
state that the two distinct production roots imply the distributed topology, or
explicitly identify the classifier as deriving it; preserve the surrounding
evidence requirements.
In `@scripts/tests/test-review-risk.mjs`:
- Around line 775-795: Update the assertions in the bounded-loop test around
advanceReviewLoop to match the complete error text emitted by validateLoopInput
and fail(), including the risk-proportional-review prefix before the
deterministic-ordering message. Keep the action iteration and existing ordering
validation unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 19f052cb-7b85-4512-8959-d9e69e61b726
📒 Files selected for processing (9)
agent-contracts/risk-proportional-review.contract.schema.jsondocs/agent-tooling/hermes-risk-proportional-review.mddocs/evidence/hermes-risk-proportional-review-shadow/replay-summary.jsondocs/evidence/hermes-risk-proportional-review-shadow/verification-summary.mdscripts/dev/review-risk-shadow.mjsscripts/lib/risk-proportional-review.mjsscripts/tests/fixtures/review-risk-golden.jsonscripts/tests/review-risk.schema.jsonscripts/tests/test-review-risk.mjs
🚧 Files skipped from review as they are similar to previous changes (4)
- docs/evidence/hermes-risk-proportional-review-shadow/replay-summary.json
- scripts/tests/fixtures/review-risk-golden.json
- scripts/tests/review-risk.schema.json
- scripts/lib/risk-proportional-review.mjs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10cda2add1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
monkey1sai-blip
left a comment
There was a problem hiding this comment.
Approved by monkey1sai-blip (the reviewer account pinned by the repo's merge governance).
Submitted through scripts/blip_review.py — a scripted approval carrying the operator's authority, pinned to head 10cda2add1039df58879ade2443e79298e08ebe5. This is the mechanism the GitHub App cannot satisfy: an App's approving review does not count toward required_approving_review_count.
變更摘要
新增 Hermes 風險比例審查的 PR-A shadow-mode 實作,提供 deterministic classifier、bounded packet/result/loop contracts、20-case golden corpus 與本機 advisory CLI。此 PR 不變更 merge authority、GitHub workflow、CODEOWNERS 或 branch protection。
修改原因
依
README_APPLY.md的既有 contract,建立可序列化、exact-head bound、fail-closed 且有明確 context/retry budget 的審查核心,讓後續歷史 calibration 與 advisory integration 有可驗證基線。主要變更
risk-proportional-reviewpolicy、Draft-07 schemas、deterministic classifier、packet/result validator 與 bounded loop。.github/CODEOWNERS與 case variants 維持critical_authority、human_critical與 governance reviewer floor。artifacts/目錄,拒絕 symlink/junction 越界與覆寫。AI Coding Governance
README_APPLY.mdcontractSelf-Referential Bootstrap
驗證方式
node --check scripts/lib/risk-proportional-review.mjs:PASS。node --check scripts/dev/review-risk-shadow.mjs:PASS。node --test scripts/tests/test-review-risk.mjs:48/48 PASS。node --test --experimental-test-coverage scripts/tests/test-review-risk.mjs:48/48 PASS;all files line 95.65%、branch 85.98%、functions 99.00%;核心 library line 97.13%、branch 84.07%、functions 98.91%。node scripts/dev/review-risk-shadow.mjs replay --corpus scripts/tests/fixtures/review-risk-golden.json:20/20 PASS,authority=advisory_shadow。Test-Json -SchemaFile:sample、golden corpus、policy 三組 Draft-07 validation PASS。pwsh -NoProfile -NonInteractive -File scripts/tests/test-self-referential-bootstrap.ps1:PASS。pwsh -NoProfile -NonInteractive -File scripts/tests/test-agent-governance-check.ps1:PASS。.github/CODEOWNERS與.GITHUB/CODEOWNERSregression:均為critical_authority/human_critical且包含 governance specialist。git diff --cached --check:PASS。Get-SelfReferentialMechanismPaths:12 changed paths、0 mechanism paths、bootstrap required=false。Get-WindowsVerificationScope:Tier 0、id=none、Required=false。recommendation=accept。a6dc29c):PASS;PR review agent 無 blocker。a6dc29c修正並逐項回覆。風險與影響
authority=advisory_shadow、merge_authority=false;沒有 production、部署、frontend、Kit/WebRTC 或使用者流程影響。回滾方式
合併前可關閉本 PR 並刪除 branch;合併後以單一 revert PR 撤回本 PR 的 merge commit。此變更沒有 migration、外部狀態或 production rollback 步驟。
後續建議
Known Risks
governance-base-audit在受保護路徑 PR 上必須等候monkey1sai-blip對最新 exact head 的獨立 APPROVED review;不得由本 PR 作者或 bot 取代。Summary by CodeRabbit
New Features
Documentation
Tests