Skip to content

fix(subagents): separate result display projection - #240

Merged
tt-a1i merged 5 commits into
openpi-dev:mainfrom
627150795:fix/issue-174-subagent-result-projection
Aug 30, 2026
Merged

fix(subagents): separate result display projection#240
tt-a1i merged 5 commits into
openpi-dev:mainfrom
627150795:fix/issue-174-subagent-result-projection

Conversation

@627150795

Copy link
Copy Markdown
Contributor

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

  • Split the model-facing result payload from the user-visible display projection.
  • Default Subagent results to compact status rows; keep full output available through expansion and preserve the explicit full setting.
  • Include elapsed time for automatic and explicit waits, sanitize display metadata, and bound narrow-terminal rows.
  • Strip the transport instruction from legacy persisted result content when rendering.
  • Preserve result artifacts, delivery identity, at-least-once retry, and consumed-watermark behavior.

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 in extensions/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

  • User-visible: completion cards are compact by default and expandable; full mode remains configurable.
  • Model-visible: the complete existing result plus transport instruction remains in the hidden follow-up payload.
  • Runtime/lifecycle: no delivery, retry, artifact, or watermark semantics changed.
  • Persisted config/data: the default Subagent display is now compact; explicit saved full values remain supported.
  • Compatibility/risk: legacy result entries are rendered without the transport-only suffix; existing Windows repository-wide formatting/process-test baselines remain.

@627150795

Copy link
Copy Markdown
Contributor Author

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.

@627150795

Copy link
Copy Markdown
Contributor Author

补充代码审计结果:已加入 transport 后缀误删和单结果 artifact 失败不可见的回归修复。相关针对性测试 15/15,lint/typecheck 通过;远端 PR 文件内容已校正为精确提交字节,避免换行噪声。

@627150795

Copy link
Copy Markdown
Contributor Author

代码有效性复核:

  • focused Subagent tests:27/27 passed
  • bun run typecheck:passed
  • bun run lint:passed
  • git diff --check:passed
  • 未发现本轮新增的运行行为回归;artifact 写入失败、批量结果投影、展开/折叠展示和 legacy transport 清理均有覆盖。

当前 PR 仍为 OPEN、MERGEABLE;REVIEW_REQUIRED / BLOCKED 表示等待维护者 review 与工作流批准,不代表代码失败。

@627150795

Copy link
Copy Markdown
Contributor Author

代码审计后补充了一处实际运行路径修复:

自动完成投递原先仍调用旧的字符串投影函数,真实 artifact 保存失败时不会把失败状态带到结果详情;现在已改为调用结构化投影函数,并加入真实不可写 artifact 目录的回归测试。

验证:

  • Subagent focused tests:28/28 通过
  • bun run typecheck:通过
  • bun run lint:通过
  • git diff --check:通过

远程 PR 最新提交:f2796e7。当前仍为 OPEN、MERGEABLE;REVIEW_REQUIRED / BLOCKED 仍是等待维护者 review 与工作流授权。

@627150795

Copy link
Copy Markdown
Contributor Author

代码有效性审计结论:PR #240 的核心目标在当前远程提交 f2796e7 上有效:模型收到完整 transport payload,用户界面收到有界 display projection,legacy transport suffix 会被清理,compact/full 设置和 artifact-save failure metadata 均走真实 renderer/delivery 路径。正式 Node 定向测试 28/28、lint、typecheck 通过;未发现需要追加的核心运行时修复。Session 重载、watermark/retry 的完整端到端覆盖仍属于测试增强项,不是本次审计发现的行为失败。

@627150795
627150795 force-pushed the fix/issue-174-subagent-result-projection branch 4 times, most recently from 92b2efa to b21c12c Compare August 29, 2026 12:10
somewan820
somewan820 previously approved these changes Aug 29, 2026

@somewan820 somewan820 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

已完成静态审查。结果展示投影与 model transport payload 分离,legacy transport suffix 清理、compact/full rendering、artifact failure 显示及终端宽度限制均有对应测试;未发现 P0-P2 或死代码问题。P3:建议后续补充真实 TUI/IME 终端集成覆盖。未运行测试。

@somewan820
somewan820 force-pushed the fix/issue-174-subagent-result-projection branch 2 times, most recently from edb7e94 to 95d43a6 Compare August 29, 2026 12:46
Comment thread extensions/subagents/index.ts Outdated
theme: SubagentResultTheme,
) {
const displayContent = sanitizeText(
stripSubagentResultTransportInstruction(details.displayContent ?? content),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[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 },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] 这个用例假设 renderer 为 compact,却没有显式设置 compact 配置或隔离 PI_CODING_AGENT_DIR。在合法的 persisted subagentResultDisplay: full 用户配置下,用例实际走 full renderer,并因找不到 artifact not saved 而失败;我在 merge-state 上已复现,换成空临时 agent dir 后才通过。请让测试注入/隔离所需配置,避免用户本机状态决定测试结果。

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

已按精确 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.
@627150795
627150795 force-pushed the fix/issue-174-subagent-result-projection branch from 75ecc15 to 200fa4a Compare August 30, 2026 03:59
@github-actions github-actions Bot added documentation Improvements or additions to documentation area:subagents Subagent delegation, skills, or tests area:setup OpenPI setup, configuration, or setup documentation labels Aug 30, 2026

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

已按精确 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 阻塞,批准合并。

@tt-a1i
tt-a1i merged commit 7cd2c99 into openpi-dev:main Aug 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:setup OpenPI setup, configuration, or setup documentation area:subagents Subagent delegation, skills, or tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants