Files
plugins/packages/fovea/cases.json
T
webkubor d4eeba4493 fovea 0.2.2: a new middleware, old history to head and tail on a cache-stable boundary (webkubor, #640)
A new gateway middleware, @magpie-community/middleware-fovea 0.2.2 (webkubor, #640): old tool output and text in a long history are cut to head and tail, with the boundary only on multiples of `cut_step` (24) so the cut prefix stays byte-identical between turns and the prompt cache holds. The leading user items before the first answer (Codex's AGENTS.md, environment_context and the task; Claude Code's first message) stay whole. `saccade` ("off" by default) drops the old context on a new topic, judged against that same task. Old images become a text note that keeps their `cache_control`. Ships an evidence page (Plugins > Fovea evidence) that computes a paste-in A/B in the frame, with no network.

What was run, at the reviewed head b9883cf206814fdc01950a00d413a36856de4e11, on mote (macOS, Bun 1.4.2, sandbox HOME):
- `bun test packages/fovea`: 33 pass, 0 fail. The two new Codex saccade cases fail with 0357f1c's middleware (and pass at the head).
- `bun scripts/check.mjs fovea` and `bun scripts/check.mjs`: pass. `page/measure.js` is byte-identical to a fresh `bun build.mjs`.
- `npm pack --dry-run`: 18 files, 131.8 kB unpacked; no brand/, no live-benchmark.mjs.
- The head merged onto origin/main 82b254f2 (registry.json auto-merged): `bun scripts/check.mjs` passes and `HOME=$(mktemp -d) bun test` (the whole repo, as pr.yml runs it): 5477 pass, 0 fail.
- A probe calling onRequest turn after turn. Codex-shaped Responses (instructions, developer permissions item, AGENTS.md, environment_context, the task as input_text, then reasoning with encrypted_content, function_call and function_call_output, 60 turns) and Claude Code-shaped Messages (system with cache_control, a first message with system-reminder, task and an image with cache_control, then thinking + signature, text, tool_use and a 6400-char tool_result with emoji, 70 turns). `instructions`, `system`, `tools`, every reasoning, function_call and assistant item, ids, counts and the cache_control count are unchanged; the four leading Codex items reach upstream byte-identical; no lone surrogate. The shared prefix breaks once per cut_step (Codex 6 of 60 turns, Messages 5 of 70; 0 without fovea), with `saccade: "auto"` too. With auto, a same-task follow-up on Codex ("scheduler retry timing assertion still fails in internal/sched, fix it") and on Messages collapses nothing; a new topic collapses from that turn on (one extra prefix break). Bodies went 16.1 MB to 9.4 MB (Codex) and 26.1 MB to 13.9 MB (Messages) over the run.
- Text the middleware adds upstream is only `[fovea: N chars of old tool output omitted]` and `[fovea: prior topic not carried]`: neither names magpie, a vendor or a limit. Codex's instructions are never touched.

Not tried: a live vendor request with real cache-hit numbers (the evidence is the byte-level prefix). pr.yml's runs were waiting on approval for a first-time contributor, so the CI record is the merged-tree run above. A new topic that shares a common word such as "the" with the task stays below the 0.08 overlap bar only when it has enough words; with saccade off by default that is a tuning note, not a blocker. @magpie-community/middleware-fovea is new to npm, so its first version needs an owner (trusted publishing can't create a package); magpie serves it from the dist branch meanwhile.
2026-11-04 16:56:37 +08:00

1037 lines
29 KiB
JSON

[
{
"name": "under the threshold the request passes as it came",
"options": {},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "hi"
},
{
"role": "assistant",
"content": "hello"
}
]
}
},
{
"name": "an old Chat tool result is cut to head and tail; ids, tool_calls and the recent window stay",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "read the logs"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "summarize"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "read the logs"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXX\n[fovea: 275 chars of old text omitted]\nXXXXX"
},
{
"role": "user",
"content": "summarize"
}
]
}
},
{
"name": "the first user message is kept whole, an old reply is cut",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "ok"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXX\n[fovea: 275 chars of old text omitted]\nXXXXX"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "an image older than the window becomes a note; a recent image stays",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "we will look at a chart later"
},
{
"role": "assistant",
"content": "ok"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "look"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
}
]
},
{
"role": "assistant",
"content": "seen"
},
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
}
}
]
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "we will look at a chart later"
},
{
"role": "assistant",
"content": "ok"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "look"
},
{
"type": "text",
"text": "[fovea: old image omitted]"
}
]
},
{
"role": "assistant",
"content": "seen"
},
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
}
}
]
}
]
}
},
{
"name": "an old Anthropic tool_result is cut and its image noted; tool_use and system stay whole",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"system": "be brief",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "read it"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "calling"
},
{
"type": "tool_use",
"id": "tu_1",
"name": "read",
"input": {
"path": "a.log"
}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "tu_1",
"content": [
{
"type": "text",
"text": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"type": "image",
"source": {
"type": "base64",
"data": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
}
}
]
},
{
"type": "text",
"text": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
]
},
{
"role": "user",
"content": "go on"
}
]
},
"expect_request": {
"model": "m",
"system": "be brief",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "read it"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "calling"
},
{
"type": "tool_use",
"id": "tu_1",
"name": "read",
"input": {
"path": "a.log"
}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "tu_1",
"content": [
{
"type": "text",
"text": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"type": "text",
"text": "[fovea: old image omitted]"
}
]
},
{
"type": "text",
"text": "XXXXXXXXXXXXXXXXXXXX\n[fovea: 275 chars of old text omitted]\nXXXXX"
}
]
},
{
"role": "user",
"content": "go on"
}
]
}
},
{
"name": "content already carrying the marker is left alone",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "a history inside the window is untouched",
"options": {
"threshold": 0,
"keep_recent": 5,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "null content, empty tool output and tool_calls pass unchanged",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "c",
"type": "function",
"function": {
"name": "f",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "c",
"content": ""
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "system messages are never touched",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "system",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "task"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "ok"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "system",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "task"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXX\n[fovea: 275 chars of old text omitted]\nXXXXX"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "a token budget keeps few but large recent messages whole",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 150,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "user",
"content": "ok"
},
{
"role": "assistant",
"content": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"role": "user",
"content": "final"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"role": "user",
"content": "ok"
},
{
"role": "assistant",
"content": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"role": "user",
"content": "final"
}
]
}
},
{
"name": "a protect pattern keeps a matching tool result whole",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"protect": [
"^diff --git "
],
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "diff --git a/x b/x\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "a Responses API function_call_output is cut, call_id and function_call stay",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"cut_step": 1
},
"request": {
"model": "m",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "read it"
}
]
},
{
"type": "function_call",
"call_id": "c1",
"name": "read",
"arguments": "{}"
},
{
"type": "function_call_output",
"call_id": "c1",
"output": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "final"
}
]
}
]
},
"expect_request": {
"model": "m",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "read it"
}
]
},
{
"type": "function_call",
"call_id": "c1",
"name": "read",
"arguments": "{}"
},
{
"type": "function_call_output",
"call_id": "c1",
"output": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "final"
}
]
}
]
}
},
{
"name": "an invalid protect pattern is ignored, the rest still cuts",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"protect": [
"(["
],
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "user",
"content": "ok"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "task"
},
{
"role": "tool",
"tool_call_id": "c",
"content": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"role": "user",
"content": "ok"
}
]
}
},
{
"name": "saccade always: old tool output and old text collapse to one note; short ack, ids, tool_calls and the window stay",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"saccade": "always",
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad and check the dns records afterwards please"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "what next"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad and check the dns records afterwards please"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "[fovea: prior topic not carried]"
},
{
"role": "assistant",
"content": "[fovea: prior topic not carried]"
},
{
"role": "user",
"content": "what next"
}
]
}
},
{
"name": "saccade auto: a new topic in the newest question drops the old context; tool pairing survives as notes",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"saccade": "auto",
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "推荐三道家常菜的做法 番茄炒蛋 蛋炒饭 紫菜汤"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "[fovea: prior topic not carried]"
},
{
"role": "assistant",
"content": "[fovea: prior topic not carried]"
},
{
"role": "user",
"content": "推荐三道家常菜的做法 番茄炒蛋 蛋炒饭 紫菜汤"
}
]
}
},
{
"name": "saccade auto: a related question keeps the default head-and-tail thinning",
"options": {
"threshold": 0,
"keep_recent": 1,
"keep_recent_tokens": 0,
"tool_head": 10,
"tool_tail": 5,
"text_head": 20,
"text_tail": 5,
"saccade": "auto",
"cut_step": 1
},
"request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
{
"role": "user",
"content": "terraform stack fly io region iad dns records check please"
}
]
},
"expect_request": {
"model": "m",
"messages": [
{
"role": "user",
"content": "deploy the terraform stack to fly io region iad"
},
{
"role": "assistant",
"content": "reading",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "read",
"arguments": "{}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "LLLLLLLLLL\n[fovea: 285 chars of old tool output omitted]\nLLLLL"
},
{
"role": "assistant",
"content": "XXXXXXXXXXXXXXXXXXXX\n[fovea: 175 chars of old text omitted]\nXXXXX"
},
{
"role": "user",
"content": "terraform stack fly io region iad dns records check please"
}
]
}
}
]