makecindy / makecindy/cindy

长视觉任务的历史图片撑破 Worker 代理 32 MiB 上限并连续触发 413

Open
#3,570 2 comments 0 reactions 0 assignees View on GitHub
bug done
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: juju
**客户端版本**: 0.1.66

---

## 现象

长时间视觉任务中,Agent / Worker 连续查看多轮渲染图后,请求历史里的图片字节持续累积。单次请求超过 Cindy 本地 `anthropic-compat-proxy` 的 32 MiB 上限后返回 413,当前 Worker 无法继续;新建干净 Worker 后,经过少量图片轮次又会复现。用户被迫反复更换任务/会话才能继续工作。

用户同意公开的脱敏错误摘要:

- 第一次:请求体约 35.6 MB,超过 33,554,432 bytes
- 第二次:请求体约 33.7 MB,超过 33,554,432 bytes
- 错误类型:`proxy_error` / `request body too large`

不涉及用户业务内容、会话标题、账号或本地路径。

## 复现步骤

1. 在一个长时间视觉任务中启动 Agent 或 Worker。
2. 让 Worker 连续生成、渲染或查看多轮较大的图片,并在每轮后继续处理。
3. 保持同一原生会话继续发送消息或工具调用。
4. 当历史图片使单次请求体超过 32 MiB 时,观察本地代理返回 413。
5. 新建一个干净 Worker,重复数轮图片检查;请求体再次接近 32 MiB 后稳定复现。

## 期望行为

- 历史图片保留在媒体仓供 UI 回看,但不应每轮都以原始内联字节重新进入模型请求。
- Cindy 应对模型侧图片建立有界工作集:压缩、去重,并淘汰已消费的历史 tool-result 图片。
- 接近传输预算时应在同一个用户任务中自动压缩或轻量重建原生会话,不能要求用户反复新建任务。
- 即使无法压缩,也应给出可恢复路径,而不是让 Worker 直接终止。

## 实际行为

- 历史图片随会话请求累积,单次请求最终超过本地代理 32 MiB。
- 413 在模型看到请求之前发生,Agent 无法自行调整或重试。
- 同一个视觉任务连续两个干净 Worker 都因相同原因终止。
- 用户需要换三四个任务/会话才能避开卡顿和 413。

## 复现频率

同一视觉任务中连续两次复现;当图片历史达到阈值后,后续请求会持续失败。

## 已尝试

- 新建干净 Worker:短期恢复,但数轮图片后再次 413。
- 人工要求只使用压缩缩略图:依赖 Agent 自律,不能保证所有工具输出和历史重放链路都遵守,不能作为产品级修复。
- 反复切换任务/会话:可绕开,但用户体验不可接受。

## 源码线索

- `packages/anthropic-compat-proxy/src/server.ts` 的默认请求体上限为 32 MiB。
- `apps/desktop/src/main/maker-host/codex-proxy-host.ts` 已为 Codex 通道显式设置 128 MiB。
- `apps/desktop/src/main/maker-host/anthropic-compat-proxy-host.ts` 创建共享 Claude / Worker 代理时未覆盖该上限。
- 现有 Codex rollout 图片清洗主要用于历史过大后的 fork/relink,未覆盖共享 Claude / Worker 代理在 32 MiB 接收门槛前直接 413 的情况。

## 建议修复

1. 止血:为共享 Claude / Worker 代理设置足够大的内部接收上限,使请求能够进入清理 transform。
2. 根治:发送前按字节预算处理图片,保留最新必要工作图;对历史 tool-result 图片去重、缩图或替换为轻量占位,原字节继续由媒体仓托管。
3. 兜底:缩减后仍超预算时,在同一个用户任务中自动完成轻量 handoff / native session rebuild。
4. 增加回归测试:多轮大图历史不得触发用户可见 413,且最新必要图片仍能送达模型。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26100)
**Harness**: Codex
**Model ID**: ` gpt-5.6-sol `
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start with packages/anthropic-compat-proxy/src/server.ts and apps/desktop/src/main/maker-host/anthropic-compat-proxy-host.ts, comparing the existing limit handling with codex-proxy-host.ts. Trace the shared Claude/Worker request path and the existing Codex image-cleaning rollout. Done means repeated large-image turns no longer produce a user-visible 413, while the latest necessary image remains available and regression coverage exercises the limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.