cang-ying/memory/eed/project_panel_fix.md

35 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: 面板E2BIG根治A方案已完成
description: eed_web.py 修复"喊蛋蛋没回应"的根因——resume失败回退拼全量历史导致E2BIG三处修复已实现并验证待重启生效
type: project
---
# 面板 E2BIG 根治2026-08-01 完成,待重启生效)
## 症状
重启面板后,爸爸喊"蛋蛋/唤醒耳耳蛋"多轮无回应,显示"(蛋蛋没回话,换个说法试试~)"。
## 根因
1. 旧会话 `eed_c670c9a53f16.jsonl` 已膨胀到 **10.6MB**`--resume` 它必超时/卡死
2. resume 失败后代码回退"拼全量历史"`build_prompt` + `-p`),历史越大 `-p` 越长
3. 内核单参数上限 128KB`-p` 顶穿 → codebuddy 进程 execve E2BIG → 起不来 → 无输出
4. 隐藏 bug`build_prompt` 原用 `limit=60000` **字符数**截断中文3字节/字 ≈ 180KB远超 128KB 字节上限,保护形同虚设
## 已实施修复eed_web.py备份 .bak6
1. **build_prompt** 改按**字节**硬截断(默认 80KB永不超 128KB
2. **maybe_compact**`COMPACT_RESUME_MAX = 4MB`:超 4MB 的会话不再调模型摘要(必超时),直接降级
3. **新增 `_tail_summary`**:从 jsonl 尾部读最近消息生成原始摘要(不调模型、永不超时)。注意 codebuddy 会话格式:`role` 在顶层、文本块 type 是 `output_text/input_text/text`(不是 `text``message` 字段是 usage 不是内容
4. do_POST 压缩分支:`--append-system-prompt <摘要> --session-id <新sid> -p <新消息>`argv 恒定小
## 验证(全过)
- 单元build_prompt 字节截断安全_tail_summary 从 10.6MB 提取 4.2KB/78 行maybe_compact 降级返回新场
- 端到端POST /api/chat 带旧 sid+started → 返回 compacted=true + 新 session_id子进程命令行确认 `--append-system-prompt [摘要] -p <仅新消息>`
## 待办
- **重启面板生效**`bash ~/cang-ying/scripts/restart-eed.sh`(爸爸执行,我不能自杀面板)
- 重启后验证:发消息不再回退拼全量历史
## 踩坑教训
- 清理测试实例用 `fuser -k <端口>/tcp`,别用 `pkill -f`(会匹配到自己的命令行,误杀自己)
- 会话 jsonl 解析前先看真实结构,别照 API 格式猜