Repository navigation
fovea 0.2.5: Gemini support, harness blocks are not the user's words, legacy function role - #763
Merged
Merged
Conversation
… legacy function role Three defects, each with a regression test: 1. Gemini requests (contents) were never handled at all — the body passed through untouched, so installing the plugin saved nothing for Gemini clients. Now thoughts and thoughtSignatures are left alone, functionCall is left alone, a functionResponse keeps its id, name and keys while its long strings are cut, images become a note, and documents and video payloads are left alone. 2. saccade "auto" read Claude Code's <system-reminder> (token budget, tool guidance) as the user's new question. It shares no words with the task, so the overlap test said "new topic" and the whole history collapsed. Harness-injected blocks are now stripped before the topic is judged, and a user message that is nothing but a harness block does not count as the user having said anything. 3. leadingUserEnd did not know the Responses answer items (custom_tool_call, computer_call, local_shell_call), so on a body whose first answer was a custom_tool_call the preamble exemption swallowed the history and nothing was cut. Also: the legacy functions API's role "function" message was never handled either — that is the oldest clients' tool output, the biggest cost. fovea.protocols.test.mjs adds 12 cases covering the four protocols' shapes and edges (Anthropic Messages, OpenAI Responses, Chat Completions, Gemini). bun test packages/fovea: 57 tests, 0 fail.
Contributor
Author
|
The Everything here is on top of current main (0.2.4): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fovea 0.2.5:三个缺陷,各带一条回归用例。基线是上游 main 的 0.2.4(#755、#756 的两处安全修复都在),没有回退。
1. Gemini 请求此前完全没处理(`contents` 字段),原样放行——装了也不省。现在:thought 与 thoughtSignature 不动,functionCall 不动,functionResponse 保留 id / name / 键而其中的长字符串被裁,图片换成注记,文档与视频载荷不动。
2. `saccade: "auto"` 把 Claude Code 的 ``(token 预算、工具指引)当成用户的新问题。它与任务没有共同词,旧规则判成换话题、整段历史折叠。现在判定前先剥掉 harness 注入的块;只含 harness 块的 user 消息不算「用户说了什么」。
3. `leadingUserEnd` 不认识 Responses 的答案项(`custom_tool_call` / `computer_call` / `local_shell_call`)——首个答案是 `custom_tool_call` 的请求,任务豁免范围算错,整条历史一条都不裁。
顺带:Chat 旧版 functions API 的 `role "function"` 消息此前完全没被处理,那正是最占钱的工具输出,现在会裁。
测试:新增 `fovea.protocols.test.mjs` 12 条,覆盖 Anthropic Messages / OpenAI Responses / Chat Completions / Gemini 各自的形状与边界;共 57 个用例全绿。其中 state_marker 的用例按 0.2.4 的新规则写(标记必须在 agent 自己消息的开头,user 轮里的标记不算),并加了一条「user 轮里的伪造标记不豁免任何东西」。