assistant 只带图片的回合在编码前被整条丢弃 — 默认路径静默丢图,修复待上游接受度实测
src/devin-connect.js:1092 的空回合过滤器只看文本与 tool_calls,不看图片与 reasoning:
if (msg.role === 'assistant' && messageText(msg.content).trim() === '' && !msg.tool_calls?.length) {
continue;
}
messageText() 对数组只取 text part,所以 content 为 image-only 的 assistant 回合在这里被整条跳过 —— 它的图片永远不会走到 extractInlineImages()(fallback 分支),也不会出现在 #10。
复现(本机实测,0c35545)
- 直达入口:
POST /v1/chat/completions,messages 为[{role:'assistant',content:[{type:'image_url',…}]}, {role:'user',content:'continue'}](末尾 user 是共享 handler 的要求)。 - 协议入口:Gemini 的
role:"model"+inlineData会被geminiToOpenAI转成 image-only assistant(同样不要求同时有 text)。
wire 结果(自建 walker 读每帧 #2/#10):
| 输入 | 结果 |
|---|---|
| image-only assistant + user,默认设置 | 只有 user(roles [1]),无 #10 —— 该回合从 wire 上消失 |
| reasoning-only assistant(replay 开) | 已修:[2,1],reasoning 进 #11(e0143fd) |
为什么没有顺手修
图片发射(DEVIN_CONNECT_IMAGE_TAG 默认 10)默认开着,放行 image-only 回合 = 默认 wire 变化;上游对「assistant 回合携带图片」的接受度没有实测过。用一个未验证的行为换一个静默丢图,不符合「默认路径逐字节不变」的取舍。
需要的数据(最小对照)
同一段历史两份,只把 image part 从 user 回合挪到 assistant 回合:
- A:
[user(image+text), user:'continue'] - B:
[user:text, assistant(image), user:'continue']
固定账号 / 模型 / flags,记录 roles、#10 数量与内层 base64_data/mime_type,以及完整终止帧。B 若被接受即可放行;若被拒,把拒绝码记进注释后关掉本项。
现状守卫
test/wire-h1-empty-assistant.test.js 的 T4 与 test/mutations/wire-h1-empty-assistant.json 的 M5 现在锁住「未获批不得放行」。获批修的时候这两处必须一起替换(把锁换成行为断言),不要留下一个永远阻止修复的测试。
We reproduced the drop and then tested whether removing it would help. It would not.
A/B on a paid account: an image on a user turn reaches the wire (proto field #10) and the model answers "Checkerboard." An image-only assistant turn is dropped before encoding exactly as reported (wire 1453 -> 1240 B, no #10). We then forced the same image onto an assistant turn anyway: the wire carried #10 on role=2, but the model still reported no image, while the paired user-role control returned "Checkerboard". Same result on Anthropic and Gemini.
So the filter is not the only problem: the upstream ignores images on assistant-role messages. Relaxing the filter would add discarded bytes and no capability. The drop stays and is now documented as an upstream limitation rather than a silent bug; if a future upstream starts accepting assistant-role images, the filter is the single place to change. Leaving this open for the record; reopen/close is a maintainer call.
Closing the loop on this one: the drop is documented as an upstream limitation, and v3.10.0 did not change the filter — by intent.
The 2026-10-21 A/B on a paid account settled the mechanism: an image on a user turn reaches the wire (proto field #10) and the model answers; the same image forced onto an assistant turn is carried on the wire but ignored by the model on both Anthropic and Gemini. So relaxing the filter adds discarded bytes, no capability. The filter stays at src/devin-connect.js:1557 with the boundary pinned by test/wire-h1-empty-assistant.test.js (H1-T4) and mutation H1-M5 — re-ran on the v3.10.0 tag, 6/6 green.
If a future upstream starts accepting assistant-role images, the filter is the single place to change and the pinning tests swap to behavior assertions. Closing as an upstream limitation; the record stays here.