Skip to content

fix(subagents): enforce UTF-8 snapshot budgets - #238

Open
smf-h wants to merge 2 commits into
openpi-dev:mainfrom
smf-h:fix/subagents-snapshot-180
Open

fix(subagents): enforce UTF-8 snapshot budgets#238
smf-h wants to merge 2 commits into
openpi-dev:mainfrom
smf-h:fix/subagents-snapshot-180

Conversation

@smf-h

@smf-h smf-h commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

概要

  • 为 subagent snapshot 增加严格的 UTF-8 字节级预算。
  • 对多个 agent 进行公平裁剪,并保留生命周期身份、终态状态、错误信息和恢复所需引用。
  • 在展示投影前持久化精确 terminal result,读取时优先使用 artifact 内容。
  • 保留 raw active tool map,确保 ToolUpdate / ToolEnd 生命周期事件仍可关联。
  • 对 malformed、oversized 和非法 snapshot 输入 fail safely。
  • 增加 UTF-8 边界、公平裁剪、幂等投影、artifact precedence 和 tool lifecycle 回归测试。

验证

  • bun test tests/extensions/subagents/snapshot.test.ts tests/extensions/subagents/manager.test.ts tests/extensions/subagents/index.test.ts
  • bun run lint
  • bun run typecheck

Fixes #180

@smf-h
smf-h force-pushed the fix/subagents-snapshot-180 branch from 535806d to 3eb2568 Compare August 28, 2026 18:07

@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.

P1 Must-Fix:extensions/subagents/src/manager.ts:427-435 的 persistExactResult() 在 settle() 中执行,未处理 writer 错误;生产 persistResultArtifact() 可因权限、symlink、磁盘满或 collision 抛错,导致 settle() 在 notify()/onSettled() 前失败,waiter/result delivery 可能永远收不到终态。请让 artifact cache fail-soft,或保证 settlement 先终态通知再处理缓存失败,并补充 failure-path tests。

P1 Must-Fix:exact-result artifact 没有 retention/aggregate size limit,长期运行会持续积累唯一结果并耗尽 cache volume。请加入 bounded cleanup/retention 及写入/清理失败恢复。

P2 Should-Fix:enforceSnapshotBudget() 将有损 projection 写回 live entry.snapshot,transcript omits 后 takeover UI 无 rehydrate 路径,历史会静默消失。执行 snapshot 与 UI/model projection 应分离,或提供显式 rehydrate/omission 状态。P3:snapshot parsers 当前无生产调用方。静态审查,未运行测试。

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.

subagents: 聚合 snapshot 缺少统一 byte 上限

2 participants