AT-T009 / AT-T010 FAIL:write_todos 与 task 不在原生身份清单里——「不能以同名自研函数冒充复用」这道守卫对这两个工具是空的(实测同名替换不报错)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
> 来自 #3004(AT 验收 B3 + 平台前置)的 RUN 组定级。定级:**AT-T009 FAIL、AT-T010 FAIL**
> (已执行且行为不符合契约,不是 BLOCKED——工具本身挂载正常、组件层全绿,红的是身份/trace 这条判据)。
> exact SHA:`938d16bf3a49c4047f42bbc697833cd921d1053e`(detached checkout,工作树 clean)。
## 契约
`capability-catalog.json` 里 **WX-T009 `write_todos`** 与 **WX-T010 `task`** 的 `acceptance_criteria` 各有一条**逐字相同**的要求:
> 工具 trace 记录本编号与上游真实实现符号;**不能以同名自研函数冒充复用**。
两者 `source_refs` 都是 `["LC"]`,`remaining_delta` 分别写着「TodoListMiddleware 已启用」「原生 task 已有」——即**声明为原生复用**,正是这条判据要守的对象。
## 实测:守卫的覆盖面只有 T001–T008
`apps/deep-agent-service/src/deep_agent_service/native_tool_identity.py` 的
`verify_native_tool_identities()` 只遍历 `generated/native_tool_identities.json`:
```console
manifest ids: ['WX-T001', 'WX-T002', 'WX-T003', 'WX-T004', 'WX-T005', 'WX-T006', 'WX-T007', 'WX-T008']
compiled tool names: ['delete', 'edit_file', 'execute', 'glob', 'grep', 'ls', 'read_file', 'task', 'write_file', 'write_todos']
```
`write_todos` 与 `task` **确实编进了同一张图**,但**不在清单里**,于是守卫看不见它们。
### 反证(mutation + 对照组,一次跑完)
照搬既有 `tests/test_native_tool_identity.py::test_same_name_replacement_is_not_reported_as_upstream` 的做法,
把工具实现换成同名的自研函数,再问守卫:
```console
MUTATION on write_todos: verifier did NOT raise <-- unguarded
MUTATION on task: verifier did NOT raise <-- unguarded
CONTROL read_file: verifier raised: Native tool implementation no longer matches its standard identity <-- guard works
```
对照组证明守卫机制本身是好的、这次跑法也是对的——**红的是覆盖面,不是机制**。
(探针脚本临时放在 `tests/` 下跑完即删,未改仓库任何文件。)
### TypeScript 侧同样没有归属
`packages/contracts/src/native-tool-identities.ts` 的 `nativeToolProvenance()` 实测:
```
ls -> WX-T001
read_file -> WX-T002
write_todos -> NO PROVENANCE ({})
task -> NO PROVENANCE ({})
```
⇒ 这两个工具的 `tool_start` / `tool_end` 事件不带 `capability.id`,「trace 记录本编号」这半条也不成立。
### 全仓搜索
```console
$ grep -rn "WX-T009\|WX-T010" --include="*.ts" --include="*.py" --include="*.json" . | grep -v node_modules | grep -v capability-catalog.json
(无输出)
```
**这两个编号在实现与测试里一次都没出现过**,只存在于目录文件。
## 正向行为本身是好的(不要连坐)
同 SHA 实测,组件层全绿,说明缺的只是身份归属这一条:
| 命令 | 结果 |
| --- | --- |
| `PYTHONPATH=src .venv/bin/python -m pytest tests/test_harness.py -q` | **69 passed**,退出 0 |
| `… tests/test_tools.py tests/test_native_graph.py tests/test_native_file_delegation.py tests/test_native_factory.py -q` | **70 passed / 5 skipped**,退出 0(5 条 skip 的理由是 `Requires an explicitly owned E003 integration container`,属 WX-E003 不在本批) |
| `… tests/test_native_interaction_tools.py tests/test_native_tool_identity.py tests/test_native_tool_snapshot.py tests/test_native_tool_authority.py -q` | **41 passed**,退出 0 |
`test_harness.py` 里 T009 的正反两侧都有真实用例:`test_write_todos_present_with_harness_middleware`、
`test_todo_tool_absent_without_middleware`、`test_task_classifier_middleware_forces_write_todos_for_complex_instruction_{sync,async}`
以及四条 `test_classify_task_text_*_is_no_plan` 的否定样本。
## 建议修法(本 issue 只定级并上报,不自行动手)
1. 把 `write_todos`(`langchain.agents.middleware:TodoListMiddleware`)与 `task`
(`SubAgentMiddleware`)两条描述符补进 `native_tool_identities.json` 的生成源,
`locator` 按现有形态写成 `:._create__tool` 的真实符号
(**先实测符号名再写**,两者不一定与 FilesystemMiddleware 同形)。
2. 生成物同步后,`packages/contracts/tests/native-tool-identities.test.ts` 的既有断言
(generated == `NativeToolIdentities` == catalog `canonical_name`,且 locator 含
`_create__tool`)会自动把这两条纳入;若 locator 形态不同,该断言需要一并放宽,
**放宽方式必须仍能证伪同名替换**,否则等于把守卫拆了。
3. 补一条反证测试:对 `write_todos` / `task` 做同名替换,`verify_native_tool_identities`
必须抛错——即上面那次 mutation 从 `did NOT raise` 变成 `raised`。
## 边界
- 不改 `capability-catalog.json`(它是评审基线)。
- 不动 T001–T008 现有守卫与其反证测试。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with apps/deep-agent-service/src/deep_agent_service/native_tool_identity.py and generated/native_tool_identities.json, then inspect packages/contracts/src/native-tool-identities.ts and the existing identity tests. Verify the canonical symbols for write_todos and task before updating the generated identity data, and run packages/contracts/tests/native-tool-identities.test.ts plus the relevant Python identity tests. Done means both tools have capability provenance and same-name replacement causes verification to fail, without changing the catalog or T001–T008 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- testing, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100