Frozen state: store edits to earlier array elements as changes, not whole arrays

未关闭
#5,320 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
backend

调研方向

Start by reading the diffState implementation and the state operation readers and writers; the issue names no file or test paths. Compare how array prefix appends and whole-array set operations are encoded, then check existing tests for frozen state diffs. Done means earlier element edits can be stored with tail appends or truncations, with a compatible rollout that ships readers before writers.

由索引模型根据 Issue 内容生成。

描述

Follow-up from review of #5214 / #5215.

Frozen state is stored as a change from the version it was made from (diffState). Arrays are diffed as append only when the old array is a prefix of the new one. Any other change, such as editing an earlier element and then appending, pop(), or splice(), writes the whole array as one set.

Agent loops hit this often: they fill in a tool result on the last assistant message, then append the next one. Measured on a 200-message history, editing the last message and appending one produced 6,566 B of ops, against 6,536 B for the whole value, so no saving at all.

Possible approaches:

  • per-index set ops for changed elements (by identity, which is cheap for frozen values), plus append for the tail;
  • a truncate op for pop() / splice() at the end;
  • falling back to set only when the index ops outgrow the array.

The stored format would need a new op kind, so readers must ship before writers use it.

🤖 Generated with Claude Code

主要语言
TypeScript
星标
2.5k
派生
401
平均合并
1 天 21 小时
30 天内合并 PR
201

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vercel/workflow 的其他 Issue

查看 vercel/workflow 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。