Skip to content

Commit 3a9b1b9

Browse files
committed
fix(mcp): close runtime dep gap and bound MCP tool probes
Add executable-absorption-gates to MCP runtime allowlist so profile entry-check works on deployed hosts; smoke tools/call with deadlines, hang-bound tests, requirement authenticity/dedupe template fields, and ConfirmBinding rehash guidance. Track Q documents package vs activeRoot path mistakes that surface as Grok tool failed counts.
1 parent b361326 commit 3a9b1b9

14 files changed

Lines changed: 384 additions & 4 deletions

‎changelogs/unreleased.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
## 当前未发布实现候选
77

8+
- **跨宿主 MCP runtime 闭包 + tools/call 烟雾 + hang 有界 + 模板真/重/路径列 + Track Q**:`CLAUDE_MCP_RUNTIME_SCRIPT_DEPS` 补 `executable-absorption-gates.js`;`mcpToolCallProbe` 进 Grok runtime verify;`test:mcp-runtime-closure` 挂 host-parity;ConfirmBinding mismatch nextStep;概况 §11/§12 真实性/去重;delivery/report 禁无路径短名表;memory Skill package vs activeRoot。需求:`跨宿主MCP卡死与Runtime依赖不全修复`(L4 真机仍待执行)。
89
- **Agent 交付诚实需求关账**:H0/H1(`8910712`)+ H2 ECR 对账报告;Stop gaps `stage-report-missing` / `progress-overclaim`;与 ecr-missing 串联。需求目录 closed。
910
- **ECR 完成宣称强制闭环(ecr-missing)**:`classifyEcrClosure`;强完成/关需求无 ECR/DoD 证据 → Stop gap `ecr-missing`;`npm run test:ecr-closure` 挂 stop-gate 与 control-plane;report-dev 标明测试绿≠ECR。需求:`ECR与完成宣称强制闭环修复`。
1011
- **Agent 交付诚实门(delivery-honesty)**:`classifyDeliveryHonesty` → gap `stage-report-missing` / `progress-overclaim`;Stop 接线;PreTool 有 04 无 05 时禁控制面写;`npm run test:delivery-honesty` 挂 stop-gate 与 control-plane;进度模板 DeliveryHonestyMatrix。需求:`Agent交付诚实与过程产物强制修复`。

‎index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ const CLAUDE_SOURCES = [
7676
const CLAUDE_MCP_RUNTIME_SCRIPT_DEPS = Object.freeze([
7777
'scripts/lib/cp-digest.js',
7878
'scripts/lib/host-parity-scorecard.js',
79+
// host-parity-scorecard hard-depends on executable-absorption-gates (profile_compose_entry_check)
80+
'scripts/lib/executable-absorption-gates.js',
7981
'scripts/lib/global-adapter-refresh-guidance.js',
8082
'scripts/lib/global-host-target.js',
8183
'scripts/lib/derived-index-contract.js',

‎mcp/memory-server.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,11 @@ function handleMemoryCpConfirm(args) {
17171717
if (!fs.existsSync(candidate) || !fs.statSync(candidate).isFile()) continue
17181718
const actual = crypto.createHash('sha256').update(fs.readFileSync(candidate)).digest('hex').toUpperCase()
17191719
if (actual !== sha) {
1720-
throw new Error(`ConfirmBindingGate: artifactSha256 mismatch for ${artifactPath} (disk=${actual})`)
1720+
throw new Error(
1721+
`ConfirmBindingGate: artifactSha256 mismatch for ${artifactPath} (disk=${actual}). ` +
1722+
'Re-hash the file on disk AFTER the last edit (sha256 of current bytes), then call memory_cp_confirm again. ' +
1723+
'Do not reuse a hash computed before subsequent writes.'
1724+
)
17211725
}
17221726
matched = true
17231727
break

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"test:discipline-execution": "node scripts/test-discipline-execution-probe.js",
7575
"test:host-instruction-projection": "node scripts/generate-host-instruction-projections.js --check && node scripts/test-host-instruction-projection.js",
7676
"test:host-adapters": "node scripts/test-host-adapters.js",
77-
"test:host-parity": "node scripts/test-host-parity-scorecard.js && node scripts/test-workspace-root-scan-ban.js && node scripts/test-host-parity-remaining.js && node scripts/test-host-parity-ledger.js",
77+
"test:host-parity": "node scripts/test-host-parity-scorecard.js && node scripts/test-workspace-root-scan-ban.js && node scripts/test-host-parity-remaining.js && node scripts/test-host-parity-ledger.js && node scripts/test-mcp-runtime-closure.js",
7878
"test:host-installation": "node scripts/test-host-installation.js",
7979
"test:npm-lifecycle-adapter": "node scripts/test-npm-lifecycle-adapter.js",
8080
"test:global-host-config": "node scripts/test-global-host-config.js && node scripts/test-global-host-runtime-verifier.js",
@@ -112,6 +112,7 @@
112112
"validate": "node scripts/validate.js",
113113
"prepublishOnly": "npm run test:all:with-audit",
114114
"test:executable-absorption-gates": "node scripts/test-executable-absorption-gates.js",
115+
"test:mcp-runtime-closure": "node scripts/test-mcp-runtime-closure.js",
115116
"test:skill-resolve": "node scripts/test-skill-resolve.js && node scripts/test-skill-resolution-hook-paths.js && node scripts/test-workspace-skill-auto-match.js",
116117
"test:stop-gate": "node scripts/test-lifecycle-stop-gate.js && node scripts/test-r10-control-plane-honesty.js && node scripts/replay-stop-gate-hook-matrix.js && node scripts/test-process-enforcement-e2e.js && node scripts/test-delivery-honesty.js && node scripts/test-ecr-closure.js",
117118
"test:process-enforcement-e2e": "node scripts/test-process-enforcement-e2e.js",
@@ -273,6 +274,7 @@
273274
"scripts/lib/global-adapter-refresh-guidance.js",
274275
"scripts/lib/global-adapters-cli.js",
275276
"scripts/lib/host-parity-scorecard.js",
277+
"scripts/lib/executable-absorption-gates.js",
276278
"scripts/lib/parity-unaligned-ledger.js",
277279
"scripts/lib/parity-upgrade-decision.js",
278280
"scripts/fixtures/host-parity/",

‎prompts/bug-overview.prompt.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ applyTo: .devcodex/**/bugs/**
5050
- [§7 临时绕过方式](#7-临时绕过方式)
5151
- [§8 不确定问题与补充信息](#8-不确定问题与补充信息)
5252
- [§9 研发确认状态](#9-研发确认状态)
53+
- [§10 问题真实性与去重(AI)](#10-问题真实性与去重ai)
5354
```
5455

5556
---
@@ -137,3 +138,15 @@ applyTo: .devcodex/**/bugs/**
137138
| 是否已确认可重现 | 是 / 否 / 偶发 / 待补充 |
138139
| 是否已确认根因 | 是 / 否;根因由研发填写 |
139140
| 是否已确认影响范围 | 是 / 否;说明 |
141+
142+
## §10 问题真实性与去重(AI)
143+
144+
> 非报告方填写。与需求概况 §11/§12 同构最小集。
145+
146+
| 字段 | 填写 |
147+
|------|------|
148+
| authenticityStatus | `verified` / `partial` / `unverified` |
149+
| evidenceRefs | 含 **路径列** 的证据 |
150+
| matchResult | `new` / `duplicate` / `extend-existing` / `related-parallel` |
151+
| candidates | 相关 bug/需求 **路径** + 差异 |
152+
| decision | 新建 bug 目录 / 并入已有 |

‎prompts/cp-checklist.prompt.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ applyTo: "**"
2626
- [ ] 影响范围初步评估完成
2727
- [ ] 需求入口文档已按类型创建(`requirement-overview.prompt.md` / `requirement-change-overview.prompt.md` / `bug-overview.prompt.md`,SimpleTaskFastPath 可 N/A)
2828
- [ ] 需求确认文档已按模板创建(`requirement.prompt.md`)
29+
- [ ] **真实性门禁**已填(概况/问题概况 authenticityStatus + evidenceRefs;未验证须 gate 明示)
30+
- [ ] **去重决策**已填(matchResult + candidates 路径 + decision;禁止静默 duplicate)
31+
- [ ] 用户可见产物表含 **路径列**(PF-175;禁止仅「文件\|内容」短名)
2932

3033
**等待用户确认:** → 用户回复"确认"/"通过"/"OK" 后进入 CP2
3134

‎prompts/delivery-checklist.prompt.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ applyTo: .devcodex/**/requirements/**
5959
6. 可见项必须使用 displayName/purposeText/userAction 与稳定 readingOrder,禁止“主要产物”;
6060
7. 按当前 surface 的 `LinkCapabilityDecisionV1` 选择 rich/portable/plain/failed;Rich clickable 不在路径列外重复 `绝对路径:` 行;
6161
8. **ArtifactPathColumnGate(PF-175)**:每项必须有路径列/字段,默认 workspace-relative portable;自由文本表默认列=语义名称\|用途\|路径\|操作;
62-
9. 完成后在报告中记录 `delivery-checklist: PASS`、manifestId、setId、semanticDigest 与 reconciliation。
62+
9. **禁止** 交付表只有「文件 \| 内容」+ 短文件名、无路径列(Grok 用户不可定位;与 PF-175 冲突);
63+
10. 完成后在报告中记录 `delivery-checklist: PASS`、manifestId、setId、semanticDigest 与 reconciliation。

‎prompts/report-dev.prompt.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ applyTo: .devcodex/**/reports/requirements/**
88
> **路径**: 优先 `.devcodex/**/requirements/<需求>/reports/<agent>/YYYYMMDD/NN--<name>.md`;无任务上下文时回退到 `.devcodex/**/reports/requirements/<agent>/YYYYMMDD/NN--<name>.md`
99
> **触发**: dev 工作流完成后,由 `report/SKILL.md` 驱动生成
1010
> ⚠️ **测试绿 ≠ ECR**:`npm test` / 探针 exit 0 不能代替 **N6 ECR 执行闭环复审**。强完成/关需求话术须含 ECR 段 + DoD 对账表,否则 Stop gap `ecr-missing`。
11+
> ⚠️ **PF-175 路径列**:报告/完成回复中的产物表须 `语义名称 | 用途 | 路径 | 操作`;禁止「文件|内容」无路径。Grok 状态条 **N failed** = 工具 outcome 计数(可含已自愈的错路径),≠ 任务失败。
1112
> **共享基模**: `skills/report/report-schema.json` 的 baseFields + dev overlay;治理结果按 `gateGroup / result / evidence / skipReason` 记录
1213
> **字段约束**: 每条遗留问题/建议必须附五项验证(合理性 + 可实施性 + 收益 + 验证状态 + 影响范围),详见 [`17-compliance.instructions.md`](../instructions/17-compliance.instructions.md) §1 输出验证
1314
---

‎prompts/requirement-overview.prompt.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,34 @@ applyTo: .devcodex/**/requirements/**
201201
| **主要风险** | |
202202
| **开放问题** | 须用户确认后才能进 01/CP2 的点 |
203203
| **建议验证/E2E** | 若属控制面/流程强制类,须列出防复发测试意图 |
204+
205+
## §11 需求/问题真实性(AI 强制 · 非需求方填写)
206+
207+
> 🔴 交给用户确认概况前必须填写。`§10 验证状态`(是否实读代码)**不等于**本表「主症状是否被问题验证」。
208+
209+
| 字段 | 填写 |
210+
|------|------|
211+
| authenticityStatus | `verified` / `partial` / `unverified` / `disputed` |
212+
| primarySymptom | 用户主诉一句话 |
213+
| evidenceRefs | 路径 / 命令 / 截图 / 会话(**须带 portable 路径**,PF-175) |
214+
| verificationMethod | 机测 / 直连探针 / 合成夹具 / 真机 UI / 仅口述 |
215+
| openGaps | 尚未验证的点 |
216+
| gate | `pass-to-cp1` / `block-until-evidence` / `proceed-with-risk`(须用户知悉) |
217+
218+
## §12 是否重复(AI 强制 · 非需求方填写)
219+
220+
> 🔴 扫描 `.devcodex/**/requirements` 与 `bugs`(及已知 closed 相关项),禁止静默重复开目录。
221+
222+
| 字段 | 填写 |
223+
|------|------|
224+
| scanScope | 扫描范围说明 |
225+
| matchResult | `new` / `duplicate` / `extend-existing` / `related-parallel` |
226+
| candidates | 候选路径 + 相似点 + 差异(表格式,含**路径列**) |
227+
| decision | 新建 / 并入变更 / 扩展已有 / 搁置 |
228+
| decisionOwner | 用户确认 / AI 建议待确认 |
229+
230+
## §13 路径与工具失败语义(AI 注意 · Track Q)
231+
232+
> - **packageRoot**(如仓库 `devcodex-v1/`)含 `package.json` / `mcp/` / `scripts/`;**activeRoot**(`.devcodex/<project>/`)只含状态与需求产物,**没有** `index.js`。
233+
> - 读源码用 packageRoot;写需求/报告用 activeRoot。误读 `.devcodex/**/index.js` 会导致 Grok 状态条 **1 failed**(工具 error 计数,≠ 任务失败)。
234+
> - ConfirmBinding:`memory_cp_confirm` 的 sha256 必须在**最后一次改文件之后**重算。

‎prompts/requirement.prompt.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ applyTo: .devcodex/**/requirements/**
109109
| 来源类型 | 路径 / 附件 / 链接 | 关键摘要 | 缺失 / 冲突 / 待确认 |
110110
|----------|------------------|----------|---------------------|
111111
| 纯新需求概况 | `00-需求概况.md` | | |
112+
| 概况真实性/去重 | `00-需求概况.md` §11/§12(若有) | authenticityStatus · matchResult · decision | 未填不得伪称已问题验证 |
112113
| 需求变更概况 | `00-需求变更概况.md` | 原需求基线、变更前后差异、影响范围 | |
113114
| Bug 问题概况(排除项) | `.devcodex/**/bugs/<问题>/00-问题概况.md` | 若命中,应转 fix 工作流 | |
114115
| 原始附件 | Word / PRD / 原型 / 截图 / 表格 / 聊天记录 / 会议纪要 | | |

0 commit comments

Comments
 (0)