test(06): record mention-upload misclassification gap and closure plan
This commit is contained in:
parent
7ea2bceb78
commit
3caa2d6ce1
|
|
@ -0,0 +1,81 @@
|
||||||
|
---
|
||||||
|
phase: 06-
|
||||||
|
plan: 06
|
||||||
|
type: execute
|
||||||
|
wave: 5
|
||||||
|
depends_on:
|
||||||
|
- 06-05
|
||||||
|
gap_closure: true
|
||||||
|
files_modified:
|
||||||
|
- backend/packages/harness/deerflow/agents/middlewares/uploads_middleware.py
|
||||||
|
- backend/tests/test_uploads_middleware_core_logic.py
|
||||||
|
autonomous: true
|
||||||
|
requirements:
|
||||||
|
- ATREF-04
|
||||||
|
must_haves:
|
||||||
|
truths:
|
||||||
|
- "提及文件(ref_kind=mention)发送时不应被识别为本次新上传文件。"
|
||||||
|
- "<uploaded_files> 的 new_files 区块仅包含真实上传附件,不包含 mention 引用。"
|
||||||
|
artifacts:
|
||||||
|
- path: "backend/packages/harness/deerflow/agents/middlewares/uploads_middleware.py"
|
||||||
|
provides: "按 metadata 区分真实上传与 mention 引用"
|
||||||
|
contains: "_files_from_kwargs"
|
||||||
|
- path: "backend/tests/test_uploads_middleware_core_logic.py"
|
||||||
|
provides: "mention 引用过滤回归测试"
|
||||||
|
contains: "ref_kind"
|
||||||
|
---
|
||||||
|
|
||||||
|
<objective>
|
||||||
|
关闭 UAT 新增 gap:修复“ref_kind=mention, ref_source=upload 被当作本次上传文件”的误判。
|
||||||
|
|
||||||
|
Purpose: 保持提及文件与真实上传附件在后端语义分离,避免 injected <uploaded_files> 误导模型。
|
||||||
|
Output: Middleware 仅接收真实上传文件为 new_files,mention 引用不再进入 uploaded_files state update。
|
||||||
|
</objective>
|
||||||
|
|
||||||
|
<context>
|
||||||
|
@.planning/phases/06-/06-UAT.md
|
||||||
|
@backend/packages/harness/deerflow/agents/middlewares/uploads_middleware.py
|
||||||
|
@backend/tests/test_uploads_middleware_core_logic.py
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<tasks>
|
||||||
|
|
||||||
|
<task type="auto">
|
||||||
|
<name>Task 1: 过滤 mention 引用,避免误判为新上传</name>
|
||||||
|
<files>backend/packages/harness/deerflow/agents/middlewares/uploads_middleware.py</files>
|
||||||
|
<action>
|
||||||
|
在 `_files_from_kwargs` 解析 `additional_kwargs.files` 时,若条目 `ref_kind == "mention"` 则直接跳过,不纳入 `new_files`。保留现有 filename 校验、size/path 归一化、磁盘存在性检查逻辑。
|
||||||
|
</action>
|
||||||
|
<acceptance_criteria>
|
||||||
|
- `ref_kind=mention` 条目不会进入返回列表。
|
||||||
|
- 普通上传条目(无 ref_kind)行为不变。
|
||||||
|
- `before_agent` 的 `<uploaded_files>` 注入仅反映真实上传。
|
||||||
|
</acceptance_criteria>
|
||||||
|
</task>
|
||||||
|
|
||||||
|
<task type="auto">
|
||||||
|
<name>Task 2: 补充回归测试覆盖 mention 过滤</name>
|
||||||
|
<files>backend/tests/test_uploads_middleware_core_logic.py</files>
|
||||||
|
<action>
|
||||||
|
新增测试:当 files 中包含 `ref_kind=mention`(含 `ref_source=upload`)时,`_files_from_kwargs` 不返回该条目;并验证 mixed list 下真实上传仍可保留。
|
||||||
|
</action>
|
||||||
|
<acceptance_criteria>
|
||||||
|
- 新增测试在修复前失败、修复后通过。
|
||||||
|
- 不影响已有核心 middleware 测试。
|
||||||
|
</acceptance_criteria>
|
||||||
|
</task>
|
||||||
|
|
||||||
|
</tasks>
|
||||||
|
|
||||||
|
<verification>
|
||||||
|
- `cd backend && pytest -q tests/test_uploads_middleware_core_logic.py -k "mention or files_from_kwargs"`
|
||||||
|
</verification>
|
||||||
|
|
||||||
|
<success_criteria>
|
||||||
|
- UAT 新增 gap 的 root cause 与修复措施一一对应。
|
||||||
|
- 计划可直接由 `/gsd-execute-phase 6 --gaps-only` 执行。
|
||||||
|
</success_criteria>
|
||||||
|
|
||||||
|
<output>
|
||||||
|
After completion, create `.planning/phases/06-/06-06-SUMMARY.md`
|
||||||
|
</output>
|
||||||
|
|
@ -8,7 +8,7 @@ source:
|
||||||
- 06-COMMIT-SUMMARY.md
|
- 06-COMMIT-SUMMARY.md
|
||||||
- 06-SUMMARY.md
|
- 06-SUMMARY.md
|
||||||
started: 2026-04-15T03:14:38Z
|
started: 2026-04-15T03:14:38Z
|
||||||
updated: 2026-04-15T03:33:07Z
|
updated: 2026-04-15T06:02:00Z
|
||||||
---
|
---
|
||||||
|
|
||||||
## Current Test
|
## Current Test
|
||||||
|
|
@ -43,7 +43,7 @@ reason: "本地无法测试失效引用。"
|
||||||
### 5. 带引用的消息可正常发送并保持文件上下文
|
### 5. 带引用的消息可正常发送并保持文件上下文
|
||||||
expected: 发送包含引用的消息后,消息成功进入对话流;引用对应的文件信息在后续上下文中可用。
|
expected: 发送包含引用的消息后,消息成功进入对话流;引用对应的文件信息在后续上下文中可用。
|
||||||
result: issue
|
result: issue
|
||||||
reported: "文件信息在上下文中不可用。当前系统未被当作上下文的传参是 artifact mention(包含 ref_kind/ref_source),上传文件会被当作上下文传参;且在输入中的任何时候输入@都应出现候选列表,不应仅在输入框为空时出现。"
|
reported: "文件信息在上下文中不可用。当前系统未被当作上下文的传参是 artifact mention(包含 ref_kind/ref_source),上传文件会被当作上下文传参;且在输入中的任何时候输入@都应出现候选列表,不应仅在输入框为空时出现。发送提及文件时也会被误认为发送文件(例如 ref_kind=mention、ref_source=upload 的对象被当作 upload)。"
|
||||||
severity: major
|
severity: major
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
@ -127,3 +127,18 @@ blocked: 0
|
||||||
- "选择候选后仅移除当前 mention token,不影响其余已输入文本"
|
- "选择候选后仅移除当前 mention token,不影响其余已输入文本"
|
||||||
- "补充“已有文本 + 中途 @ + 选中文件”回归测试"
|
- "补充“已有文本 + 中途 @ + 选中文件”回归测试"
|
||||||
debug_session: ""
|
debug_session: ""
|
||||||
|
- truth: "提及文件(ref_kind=mention)发送时应保留 mention 语义,不应被系统识别为“本次新上传文件”。"
|
||||||
|
status: failed
|
||||||
|
reason: "User reported: 在发送提及文件的时候,系统误认为我的提及文件是发送文件。因为上传时传了 {filename,size,path,status,ref_kind:mention,ref_source:upload}。"
|
||||||
|
severity: major
|
||||||
|
test: 5
|
||||||
|
root_cause: "后端 UploadsMiddleware 在 `_files_from_kwargs` 中仅按 `filename/size/path/status` 解析 `additional_kwargs.files`,没有排除 `ref_kind=mention`,导致 mention 引用被归类为 new_files 并注入 `<uploaded_files>` 的“uploaded in this message”块。"
|
||||||
|
artifacts:
|
||||||
|
- path: "backend/packages/harness/deerflow/agents/middlewares/uploads_middleware.py"
|
||||||
|
issue: "`_files_from_kwargs` ignores `ref_kind/ref_source` and classifies mention references as newly uploaded files"
|
||||||
|
- path: "frontend/src/core/threads/submit-files.ts"
|
||||||
|
issue: "references use `ref_kind=mention` with `ref_source=upload|artifact`; middleware currently does not honor this discriminator"
|
||||||
|
missing:
|
||||||
|
- "在 `_files_from_kwargs` 过滤 `ref_kind=mention` 条目,不将其计入 new_files"
|
||||||
|
- "补充 middleware 单测覆盖 mention 条目不被识别为本次上传"
|
||||||
|
debug_session: ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue