Skip to content

fix(gep): add typed fail-closed LLM review contract and skill2gep promotion gate - #646

Merged
autogame-17 merged 1 commit into
mainfrom
fix/llm-review-fail-closed
Nov 25, 2026
Merged

autogame-17 merged 1 commit into
mainfrom
fix/llm-review-fail-closed

Conversation

@autogame-17

Copy link
Copy Markdown
Member

Summary

Add the typed fail-closed LLM review promotion contract to src/gep/llmReview.js (while preserving all #614 subprocess runner/retry behaviors and exports) and wire src/gep/skill2gep.js (runOnSkillInvocation) to block persistence, seen-state recording, and Hub publication whenever a Capsule's LLM review is not explicitly approved.

What changed

  • Extended src/gep/llmReview.js with REVIEW_CONTRACT_VERSION, REVIEW_POLICY_VERSION, REVIEW_STATUSES, normalizeReviewResult, isApprovedReview, and synchronous reviewInvoker / invoke execution with typed approved / rejected / inconclusive / unavailable / failed results, SHA-256 prompt/response evidence, provenance, error, and recovery metadata.
  • Preserved parseReviewResponse, classifyExecutionError, REVIEW_MAX_ATTEMPTS, and the options subprocess runner/retry path introduced in fix: fail closed on unavailable llm review #614 (b094d5b / 3effd6d).
  • Updated src/gep/skill2gep.js (runOnSkillInvocation) to invoke llmReview.runLlmReview when a Capsule is assembled and return { ok: false, reason: 'llm_review_blocked', ... } without persisting Gene/Capsule assets, marking state.seen, or publishing when EVOLVER_LLM_REVIEW=true and the review is not approved.
  • Added unit tests in test/llmReview.test.js (typed contract coverage alongside existing fix: fail closed on unavailable llm review #614 runner boundary tests) and test/skill2gep.test.js (skill2gep review promotion gate).

How to test

  1. node --test test/llmReview.test.js test/skill2gep.test.js test/skill2gepParser.test.js test/skill2recipes.test.js test/harnessGovernanceCheck.test.js
  2. Expected output: 86 tests, 18 suites, 86 pass, 0 fail.

Risk

Low -- additive typed contract in src/gep/llmReview.js preserving all existing #614 exports and runner behavior; skill2gep review gate is active only when EVOLVER_LLM_REVIEW=true.

Harness/evaluator governance

Upstream governance surface: src/gep/llmReview.js and src/gep/skill2gep.js (GEP promotion review gate for distilled Skill Capsules)
Downstream EvoX impact: None on default EVOLVER_LLM_REVIEW=false path; when EVOLVER_LLM_REVIEW=true, skill2gep.runOnSkillInvocation requires an approved review result before persisting or publishing a Capsule
Rollout-local scope: Opt-in via EVOLVER_LLM_REVIEW=true environment flag on local skill2gep invocation
Promotion boundary: Capsule persistence and Hub publication in skill2gep.runOnSkillInvocation are gated by llmReview.isApprovedReview(review) before assetStore.upsertGene / assetStore.appendCapsule / publishAssets
Evaluator mismatch sets: Verification and evidence sets (approved, rejected, inconclusive, unavailable, failed statuses with SHA-256 prompt/response evidence and recovery actions); observation, action, repair, and belief sets unchanged
Non-regression evidence: node --test test/llmReview.test.js test/skill2gep.test.js test/skill2gepParser.test.js test/skill2recipes.test.js test/solidifyIntegration.test.js test/harnessGovernanceCheck.test.js (91 pass, 0 fail)
Fix-severity review: medium
Owner approval: autogame-17 (Evolver GEP / skill2gep owner)
Security boundary: Fail-closed promotion gate; no new external network calls, subprocesses, or secret reads when reviewInvoker is absent or fails
Rollback: Set EVOLVER_LLM_REVIEW=false (default) or revert this commit
Live promotion: no
Autonomous evaluator self-editing: no

Self-check

  • If this PR uses Object.assign({}, DEFAULTS, partial) to build an object, every reference-typed field (arrays, sub-objects) on the result is sliced or cloned -- not held by reference to either source.
  • No new runtime dependencies added without a clear justification in the "What changed" section above.
  • Tests added or updated to cover the new behavior; full suite passes locally (node --test test/*.test.js).

Related

Follows #614

🤖 Generated with Claude Code

…motion gate

Extend `src/gep/llmReview.js` with the typed promotion-gate contract
(`normalizeReviewResult`, `isApprovedReview`, `REVIEW_CONTRACT_VERSION`,
`REVIEW_POLICY_VERSION`, `REVIEW_STATUSES`, and synchronous `reviewInvoker` /
`invoke` support) while preserving the existing subprocess runner, retry trace,
`parseReviewResponse`, and `classifyExecutionError` exports from #614.

Gate `skill2gep.runOnSkillInvocation` on `llmReview.runLlmReview` whenever a
Capsule is assembled so non-approved (`rejected`, `inconclusive`, `unavailable`,
`failed`) review results fail closed before persisting Gene/Capsule assets,
marking the execution fingerprint as seen, or requesting Hub publication.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,并发现 3 个已核验问题。

另有 4 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver"、pr_number=646、head_sha="ba6b1de724bd19901198101d80f98812e6725e4a",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 ba6b1de724bd

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 4 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P3] 未传 options 时不再执行既有默认审查器 — 原实现无论 options 是否存在都会进入 runRunnerReview 的前身逻辑,并采用 defaultExecute。新...(truncated) · src/gep/llmReview.js · advisory_ffe15589d1797f91b27a6c4d
  • [P3] 未隔离的 diff 可操纵 LLM 门禁作出批准 — 当前 PR 首次把模型判断接入实际晋升门禁,但模型同时读取可由调用方提供的待审 diff。dif...(truncated) · src/gep/skill2gep.js · advisory_47da4fa9fdef03c7eaad8df0
  • [P3] 被判定“不支持”的异步 invoker 可能在稍后导致进程崩溃 — 代码先调用 invoker,拿到 Promise 后才判定异步调用不受支持并同步返回 failed。该 Promise 没...(truncated) · src/gep/llmReview.js · advisory_dc145740fb4a79a5056bebcc
  • [P3] 默认审查执行器契约回退导致发布门禁被绕过 — 实现侧改变了可选参数/默认执行器契约,但既有调用链仍允许省略第二参数、options 或显...(truncated) · src/gep/llmReview.js`, `src/gep/skill2gep.js · advisory_23caf1ea0eaa45703096233a

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 ba6b1de724bd

Comment thread src/gep/llmReview.js
options
&& typeof options === 'object'
&& !Array.isArray(options)
&& typeof options.invoke !== 'function'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

省略可选参数时不再使用默认审查执行器

🔴 严重程度:高(P1)
原有 runLlmReview(input, options) 在未注入 execute 时会使用 defaultExecute。本次改动把“没有第二参数”路由到 injected-provider 分支;该分支发现没有 invoker 后直接返回 unavailable。因此语义等价的 runLlmReview(input) 与 runLlmReview(input, {}) 现在分别得到“provider 未配置”和“调用默认 runner”两种结果。新增的 skill2gep 入口恰好只传一个参数,所以既有仅通过环境变量启用审查的配置...(truncated)

Finding:finding_f94c6d1ef96d73b4d3389269

Comment thread src/gep/llmReview.js
if (!isLlmReviewEnabled()) return null;

const hasRunnerOptions = Boolean(
options

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

无显式 invoker 时不再调用默认审查执行器

🔴 严重程度:高(P1)
原实现允许 runLlmReview(input) 通过 defaultExecute 执行内置 runner;新分派逻辑只有在第二个 options 参数存在时才进入 runRunnerReview。本 PR 新增的 skill2gep 调用只传一个参数,因此没有注入 invoker 时直接返回 unavailable,随后被 llm_review_blocked 阻断,已配置的默认 runner 永远不会执行。

Finding:finding_5f92a7f8d2170ba9368ee1be

Comment thread src/gep/llmReview.js
function runLlmReview(input, options) {
input = input || {};
if (!isLlmReviewEnabled()) return null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

无第二参数的旧调用不再使用默认审核执行器

🟠 严重程度:中(P2)
修改前,runLlmReview(input) 会通过 options || {} 选择 defaultExecute;修改后,只有传入非 invoker 的第二参数才进入 runRunnerReview()。省略第二参数时会进入注入式 provider 分支,因没有 invoker 返回 status: unavailable。这把原本有效的公开调用方式变成失败结果。

Finding:finding_7065c9521251d1eb5f51e40a

@autogame-17
autogame-17 merged commit 5de0575 into main Nov 25, 2026
3 checks passed
@autogame-17
autogame-17 deleted the fix/llm-review-fail-closed branch November 25, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant