Skip to content

A local plugin for image-heavy chats in Codex, Claude Code and other agents: earlier images stop going out with every message, and the model fetches the one it needs by its ID, also after compaction.

docs(v0.7): 实测结果和 0.7.0 的更新说明

chipfighterc971b9c9d099
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 341dea7..8532b03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,27 @@
When a version is released, its section here becomes the GitHub release notes.
+## [0.7.0] - Unreleased
+
+Subagents and side chats in Codex follow Auto-select too.
+
+### Features
+
+- Side chats no longer resend the task's images. A side chat you open in a Codex task carries the task's whole history, images included; it now goes out with those images as placeholders, except the ones you pinned, and when an answer needs one, the model fetches it from the task by ID. Reported in [#2](https://github.com/chipfighter/context-attachment-manager/issues/2), where a text-only question in a side chat carried 39 images (48.75 MB) and failed with `Broken pipe`.
+- Subagents the model starts without the task's history leave out the images of their own earlier turns and fetch the ones they need by ID. The same goes for subagents they start.
+- The task's panel lists its subagents and side chats once they have sent a request: folded to one line with how many there are, what their last requests saved, and an *Auto-select too* switch, on by default, also in tasks from before 0.7. Unfold it to see each one's name, rule and last request. Switched off, their requests go out as they are.
+- Subagents started with the task's history follow the task's checks, as before. Claude Code works as in 0.6.0.
+
+### Fixes
+
+- A task forked in Codex could lose the checks it takes over from the original task when its first request came while Codex was still writing the task's record.
+
+### Notes
+
+- Tested on Windows with the app-server of Codex 0.162 (the one Codex Desktop ships) and GPT-6 Sol, Luna and Astra at low effort. A side chat left out the task's two images, answered a text-only question without them, and fetched one back from the task to read a digit in its corner. A subagent's second turn left out the image of its first turn and fetched it back. With the switch off, both went out as they were. The panel listed each side chat and subagent with the right numbers. GPT-6 Luna's subagent once couldn't find the image file it was told about, and once Luna didn't start a subagent at all; that is the model, and the next try worked.
+- Codex doesn't document side chats and subagents for plugins: the plugin recognizes them from what Codex sends with each request. If that changes, they go out as they did before 0.7, and the task itself is not affected.
+- Images a subagent reads during one long turn all stay in that turn, as Auto-select keeps the current turn's images; they are left out from its next turn on.
+
## [0.6.0] - 2026-10-13
Auto-select on by default, and the panel opens by itself in Claude Desktop.
diff --git a/docs/v0.7/plan.md b/docs/v0.7/plan.md
index e2b16a2..8a63331 100644
--- a/docs/v0.7/plan.md
+++ b/docs/v0.7/plan.md
@@ -46,10 +46,26 @@
## 5. 测试
- 单元测试:请求来源的识别;子代理找到主任务(多层、带历史的不算、用户自己的任务不算);开关开和关时子代理、旁聊的选择;旁聊的请求按原任务改写、开关关着时原样;旁聊取图;登记和面板的列表;面板文字中英文一一对应。
-- Codex 自测(`spike/src/v07-children-selftest.ts`,测试引擎 + 测试 app-server,`gpt-6-sol`,推理强度 low):
+- Codex 自测(`spike/src/v07-children-selftest.ts`,测试引擎 + 测试 app-server,推理强度 low):
- 旁聊:主任务看过图之后开旁聊,问一句文字问题,图都换成占位;再问图里的细节,模型取回原任务的图并答对。
- - 子代理:子代理第一轮看图,第二轮请求里那张图换成占位;问细节时模型取回并答对。
+ - 子代理:子代理第一轮看图,第二轮请求里那张图换成占位;问细节时模型取回并答对。第二轮由主任务用 `followup_task` 发起:app-server 不接受直接给 multi_agent_v2 子代理开新的一轮。
- 开关关掉:旁聊和子代理的请求原样发。
+ - 每个任务最后看面板列出的子代理和旁聊。
+- 面板:用户 2026-10-13 看过截图(收起、展开,开关开和关,中英文),同意。
+
+结果(2026-10-14,测试引擎,本机 Codex 桌面版自带的 `codex-cli 0.162.0-alpha.2`;每次 13 项检查):
+
+1. 单元测试 206 个全部通过;插件冒烟测试(Codex 自己的命令行装插件、开任务)通过。
+2. gpt-6-sol 中文、英文和 gpt-6-astra 中文:13 项全部通过。
+ - 旁聊:两张图都换成占位;问文字问题时不取图;问角落数字时从原任务取回 a.png,答对 7。
+ - 子代理:第二轮请求里它第一轮看的图换成了占位,取回后答对 7。
+ - 开关关掉:旁聊走 WebSocket 原样发出;子代理的请求不改写,带着它看过的原图。
+ - 面板:每个任务都列出了旁聊和子代理(子代理按 Codex 给的名字,如 Hooke、Galileo),规则和统计对得上。
+3. sol 英文第一次跑时,旁聊取图那一轮的上游连接在 62 秒后中断,这一轮一直没结束,等到 20 分钟超时。同时还有连不上模型列表的超时,按网络问题处理,重跑通过。
+4. gpt-6-luna 中文:旁聊和开关关掉的各项通过。子代理那组第三次才测成:第一次 luna 的子代理找不到“当前目录下的 a.png”,第一轮没看图(所以脚本改成给完整路径);第二次主任务的 luna 说没有 spawn_agent 工具,自己去看了图。第三次 5 项全部通过。
+5. 另跑的一次 sol 中文 12 项通过。没过的那项是开关关掉的那组:子代理一直没看那张图(它的 7 个请求都没有图),只按主任务转给它的说法要 IMG-001;它的请求一个都没被改写,取图也因为没开自动选图被拒绝,和开关关掉时应有的一样。
+6. 测出并修好的问题:子代理的第一个请求比它的会话记录写好还早约 40 毫秒(引擎 16:03:32.319 收到请求,记录的第一条写于 32.358)。原来读到空文件就把“不是子代理”缓存下来,于是子代理不登记、开关关掉时它照样被改写;分叉任务的来源有同样的隐患。改成读到第一行才缓存,加了复现测试。
+7. 测试环境的问题:测试用的 app-server 用的是用户真实的 Codex 配置,里面装着 0.6.0 版插件,模型在旁聊里第一次取图有时调到它,旧版不认识旁聊,调用失败,第二次才调到测试的插件服务。现在自测把已安装的插件关掉,重跑旁聊那组,第一次取图就成功。
## 6. 验收
diff --git a/spike/src/v07-children-selftest.ts b/spike/src/v07-children-selftest.ts
index f52b6d7..686e7b9 100644
--- a/spike/src/v07-children-selftest.ts
+++ b/spike/src/v07-children-selftest.ts
@@ -73,7 +73,9 @@ async function main(): Promise<void> {
const engine = spawn(process.execPath, [join(here, "..", "..", "plugin", "src", "proxy.ts"), "--port", String(port), "--stay"], { env: { ...process.env, CAM_DATA_DIR: data }, stdio: "ignore", windowsHide: true });
for (let i = 0; i < 50 && !(await engineHealth(port)); i++) await sleep(200);
- const off = ["computer-use@openai-bundled", "unified-computer-use@openai-bundled", "chrome@openai-bundled", "browser@openai-bundled", "codex-app-tools@openai-bundled"]
+ // The plugin installed in the user's Codex too: its cam_view_image is another copy of the tool, and an older one may
+ // not know side chats (the model's first fetch in a side chat went there and failed, 2026-10-14).
+ const off = ["computer-use@openai-bundled", "unified-computer-use@openai-bundled", "chrome@openai-bundled", "browser@openai-bundled", "codex-app-tools@openai-bundled", "codex-attachment-manager@codex-attachment-manager"]
.flatMap((plugin) => ["-c", `plugins.${plugin}.enabled=false`]);
const env = { CODEX_HOME: codexHome(), CAM_DATA_DIR: data, CAM_NO_ENGINE: "1" };
const plugin = [