Skip to content

release(1.x.x): v0.5.2a7 → v0.5.2 —— 流式错误日志乱码修复 / 供应商状态复位 / v0.5.2 周期收口 - #281

Merged
ThreeFish-AI merged 50 commits into
masterfrom
feature/1.x.x
Sep 10, 2026
Merged

release(1.x.x): v0.5.2a7 → v0.5.2 —— 流式错误日志乱码修复 / 供应商状态复位 / v0.5.2 周期收口#281
ThreeFish-AI merged 50 commits into
masterfrom
feature/1.x.x

Conversation

@ThreeFish-AI

@ThreeFish-AI ThreeFish-AI commented Sep 10, 2026

Copy link
Copy Markdown
Owner

概述

本 PR 将发布线 feature/1.x.x 合入 master,汇总自 v0.5.2a7#277)以来的全部演进,版本推进至 v0.5.2,正式收口 v0.5.2 发布周期。

  • 差异范围master (v0.5.2a7) → feature/1.x.x (v0.5.2)
  • 规模:26 个文件,+487 / -287(含 3 个功能/修复提交、2 个版本收口提交与文档收敛)
  • 兼容性:均为缺陷修复与体验增强,无破坏性变更;配置默认行为零影响

1. 流式错误日志中文乱码修复 + Antigravity 检测加固(#278

  • 修复流式错误响应日志输出中文乱码的问题,错误信息可读性恢复;
  • 解耦 antigravity 的 scope 检测逻辑,消除误判路径,检测更稳健;
  • 新增 tests/test_antigravity.py 覆盖加固后的检测行为。

2. Dashboard 供应商状态复位 + 配额用量修复(#279

  • 供应商状态卡片新增**「状态复位」按钮**:一键复位熔断/降级状态,无需重启进程,运行时内存生效;
  • 修复 reset 误清当日配额用量的问题——复位只作用于健康状态,不再触碰当日已用配额统计
  • tests/test_app_routes.pytests/test_quota_guard.pytests/test_vendor_helpers.py 补齐对应回归用例。

3. Session 标题豁免前缀放宽

  • 标题豁免前缀由完整英文指令放宽为 "Write the title in the",覆盖更多语言变体的注入式 Prompt(如要求以用户语言撰写标题的系统指令),进一步杜绝其被误用为 Session 标题。

4. 文档与工程收敛

  • 移除仓库根 AGENTS.md,Agent 协作文档统一收敛至 docs/.agents/ 隐藏目录(issue.md 持续沉淀诊断记录、knowledge-map.md 同步索引);
  • README / docs 用户指引同步补充 Dashboard 状态复位等功能说明。

5. 版本收口

  • v0.5.2a8(流式日志修复 + antigravity 加固)→ v0.5.2 正式版,v0.5.2 周期收口。

冲突解决说明

#277squash merge,断裂了 master 与发布线的历史关联,导致本 PR 一度 CONFLICTING。已在发布线内执行 merge(master): 合并 origin/master 至 feature/1.x.x,解决 PR #281 冲突(提交 054621c):

  • 9 处冲突全部取 feature/1.x.x 侧(AGENTS.mddocs/agents/* 保持删除、版本号/dashboard/测试/uv.lock 取发布线新值);
  • CHANGELOG.md:master 侧自动合并曾重复插入 v0.5.2a1–a7 条目块,已修正——发布线版本本就完整含该块,最终取发布线版本;
  • 合并提交树与 feature/1.x.x tip 逐字节一致git diff 为空),即 master 侧无任何独有内容丢失,发布线内容零改动。

测试与验证

  • 本地 uv run pytest tests/test_app_routes.py tests/test_quota_guard.py -q64 passed
  • 合并树与已发布的 v0.5.2 树完全一致,CI(Ruff lint/format + pytest 3.12/3.13/3.14 + Coverage)以该树运行为最终防线。

ThreeFish-AI and others added 30 commits May 27, 2026 14:08
* refactor(concurrency): 统一并发抽象,支持 monitor / limited 双模式;

将 ModelConcurrencyLimiter 重构为 ModelConcurrencyController,新增 monitor
模式(config=None,仅计数不限流)与既有 limited 模式(Zhipu 等限流场景)。

- _ConcurrencySlot 增加 limit=None 分支,fast path 直接 in_use++;
- 新增 track() async ctx mgr 与 mode 属性,便于 executor 层 async with 包裹;
- 新增 _peak_samples 滑窗,get_diagnostics 输出最近 10s pending 峰值;
- BaseVendor 注入默认 monitor controller,新增 track_in_flight()
  / update_concurrency() 默认实现;get_diagnostics 自动合入 concurrency 字段;
- ZhipuVendor 删除内部 _maybe_acquire_concurrency_slot,统一委托 BaseVendor
  + executor 层包裹,slot 跨 429 重试自然持有;
- 保留 ModelConcurrencyLimiter 别名向后兼容。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* feat(dashboard): Model Calling 实时监控扩展至全 vendor / 全 model;

将 Model Calling 卡片从仅监控 Zhipu 扩展到所有 vendor 的所有模型(仅 CC 场景)。

- executor: 在 execute_stream / execute_message 调用 vendor.send_message[_stream]
  前用 async with vendor.track_in_flight(mapped_model) 包裹,覆盖所有 vendor
  (包括完全覆写 send 方法的 Copilot / Antigravity);
- dashboard: updateModelCalling 按 mode 字段区分渲染:
  - limited 模式(Zhipu)保留进度条 + limit 可编辑 + ⏳ pending 徽章;
  - monitor 模式(其他 vendor)仅显示 in_use 计数徽章,无可编辑控件;
  - 新增 mc-badge-peak「🕘 曾排队 N」灰色余晖徽章,覆盖 pending=0 但
    peak_pending_recent>0 的场景;
  - 轮询间隔由 5000ms 缩短至 1500ms,提升瞬时排队可观测性;
- routes: /api/concurrency PUT 在 monitor-only vendor 上返回 422(区别于参数
  非法的 400),错误消息明确指示不支持调整。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* test(concurrency): 适配并发抽象重构并补齐 monitor / executor 测试覆盖;

- test_zhipu_concurrency: 适配 Controller 重构(导入别名 + diagnostics 字段
  断言更新),新增 test_peak_pending_recent_tracking 验证余晖记录;
  ZhipuVendor 测试通过 _send_with_tracking / _stream_with_tracking 辅助函数
  模拟 executor 层 track_in_flight 包裹,行为等价;
- test_concurrency_monitor(新增): 覆盖 monitor 模式 acquire 不阻塞、
  pending 恒为 0、set_limit 抛 ValueError、100 并发峰值正确等场景;
  BaseVendor.track_in_flight 默认行为(空 model 名 no-op、非空委托 controller);
- test_executor_in_flight_tracking(新增): 用探针式 fake controller 验证
  executor 在调用 send_message[_stream] 前进入 track 上下文,
  调用结束(含异常)后正确退出;
- test_router_executor: _mock_vendor 新增 track_in_flight 字段(nullcontext)
  以适配 executor 调用约定。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* docs(changelog): 记录 Model Calling 监控扩展至全 vendor 的变更条目;

- 监控扩展:所有 vendor 在 CC 场景下都呈现 in_use 实时计数(monitor 模式);
- 限流收敛:Zhipu 保留 limit + FIFO 排队(limited 模式),其他 vendor 仅观察;
- 队列可见性:新增 peak_pending_recent 余晖追踪 + 轮询间隔由 5s 缩短至 1.5s;
- 抽象统一:ModelConcurrencyLimiter → ModelConcurrencyController(保留别名)。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 新增 CSS 变量 --gap-section: 12px 作为模块间距单一事实源
- 将 .time-range-bar / .kpi-grid / .model-calling-card / .charts-grid /
  .charts-grid-2 / .model-token-card 的 margin-bottom 统一指向该变量
- 消除底部 Token 用量卡片的 inline style,改用语义化 class

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
* diag(executor): 为语义拒绝路径增加请求体可疑参数诊断日志;

在 execute_message 和 execute_stream 的 semantic rejection 日志中
附加请求体参数快照(thinking/extended_thinking/reasoning_effort 顶层参数、
会话历史中 thinking blocks 数量、cache_control 存在情况、模型名、消息数),
用于定位 zhipu glm-4.7 [1210] 参数校验拒绝的具体祸根参数。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* diag(executor): 扩展语义拒绝诊断日志覆盖范围至 system/tools/sampling/metadata/content_types 等维度

PR #244 部署后的诊断日志反转了原推断:失败请求均不含 thinking/cache_control,
说明祸根在更细粒度的参数。扩展 _build_semantic_rejection_diagnostic 函数:

新增维度(仅存在时输出):
- system 形态(string/blocks + cache_control 计数)
- tools 数量 + tool_choice 形态
- 采样参数(max_tokens/temperature/top_p/top_k/stop_sequences)
- stream / metadata_keys
- messages.content 类型分布(含 string content)
- 请求体字节数估算(json.dumps)

新增 14 个单元测试(TestBuildSemanticRejectionDiagnostic)覆盖各字段组合
与真实失败请求形态。所有测试通过(1478 passed)。

* docs(agents): 记录 zhipu [1210] 诊断阶段进展(证据反转 + Step 1 v2)

* build(version): 版本号升级至 0.4.1a6;

* fix(zhipu): 兼容转换 thinking.type=adaptive 为 GLM 支持的 enabled 格式,修复 [1210] 语义拒绝

基于 2026-05-26 16:30–16:31 日志证据(8 次连续拒绝均含 thinking.type=adaptive),
在 ZhipuVendor._prepare_request 中实现兼容转换:
- adaptive → enabled(budget=16000):保留 thinking 能力,使用 GLM 原生确认支持的格式
- 新增 _build_zhipu_request_snapshot 诊断快照(成功/失败统一格式,可 diff 对比)
- 扩展语义拒绝日志错误体截断(200→500 字符),保留完整字段级诊断
- metadata 暂不处理,待进一步诊断确认兼容性

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(executor): 删除旧版重复定义的 _build_semantic_rejection_diagnostic 函数

Step 1 v2 扩展版本与 Step 1 旧版本同名重复定义,Python 运行时后者覆盖前者
不报错但旧版成为死代码。删除旧版仅保留扩展版本。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* feat(vendor-channels): 新增过渡管线诊断快照与 Anthropic 配对自检;

在 prepare_zhipu_to_anthropic 管线中新增两个辅助函数:
1. _dump_message_digest: 输出各阶段消息结构摘要(DEBUG 级别),
   用于过渡管线变换前后的可观测性诊断
2. _validate_anthropic_pairing: 独立的 tool_use/tool_result 配对
   自检(纯检测,不修改),定位 enforce/sanity 未覆盖的边界 case

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
将 docs/agents/ 目录重命名为 docs/.agents/,同步更新 AGENTS.md 中所有相关引用链接。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
* feat(routes): GET / 自动重定向至 /dashboard;

将根路径的 HEAD 与 GET handler 拆分:HEAD / 保持 200 响应(Claude Code 连通性探针依赖),
GET / 改为 307 Temporary Redirect 至 /dashboard,提升浏览器访问体验。
同步更新单元测试与 E2E 测试的断言。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* perf(dashboard): 模型调用状态轮询间隔从 1.5s 放宽至 10s 以降低后端负载;

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 后端: _NOISE_TAG_PATTERN 新增 session 标签, 避免标题以 <session>... 开头;
- 后端: _SESSION_TITLE_MAX_LEN 从 30 放大至 600 (20x), 提升标题信息量;
- 前端: 展开详情行中 Title 独立为 .detail-title-row, 独占全宽行显示;
- 前端: 新增 -webkit-line-clamp: 3 多行截断样式, 超出部分以 ... 省略;
- 测试: 补充 <session> 标签剥离用例, 修复截断长度测试适配新上限;

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 重构 _extract_session_title 为 4 级逐级回退策略:
  Level 1: user TEXT 噪声剥离(原有逻辑不变)
  Level 2: TOOL_RESULT 文本截取 → '[Tool output] <snippet>'
  Level 3: IMAGE 计数 → '[1 Image]' / '[N Images]'
  Level 4: 元数据兜底 → '[Tool call] Bash, Read' / '[Session] model'
- 噪声标签白名单新增 artifactMetadata、thinking
- 新增 update_empty_session_title 延迟补写机制,
  非首次请求也可为空标题 session 回填
- 补充 30 个测试用例覆盖全部回退级别与新噪声标签

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
当用户实际输入被 <session> 标签完整包裹时,首轮噪声剥离会将
整个 <session> 块连同用户文本一并删除,导致 Level 1 始终返回空。
新增二次回退机制:若首轮结果为空,仅去除 <session> 外壳标签,
保留内部文本后重新剥离噪声,确保用户文本可见。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
当 Session 标题以配置前缀(默认「# 目标」)开头时,自动将该 Session
绑定到指定 vendor(默认 zhipu),不走默认 vendor 路由。前缀与目标
vendor 均通过 YAML 配置(session_policies.title_vendor_bindings),
支持多条规则、按顺序匹配首次命中生效、置空列表即禁用。

实现复用现有 SessionPolicyResolver.upsert() 运行时绑定机制,在标题
提取后、tier 解析前注入策略,仅对新 Session 首请求生效以避免覆盖手动
绑定。新增启动期 vendor 存在性校验(未知 vendor 告警而非硬失败)与
prefix/vendor 非空约束(杜绝空前缀全量误绑定)。

- config/session_policy.py: 新增 TitleVendorBinding 模型 + 配置字段
- config/config.default.yaml: 默认「# 目标」→ zhipu 绑定
- routing/executor.py: _apply_title_based_policy 方法、启动校验、双路径注入
- routing/router.py + server/app.py: 配置透传
- tests: 新增 17 个用例(前缀匹配/边缘/校验/流式与非流式端到端)

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 统一将 claude-opus-.* 映射规则前置于 claude-sonnet-.*,使 Opus 优先匹配
- 智谱 GLM 映射升级:opus→glm-5.2、sonnet→glm-5.1、haiku→glm-5.1
- 新增 claude-fable-5 与 glm-5.2 定价,并按新优先级重排 GLM 定价条目

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
Zhipu vendor 原仅对 429 限流做就地指数退避重试,529(Overloaded
并发过载)直接交由上层 failover。现扩展内部重试以涵盖 529,与 429
共用同一退避策略(max=5、1s→2s→4s→8s、Full Jitter、优先尊重 server
retry-after),降低请求失败率与不必要的 failover。

- 新增 _BACKOFF_RETRY_STATUS={429,529} 作为可重试状态码单一事实源
- 非流式/流式判定改用集合,日志带入真实状态码
- 修复流式延迟计算忽略 529 retry-after 的缺陷,并去重延迟逻辑
- 对称补全 529 非流式/流式重试与 retry-after 回归测试
- 同步 design-patterns.md §3.12 Vendor 级重试说明

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
- 新增 /favicon.svg 路由(蓝紫渐变方块 + 白色 terminal-2 笔划),作为现代浏览器主选 favicon
- 重绘 /favicon.ico 为 32×32 terminal-2 光栅图(旧浏览器 / Safari 回退),沿用圆角透明
- 页面 logo 由字母「C」改为内联白色 terminal-2 SVG,沿用渐变方块容器
- 抽取 _TERMINAL2_PATHS 笔划常量作为单一事实源,供 favicon 与 logo 共享

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
修复 529 过载重试延迟非单调问题(实测 418.8→1857.7→961.6→3769.7ms,
非递增)。根因为 calculate_delay 的 Full Jitter(random.uniform(0, ceiling))
本质非单调,且 529 通常无 Retry-After 头而落入该兜底分支。改为 Equal Jitter
(temp/2 + random(0, temp/2))后区间为 [500,1000]→[1000,2000]→[2000,4000]
→[4000,8000],单调非递减;429/529 共用退避路径同步受益,retry-after 优先级不变。

- 新增 tests/test_retry.py 独立单元测试(calculate_delay 此前零覆盖)
- 新增 test_zhipu.py::test_529_equal_jitter_delay_in_expected_band
- 同步更新 retry.py / zhipu.py docstring、CHANGELOG、issue.md

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
同步更新 CHANGELOG.md,新增 [v0.5.2a1] 条目(含 529 Equal Jitter fix 与补记的 v0.5.1 遗漏改动)。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
在 session_policies 配置下新增可维护的 title_exempt_prefixes 名单:首条
user TEXT 经噪声剥离后若以任一豁免前缀开头则跳过,继续向后查找合适的
title 候选(典型如 "Write the title in the language..." 注入指令)。豁免
仅作用于 Level 1,Level 2/3/4 回退不受影响;经 _RouteExecutor 实例方法
注入,field_validator 与构造期双重归一化防空串 startswith 误豁免。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
同步更新 CHANGELOG.md,新增 [v0.5.2a2] 条目(feat(session) Session 标题豁免前缀,#265)。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
ThreeFish-AI and others added 20 commits July 3, 2026 09:52
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 新增 PUT /api/tier-order 纯重排序端点:复用 router.reorder_tiers,不触碰熔断器/配额守卫/rate limit,与 /api/reset 解耦
- 供应商状态列表基于 HTML5 DnD 在 #vendor-list 上做事件委托,渲染拖拽手柄与 draggable 属性
- 拖拽完成后乐观重排 DOM 并 PUT 新顺序;失败回滚至服务端真实顺序;拖拽/POST 未决期间跳过重渲染
- 新增 7 个 /api/tier-order 测试,覆盖成功、校验失败及配额守卫/熔断器保留断言

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
- 根因:原生 HTML5 DnD 机制脆弱(触屏不支持、跨浏览器易「拿不起来」)。经活体探针确认前端设置(draggable/data-vendor/事件委托/PUT 端点)与后端(单一全局 router 切片赋值、executor 共享引用)均无缺陷,#269 仅补后端单测、拖拽从未做浏览器验证 —— 唯机制本身不可靠。
- 交互:以 #vendor-list 上的 pointerdown/move/up/cancel 事件委托替换 dragstart/dragover/drop/dragend;手柄发起 + setPointerCapture + 4px 阈值 + 乐观实时重排;复用既有 _tierDrag 状态机、persistTierOrder(PUT /api/tier-order) 与失败回滚,顺序未变则跳过 PUT。
- 样式:手柄增加 touch-action:none(触屏可拖),移除失效的 [draggable] 与 drag-over-* 规则。
- 加固:/dashboard 响应加 Cache-Control:no-cache,避免浏览器缓存旧内联脚本掩盖前端修复。
- 测试:新增前端守卫断言(交付含 pointer 事件 + PUT、不含原生 draggable),补齐 #269 缺失的前端验证;test_app_routes.py 42 项全绿。
- 实机验证:独立端口拖拽使 DOM 与 /api/status 顺序同步翻转、PUT 200、无控制台报错,证明重排实时改变 cc 运行时优先级。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
将品牌图标由「深紫渐变实心块 + 白色 >_ 笔划」反转为「#f5f6fb 淡色磨砂卡片 +
品牌紫渐变(#667eea→#764ba2) >_ 笔划 + 细描边环」,使图标轮廓成为视觉主角,
更简约、小尺寸下更清晰(Linear/Vercel 风),强化 Coding 意向。

- 新增 _LOGO_DEFS 共享品牌渐变 <defs>,作为 favicon SVG 与页面 logo 单一事实源
- _build_favicon_svg:浅底 + 品牌描边环 + url(#cpBrand) 笔划
- _build_favicon (ICO):浅底光栅 + brand_at 按对角 t 计算品牌渐变笔划
- .logo CSS:浅底 + 品牌描边环 + 辉光调淡;内联 SVG 注入 {{LOGO_DEFS}}
- 保留 --gradient-primary 与 .vendor-avatar 不动(最小干预)

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
* style(branding): logo/favicon 容器改玻璃雾卡、笔划加粗提亮以提升醒目度;

延续 #272 的品牌图标设计,针对「图标依旧不够醒目」反馈做容器透明化与笔划强化:

- 容器透明化:favicon rect 与 .logo 背景由实色 #f5f6fb 改为半透明白雾卡
  (SVG hex8 #ffffff14/#ffffff38、.logo rgba(.06/.12)),与深色毛玻璃 header
  (backdrop-filter)语言统一,消除「亮白贴片」压制感;box-shadow 改双层
  (黑投影补边界 + inset 顶部玻璃高光)
- 笔划醒目化:>_ terminal 笔划 stroke-width 2→2.5;chevron 左移、下划线右移并
  延长(M6/M13 l5)撑开间距至 4 单位避免粘连、下划线加长至 5 防止小尺寸退化为圆点
- 深端提亮:品牌渐变 #764ba2→#8b5fd0,深底对比达 WCAG 图形 3:1
- .logo 笔划新增 drop-shadow 柔和辉光;favicon 16px 小尺寸保持锐利不加 glow
- ICO 回退同步:深端 RGB 0x8B5FD0、底色 alpha 255→0xB0、笔划坐标
- favicon 跨浅/深浏览器 tab 双主题均可辨识(实机验证)
- 保留 --gradient-primary 与 .vendor-avatar 不动(最小干预)

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* style(branding): logo/favicon 改通透青绿圆环 + prompt >_ 笔划(方案 d05);

按用户选定方案 d05 重设计品牌图标,替换前版玻璃雾卡:

- 通透青绿圆环:全透明底 + 青绿渐变(#22d3ee->#2dd4bf)细圆环
  (stroke 0.5,仅原 1/3、通透若隐) + 饱和青绿渐变 >_ 笔划(stroke 2.5),
  极细环与饱和笔划形成权重对比、>_ 为视觉主角;青绿承载终端/代码语义
- 基础笔划改用 Tabler prompt(chevron M5 7l5 5l-5 5 + 下划线 M13 17l6 0),
  下划线长 6 单位、不会小尺寸点化
- 修复下划线消失:渐变改 gradientUnits="userSpaceOnUse" 绝对坐标,
  规避纯水平下划线(包围盒高度 0)在默认 objectBoundingBox 渐变下不着色
- 单一事实源:_LOGO_DEFS / _PROMPT_PATHS 统一供 SVG favicon、ICO 回退
  (省略 0.5px 细环、保留饱和笔划)与页面 logo 消费
- .logo 容器改全透明、SVG 内嵌圆环 + 青绿 drop-shadow 辉光
- 实机验证:独立端口启动新代码,浏览器确认 favicon/logo 青绿 >_ 完整、
  下划线在位、圆环通透(不干扰既有 3392 实例)

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
品牌图标迭代至方案 d05(通透青绿圆环 + Tabler prompt >_),修复水平下划线渐变消失(userSpaceOnUse),版本号升级至 0.5.2a6,CHANGELOG 定版。
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 布局: .kpi-grid 由 auto-fit(minmax 200px) 改为 repeat(6, minmax(0,1fr)),
  使 6 张 KPI 卡在桌面/笔记本/平板横屏(≥1024px)恒定单行不折行,杜绝横向溢出;
  gap 5px 归一为 --gap-section(12px)。
- 排版: .kpi-value 采用 clamp(20px,2.2vw,32px) 平滑缩放,中宽度不裁剪数值;
  费用卡 #kpi-cost-today 允许在 " + " 处换行,双币种始终完整可见。
- 响应式: 新增 ≤1023px→3 列、≤480px→2 列 优雅降级; header 加 flex-wrap
  修复窄屏横向溢出。
- 可访问性: 为 .range-btn/.btn-refresh/.page-btn/.copy-btn 补 :focus-visible
  键盘焦点环; 新增 prefers-reduced-motion 降级动效。
- 缺陷修复: 补定义 --bg-secondary / --text-muted 两个未定义 CSS 变量
  (消除 Model Calling 行透明背景回退); JetBrains Mono 补载 700 字重,
  修正 .kpi-value 合成粗体。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
版本号升级至 0.5.2a7,CHANGELOG 定版。本版聚焦 Dashboard Overview 页 6 张
KPI 卡片防折行(repeat(6, minmax(0,1fr)) + clamp 排版 + 响应式降级),附带
键盘 :focus-visible / prefers-reduced-motion 可访问性加固、两个未定义 CSS
变量修复与 JetBrains Mono 700 字重补载,并纳入 README 页脚作者主页与
Apache 2.0 协议超链接。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 新增 assets/logo.svg:从 favicon 单一事实源 _FAVICON_SVG(dashboard.py)派生,
  确保与线上 /favicon.svg 逐字符一致(青绿渐变 >_ prompt 笔划 + 通透圆环);
- README.md 与 docs/zh-CN/README.md 双语 H1 以 <img> 引用该图标,采用
  width/height=32 + align="absmiddle" 适配 GitHub 净化器(保尺寸生效、与文案垂直居中);
- 架构图 Mermaid 子图标签由 "⚡ coding-proxy" 改为纯文字 "coding-proxy",与去 emoji 的 H1 统一。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
* fix(vendor-logging): 修复流式错误日志中文乱码,收敛 bytes 解码为单一 helper;

上游供应商返回 4xx/5xx 时,流式错误分支将 response.aread() 得到的 bytes
经 %s 直接格式化,Python 走 repr() 导致非 ASCII 的 UTF-8 字节被转义为
\xe6\x82\xa8 之类的不可读序列(中文乱码)。

- model/vendor.py 新增公开工具函数 decode_error_body(raw, limit=500):
  先整体 UTF-8 解码(errors="replace" 容忍非法字节)再按字符截断,避免
  在多字节边界切断;作为「错误响应体日志解码」的单一事实源;
- base.py / copilot.py / antigravity.py 三处同型流式错误日志统一复用该
  helper;其中 antigravity 消除了原先重复的 decode 调用(scope 检查与日志
  共用一次解码);
- model 包(vendor.__all__ 与 __init__)同步 re-export;
- 新增 tests/test_vendor_helpers.py:单元测试覆盖中文解码/字符截断/非法字节/
  空值/回归对照,集成测试经 BaseVendor 流式路径(MockTransport 返回 400+中文)
  以 caplog 断言日志含可读中文且无字节转义。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* fix(vendor-antigravity): 流式 scope 检测改用完整解码 body,与日志展示截断解耦,补回归测试;

流式错误路径此前把 decode_error_body(error_body)(截断至前 500 字符)
既用于日志展示、又传入 _mark_scope_error_if_needed 做子串检测。检测这类
判定性逻辑不应受日志展示上限约束:当上游 scope 错误体在
ACCESS_TOKEN_SCOPE_INSUFFICIENT 标记出现前已超过 500 字符时,标记会被
截断丢弃,token 不再标记 needs_reauth 而继续以 scope 不足的凭证重试。

- 检测改用完整解码文本 error_body.decode("utf-8", errors="replace"),
  日志展示仍用 decode_error_body 的 500 字符截断版本,二者关注点解耦;
- 与非流式路径(send_message)传入完整 response.text 的行为恢复一致;
- 补充回归测试:构造标记位于第 500 字符之后的 403 错误体,断言检测仍触发
  (旧截断实现下该用例失败)。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
版本号升级至 0.5.2a8,CHANGELOG 定版。本版收敛 PR #278 两项修复:流式 4xx/5xx
错误日志中文乱码(bytes 经 %s 走 repr() 把 UTF-8 字节转义为不可读序列)经新增
decode_error_body 工具统一收敛;antigravity 流式 scope 检测改用完整解码 body,
与日志展示截断解耦并补回归测试。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
* feat(dashboard): 供应商状态卡片新增「状态复位」按钮,并修复 reset 误清配额用量;

Overview 页「供应商状态」卡片标题栏右侧新增 ⟲ 状态复位 按钮,把处于熔断 /
限流等异常态的供应商一键复位为可正常访问,无需切到终端执行 CLI。

根因修复:QuotaGuard.reset() 此前把「状态机复位」与「用量计数清零」两件正交
的事耦合在一个方法里(_entries.clear() + _total = 0)。而窗口基线 load_baseline()
的唯一调用点在进程启动的 lifespan 钩子中、运行期不再回填,导致 Dashboard 的
「1d配额 45%」徽章一经 reset 便永久停在 0%。现只保留 _transition_to(WITHIN_QUOTA)
(该方法本身已清 _cap_error_active 并还原探测间隔),CLI / API / Dashboard 三条
路径经单一事实源同时修复,无需 --keep-quota 之类开关。

语义取舍为「如实」:用量确已超过 token_budget × threshold_percent 时,复位后下
一次判定立即回落 QUOTA_EXCEEDED,不伪造用量数字;真正被解开的是熔断、Rate Limit
与上游 cap 错误卡死标志。

实现要点:
- 按钮调用无 body 的 POST /api/reset,服务端据此跳过重排序,故不改动供应商优先级;
- 新增 .btn-card-action 卡片标题栏控件通用类,复用 .card-title 既有的
  justify-content: space-between 实现右对齐,零布局 CSS 改动,并纳入
  :focus-visible 焦点环列表;
- 交互沿用 persistTierOrder 的 in-flight 防并发范式与 copyFromParent 的瞬时反馈
  范式(复位中… → ✓ 已复位 / ✗ 失败,1.5s 还原),成功后定向重渲染供应商列表,
  不必等 10 分钟轮询。

顺带修复:「限速中」徽章读 rlInfo.limited,而后端 VendorTier.get_rate_limit_info()
产出的键是 is_rate_limited,键名不匹配使该徽章从未渲染过、Rate Limit 异常态在 UI
上完全不可观测。

测试与文档:新增 7 条用例(配额用量保留、cap 卡死解开、真实超限不放行、/api/reset
无 body 与 -v 两种形态均保留用量、按钮与键名前端守卫);旧用例
test_reset_clears_all_state 曾断言 window_usage_tokens == 0,等于把缺陷固化为契约,
已改写为 test_reset_preserves_window_usage。cli-reference / api-reference 补明「仅
复位状态、不清用量」,dashboard.md 新增「供应商状态复位」小节,issue.md 归档复盘。

隔离实例(端口 3399,复刻 anthropic 熔断 + zhipu 45.6% 配额 + 限速中)实机验证:
复位后熔断转正常、限速徽章消失、配额 456,193,510 tokens 原样保留、链路顺序不变;
CLI `reset -p 3399 -v anthropic,zhipu` 同样保留用量。全量 1656 条测试通过。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* fix(quota-guard): 用量超阈值时复位不再推后探测时钟,并消除复位后的误报失败;

处理 PR #279 的两条评审意见。

回归修复(评审 #1):初版修复让 reset() 无条件 _transition_to(WITHIN_QUOTA),
用量仍超阈值时下一次判定再回落 QUOTA_EXCEEDED —— 而该回环会经
_transition_to(EXCEEDED) 把 _last_probe 刷成当前时刻,令探测恢复凭空推迟一个
probe_interval(默认 300s);反复点击「状态复位」可无限饿死探测(旧实现清零
用量,不存在此回环)。现 reset() 在用量仍超阈值且已处 EXCEEDED 时不再触发任何
状态转移,仅清 _cap_error_active 并把被 Retry-After 拉长的
_effective_probe_interval 还原为默认值——即「宁可不放行,也不推迟恢复」。

补 2 条回归用例(mock 时钟锁定探测点不被推后 / cap 拉长的探测间隔被还原),
并改写 test_reset_does_not_unblock_genuinely_exhausted_quota:超阈值时复位后
状态保持 quota_exceeded(旧断言 within_quota 恰是回环存在的证据)。

误报修复(评审 #2):/api/reset 已返回 200 后,紧随的 /api/status 定向刷新若
失败(网络抖动、进程重载)会被同一个 catch 误标为「✗ 失败」,诱导用户重复
点击——复位其实已生效。现刷新失败单独吞掉,仅影响展示。

文档(cli-reference / api-reference / dashboard.md)与 CHANGELOG、issue.md
复盘同步对齐终态语义:超阈值 → 保持 EXCEEDED、清 cap 卡死标志、还原探测间隔。

全量 1658 条测试通过。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* docs(agents): 移除仓库内的 Agent 协作治理文档;

删除 AGENTS.md / CLAUDE.md(Agent 工程行为准则与协作协议)及其卫星规范
docs/.agents/browser-validation.md(浏览器验证协议)与
docs/.agents/reference-specifications.md(IEEE 引用规范模板)——四者均为
面向本机 AI Agent 环境的私有治理内容,不属于开源仓库交付物。

🤖 Generated with [Claude Code](https://claude.com/claude-code), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* build(deps): 同步 uv.lock 中 coding-proxy 版本至 0.5.2a8;

pyproject.toml 已 bump 至 0.5.2a8,但 uv.lock 仍停留在 0.5.2a7,
补上发布时遗漏的锁文件版本同步。

🤖 Generated with [Claude Code](https://claude.com/claude-code), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>

* docs(knowledge-map): 清理指向已删除 Agent 治理文档的死链;

随 8fc09d9 移除 AGENTS.md / browser-validation.md / reference-specifications.md
后同步收尾:knowledge-map 移除死链行与 AGENTS.md 锚定表述,合并「Agent 协作」
与「问题档案」两节(issue.md 实际位于 docs/.agents/,原 ../issue.md 链接为
死链,一并修正),路径基准勘误为 docs/.agents/;中英 README 的文档地图同步
移除 AGENTS.md 条目。全部相对链接经脚本自检可解析。

🤖 Generated with [Claude Code](https://claude.com/claude-code), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
版本号升级至 0.5.2,CHANGELOG 定版。本版为 v0.5.2a1–a8 预发布周期的正式收口版,
增量收敛 PR #279 三项改动:QuotaGuard.reset() 拆解「状态机复位」与「用量清零」的
耦合(复位后 1d 配额徽章不再永久停 0%);Overview 供应商状态卡片新增「状态复位」
按钮(POST /api/reset,不重排序、不清用量);修复 rlInfo.limited 与
is_rate_limited 键名不匹配致「限速中」徽章从未渲染。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
@ThreeFish-AI ThreeFish-AI changed the title Feature/1.x.x release(1.x.x): v0.5.2a7 → v0.5.2 —— 流式错误日志乱码修复 / 供应商状态复位 / v0.5.2 周期收口 Sep 10, 2026
@ThreeFish-AI
ThreeFish-AI merged commit cf91e46 into master Sep 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant