Skip to content

v0.6.5 - More Codex Incremental Hits and Antigravity Requests Without Whole-Payload Rewrites

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Nov 15:56
1c3d76f

v0.6.5 - More Codex Incremental Hits and Antigravity Requests Without Whole-Payload Rewrites

Highlights

1. Codex incremental uploads match re-encoded tool arguments (#1321)

The Codex upstream incremental mode added in v0.6.4 sends only the new turn items over a pinned upstream WebSocket when a client's history extends its previous turn. Its largest miss reason was echoed_output_mismatch: gateways such as magpie re-encode custom-tool arguments with Go's json.Marshal, which escapes <, > and &. An apply_patch call containing any of those characters then no longer matched byte for byte, and the turn went out in full.

Tool-call arguments are now compared by JSON value. Whitespace between tokens and string escapes no longer count; key order, duplicate keys, number literals and every string's characters still do, so a real difference is never taken for a hit. The matcher also stops copying each input item out of the request body, which removes one extra copy of every request while it is being matched.

2. Each Codex thread keeps its own incremental chain (#1322)

Codex runs a session's root thread and its sub-agents under one session id and one prompt cache key, so they shared one conversation key and pushed each other's chains out (a key keeps at most three). Sub-agent turns hit only 66% of the time, a quarter of them missing on the prefix. The conversation key now tells the threads of a session apart, so each thread continues from its own previous turn.

3. Antigravity requests are cleaned without rewriting the whole payload (#1323)

AntigravityExecutor.buildRequest renamed parametersJsonSchema and ran the JSON-schema cleanup over the whole Antigravity payload, rewriting it, screenshots included, once per edit. It was the relay's largest allocator in production heap profiles. The cleanup now scans the payload once and edits only the schema sites, keeping the rest of the body byte for byte; a payload the scoped path cannot vouch for falls back to the previous code.

On a 5.4 MB request with five 1 MB screenshots, 30 tool turns and forty tool schemas, building the request went from 8.5 s to about 0.1 s, and from about 25 GB to under 0.2 GB allocated.

4. Antigravity no longer rewrites replayed tool calls as schemas (#1324)

The cleanup matched keys by name across the whole payload, so the function calls and responses replayed in request.contents were rewritten as if they were schemas. A Grep call's pattern was moved into a description, arguments holding $ref were replaced outright, and the model was shown tool calls it never made. A parametersJsonSchema nested inside another could even empty the whole payload. The cleanup now touches only the parameter and response schemas the request declares under request.tools.

Detailed Changes

Backend CliRelay

  • fix(codex): match re-encoded tool arguments and stop copying the body in the incremental matcher (#1321)
  • fix(codex): keep each Codex thread on its own incremental line (#1322)
  • perf(antigravity): clean request schemas without rewriting the whole payload (#1323)
  • fix(antigravity): clean only the schemas a request declares (#1324)

Upgrade Notes

  • No configuration changes are needed.
  • codex-upstream-incremental still defaults to off. shadow only compares and logs; on sends increments over a pinned upstream WebSocket and falls back to a full request whenever anything does not line up. allow-keys limits on to the listed downstream keys (sha256:<hex>). See config.example.yaml.
  • Deployments already running on get more hits after upgrading, with nothing to change.

Binaries for six platforms and the GHCR image ghcr.io/kittors/clirelay:v0.6.5 are published with this release. It ships the backend only; the panel stays at codeProxy v0.7.3.

中文说明(点击展开)

v0.6.5 - Codex 增量命中率更高,Antigravity 请求不再整份重写

重点

1. Codex 增量上传能识别被重新编码的工具参数(#1321)

v0.6.4 加入的 Codex 上游增量模式,会在客户端历史正好接着上一轮时,只把新增的条目经钉住的上游 WebSocket 发出去。它最大的未命中原因是 echoed_output_mismatch:magpie 这类网关会用 Go 的 json.Marshal 重新编码自定义工具的参数,把 <、>、& 转义掉。含这几个字符的 apply_patch 调用因此不再逐字节一致,这一轮只能整份发出。

现在工具调用参数按 JSON 值比对:词元之间的空白和字符串转义不再算差异,键的顺序、重复键、数字写法和每个字符串的字符照旧要一致,真正不同的内容不会被当成命中。比对时也不再把每个输入条目从请求体里复制一份,比对期间每个请求少占一份内存。

2. 每个 Codex 线程各走自己的增量链(#1322)

Codex 会把一个会话的主线程和子智能体放在同一个会话 id、同一个 prompt cache key 下,它们因此共用一个会话键,互相把对方的链挤掉(每个键最多保留三条)。子智能体的轮次只有 66% 命中,四分之一败在前缀对不上。现在会话键能区分同一会话里的不同线程,每个线程都从自己的上一轮续接。

3. Antigravity 请求清理不再整份重写(#1323)

AntigravityExecutor.buildRequest 原来会在整个 Antigravity 请求上改名 parametersJsonSchema 并做 JSON schema 清理,每改一处就把整份请求(连截图在内)重写一遍,是线上堆剖析里分配最多的地方。现在只扫描一遍请求,只改 schema 所在的位置,其余部分逐字节保留;新路径无法确认安全的请求,退回原来的代码。

在一个 5.4 MB、带五张 1 MB 截图、30 轮工具调用和四十个工具 schema 的请求上,构造请求从 8.5 秒降到约 0.1 秒,内存分配从约 25 GB 降到不到 0.2 GB。

4. Antigravity 不再把回放的工具调用当成 schema 改写(#1324)

原来的清理按键名在整个请求里匹配,request.contents 里回放的函数调用和函数结果也被当成 schema 改写:Grep 调用的 pattern 被挪进了 description,带 $ref 的参数被整个替换,模型看到的是它从没发出过的工具调用;parametersJsonSchema 嵌套在另一个里面时,甚至会把整个请求清空。现在只清理请求在 request.tools 下声明的参数和返回值 schema。

详细改动

后端 CliRelay

  • fix(codex):增量比对识别被重新编码的工具参数,并且不再复制请求体(#1321)
  • fix(codex):每个 Codex 线程各走自己的增量链(#1322)
  • perf(antigravity):清理请求 schema 时不再整份重写请求(#1323)
  • fix(antigravity):只清理请求声明的 schema(#1324)

升级说明

  • 不需要改任何配置。
  • codex-upstream-incremental 默认仍是 off。shadow 只比对、记录统计;on 经钉住的上游 WebSocket 只发增量,任何一处对不上都退回整份发送。allow-keys 可以把 on 限定在指定的下游 key 上(写成 sha256:<hex>)。详见 config.example.yaml。
  • 已经开了 on 的部署,升级后命中率会更高,什么都不用改。

本次发布了六个平台的二进制和 GHCR 镜像 ghcr.io/kittors/clirelay:v0.6.5。这次只发后端,面板仍是 codeProxy v0.7.3。