Skip to content

fix(subagents): preserve recoverable long results - #89

Merged
tt-a1i merged 2 commits into
mainfrom
codex/subagent-result-artifacts
Aug 23, 2026
Merged

fix(subagents): preserve recoverable long results#89
tt-a1i merged 2 commits into
mainfrom
codex/subagent-result-artifacts

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace head-only subagent result truncation with one shared head+tail projection
  • persist the exact over-budget finalText as a private, content-addressed plain-text artifact below Pi's cache
  • tell the parent how to page the omitted middle with Pi's native read, without adding another OpenPI tool
  • fail closed when artifact persistence is unavailable or encounters a symlink/collision
  • update the subagent design document and cover bytes, lines, UTF-8, reuse, failure, and filesystem safety

Closes #64.

Design evidence

Issue #64 contains the full OpenPI/Codex/Hermes comparison and rejected alternatives. The resulting boundary is:

short finalText -> byte-identical delivery, no artifact
long finalText  -> bounded head + tail in context
                -> exact final answer in Pi cache
                -> on-demand recovery through Pi read

No model-facing tool or capability group changes.

Verification

  • focused subagent/result tests: 22 pass, 0 fail
  • bun run test: 832 Node + 30 Vitest pass, 0 fail
  • bun run lint: pass
  • bun run typecheck: pass (pre-existing Effect advisory warnings only)
  • changed files pass Biome and git diff --check

bun run check still reports one unrelated pre-existing formatting difference in the uncommitted user-owned extensions/sessions/index.ts; this PR does not touch or include that file.

@tt-a1i

tt-a1i commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

补充动态预算实现与验证证据(commit 3417cab):

  • 借鉴 Hermes 的“按父会话剩余上下文分配批次预算”,但保留 OpenPI 的 75/25 头尾投影与 exact artifact。
  • 使用 Pi getContextUsage(),有效读数时取剩余 headroom 的 50%;未知时回退原静态上限。
  • 修正完整投影硬上限,包装文字和 artifact 恢复说明也计入预算。
  • 专项 26/26;全量 Node 844/844 + Vitest 30/30;lint/typecheck 通过。
  • DeepSeek 0731 四子代理烟测:wait 48,773 bytes < 48 KiB,4/4 头尾、4/4 artifact,artifact 0600 且内容哈希一致。

bun run check 唯一阻塞是未纳入本 PR 的用户既有 extensions/sessions/index.ts 格式差异。

@tt-a1i
tt-a1i merged commit 494f74f into main Aug 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

子代理超长结果:保留首尾、持久化完整 final artifact,并支持按需恢复

1 participant