fix(subagents): separate result display projection - #240
Conversation
1f6e192 to
1eb24c6
Compare
|
Synchronized with the latest upstream main. The 23 focused subagent/config tests pass, along with lint, typecheck, and diff checks. The PR is mergeable and awaits maintainer review/workflow approval. |
|
补充代码审计结果:已加入 transport 后缀误删和单结果 artifact 失败不可见的回归修复。相关针对性测试 15/15,lint/typecheck 通过;远端 PR 文件内容已校正为精确提交字节,避免换行噪声。 |
|
代码有效性复核:
当前 PR 仍为 OPEN、MERGEABLE;REVIEW_REQUIRED / BLOCKED 表示等待维护者 review 与工作流批准,不代表代码失败。 |
|
代码审计后补充了一处实际运行路径修复: 自动完成投递原先仍调用旧的字符串投影函数,真实 artifact 保存失败时不会把失败状态带到结果详情;现在已改为调用结构化投影函数,并加入真实不可写 artifact 目录的回归测试。 验证:
远程 PR 最新提交:f2796e7。当前仍为 OPEN、MERGEABLE;REVIEW_REQUIRED / BLOCKED 仍是等待维护者 review 与工作流授权。 |
|
代码有效性审计结论:PR #240 的核心目标在当前远程提交 |
92b2efa to
b21c12c
Compare
somewan820
left a comment
There was a problem hiding this comment.
已完成静态审查。结果展示投影与 model transport payload 分离,legacy transport suffix 清理、compact/full rendering、artifact failure 显示及终端宽度限制均有对应测试;未发现 P0-P2 或死代码问题。P3:建议后续补充真实 TUI/IME 终端集成覆盖。未运行测试。
edb7e94 to
95d43a6
Compare
| theme: SubagentResultTheme, | ||
| ) { | ||
| const displayContent = sanitizeText( | ||
| stripSubagentResultTransportInstruction(details.displayContent ?? content), |
There was a problem hiding this comment.
[P1] 不要对已经分离出的 displayContent 再无条件执行 legacy transport instruction 清洗。若 child 的真实答案恰好引用或以该指令文本结尾,这里会把合法内容删掉,expanded view 因而无法完整读取 child answer;replaceAll 分支还会删除正文中位于 Subagent ... 段落前的同文本。请只对无法证明已分离的 legacy payload 做兼容清洗,并新增包含该字面文本的回归测试。
| readonly title?: string; | ||
| readonly status?: SubagentSnapshot["status"]; | ||
| readonly elapsed?: string; | ||
| readonly artifactSaveFailed?: boolean; |
There was a problem hiding this comment.
[P2] 当前 result details 只携带 status、elapsed 和 artifact save failure,无法让 compact collapsed view 区分 issue #174 明确要求可见的 uncertain/重要结果/worktree-handoff 等例外状态。这样一个 done 但结论不确定或仍有 worktree 风险的结果会显示成普通成功。请把这些 canonical outcome 元数据从执行结果传到 display projection,并分别覆盖 collapsed tests。
| }, | ||
| }, | ||
| }, | ||
| { expanded: false }, |
There was a problem hiding this comment.
[P2] 这个用例假设 renderer 为 compact,却没有显式设置 compact 配置或隔离 PI_CODING_AGENT_DIR。在合法的 persisted subagentResultDisplay: full 用户配置下,用例实际走 full renderer,并因找不到 artifact not saved 而失败;我在 merge-state 上已复现,换成空临时 agent dir 后才通过。请让测试注入/隔离所需配置,避免用户本机状态决定测试结果。
tt-a1i
left a comment
There was a problem hiding this comment.
已按精确 head 75ecc15 复核。这个 PR 的核心方向正确:把 model transport payload 与 operator display projection 分开,并把默认显示切到 compact,相关 setup/README/default contract 已同步。当前仍有三项需要修正后再合并:已分离的 displayContent 会被 legacy 清洗器误删真实 child 内容;collapsed projection 没有承载 issue #174 要求的 uncertain、重要结果、worktree/handoff 等例外状态;renderer 测试未隔离 persisted config,能被用户的 full 配置污染。本地 merge-state bun run check 通过;隔离配置后完整测试 Node 1017 passed/1 skipped、Vitest 30/30,但未隔离的 focused suite 可稳定复现 1 个失败。精确 head CI 全绿;分支已落后于当前 main,更新后需重跑并复核新 head。
Preserve separated display content, propagate interrupted and recovery metadata, and isolate compact renderer configuration in tests.
75ecc15 to
200fa4a
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
已按精确 head bdce2d7 重新审查并验证。此前要求修正的显示投影误清理、异常/恢复状态投影和配置污染问题均已解决;本轮进一步将自动 Subagent 结果的 48 KiB 批量预算改为真实硬上限,64 个已完成结果即使父上下文余量为零也保持单批有界,并对异常超长包装增加 fail-closed 总量防线。新增回归覆盖 64-result 公平投影、display/model 双投影上限、超长 metadata,以及 compact/full renderer 的显式配置注入。已合入最新 main,README 冲突已解决。本地 bun run check 通过;专项测试 92/92;全量 Node 1047 passed、1 skipped、0 failed,Vitest 30/30;GitHub Node 22、Node 24、Windows 与 label checks 在该 head 全绿。当前未发现 P0-P2 阻塞,批准合并。
Problem
Direct Subagent completion cards could expand the full child answer in the parent transcript and expose the transport-only instruction intended for the parent model. Batched completions also lacked a coherent compact projection. Related to #174.
Value
Users get a bounded completion summary by default, while the parent model still receives the result it needs to synthesize the next response. The internal transport instruction is no longer rendered as user-facing output.
Approach
Validation
node --test --experimental-strip-types tests/extensions/subagents/index.test.ts tests/extensions/subagents/result-rendering.test.ts tests/extensions/subagents/wait-result.test.ts tests/extensions/suggestions/config.test.ts— 23/23 passed.bun run lint— passed.bun run typecheck— passed with 12 existing Effect diagnostics inextensions/file-search.git diff --check upstream/main...HEAD— passed.bun run check— repository-wide Biome format check is blocked by the existing Windows CRLF baseline; no unrelated line-ending rewrite was included.bun run test— stopped after unrelated Windows Background Terminal kill/taskkill failures and a hang; no failure was observed in the focused Subagent/config tests.Impact
fullvalues remain supported.