fix: 系统性修复对话历史、数据安全与渲染健壮性 bug - #6
Merged
Merged
Conversation
- 流中断时统一收尾未关闭的 block,工具参数不再停在 {} 且补发 toolcall_end
- sanitize 清洗 ToolCall.arguments,避免孤立代理字符在持久化时抛 UnicodeEncodeError
- assistant 消息被整体过滤时跳过其对应 tool_result,避免 provider 报 tool_use_id not found
- abort 路径显式关闭事件流,释放 httpx 连接
- 单个畸形 SSE 帧跳过而非中断整条流并丢失已流式内容
- abort 后为未执行的 tool_call 补 is_error 的 aborted 结果,保证 tool_use/tool_result 配对 - _field 改用键是否存在判断,不再把 False/0/""/[] 当作缺省 - override 翻转 is_error 时同步回写 result,消除 event 内外不一致
- write/edit 改用 temp+fsync+os.replace 原子写,中途失败不再清空原文件 - read 修 \n 结尾文件的行数 off-by-one,limit 加 ge=1 - 所有 Error 分支显式置 is_error=True - WorkspaceAccessError 单独归类,保住 denied 策略信号
- 进程退出/超时后给输出泵收尾加超时并可取消,避免继承 stdout 的孙进程令 execute 永久挂死 - build_runtime 非 off 后端抛 SandboxError,不再静默返回未隔离的 HostSandboxRuntime
- 校验裸远端工具名字符集而非带前缀名,合法远端名不再被误拒 - call_tool 与 abort 用 asyncio.wait 竞速,abort 及时返回 - 子进程环境黑名单剥离已知密钥,不再整体泄漏 host env;错误脱敏覆盖已知 secret 值 - 连接超时的异常组不再打挂 CLI 启动 - sandbox_server 配置解析与 PION_SANDBOX_* 非法值 fail-closed
- profile 上下文窗口优先查 registry 拿真实值,不再写死 128k - token 估算计入 image 近似字节与工具 schema,含图会话不再估算为 0 - load 逐行容错,单行坏 JSONL 跳过并记入 load_errors,不再毁掉整个 session - get_tree 改迭代后序遍历,长会话不触发递归上限 - config 附带校验 mcp_servers key 字符集
- compaction_started/finished 用 try/finally 保证配对,总结抛异常也不再卡死 UI spinner - prompt() 开头重置 last_error 并拷入 agent.error_message,避免一次失败永久标脏 - 压缩传入 abort 并纳入 is_busy,可被中断
- run_before_agent_start/apply_context 包 try 并校验返回类型,异常记入 errors 后跳过 - reload 先清 errors 并卸载旧模块名,消除 sys.modules 模块副本泄漏
- editor 光标在行宽整数倍时不再追加越界 cell 触发 RenderError - select_list 用 visible_width 度量 CJK 标签,行不再溢出 - footer 先截断 right、left 可归零,窄终端 line2 不超宽 - MessageQueue.pop_back 镜像 pop_next,返回真正最近入队的消息
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
系统性修掉一批潜在 bug,按严重度分为 8 个批次执行,每个修复配一条回归测试。仅修现有 bug(含低危/清理),不含 harness 治理与大接口重构。
分组提交(9 个原子提交)
测试
干净环境(去除 ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN)全套 311 passed。每个批次均补充了针对性回归测试。
命令:`env -u ANTHROPIC_BASE_URL -u ANTHROPIC_AUTH_TOKEN .venv/bin/python -m pytest -q tests/`