Files
PolyGateway/research-wiki/plans/issue10-error-body-retention-plan.md
iomgaa 1489aab95d docs: add the missing imports to the plan's key interfaces
Codex review: the code blocks reference httpx and PolyGatewayError, but
neither module imports them today. A zero-context implementer copying
them verbatim would stall on F821.
2026-08-16 05:57:07 -04:00

2.1 KiB

type, node_id, title, date
type node_id title date
plan plan:issue10-error-body-retention-plan 实现计划: HTTP 错误响应体留存(Issue #10) 2026-08-16

实现计划: HTTP 错误响应体留存(Issue #10)

全文: plans/2026-08-16-issue10-error-body-retention.md|实现: design:issue10-error-body-retention|分支: feat/issue-10-error-body-retention

任务分解

# 任务 产出
1 内核字段 PolyGatewayError.body_text(默认空串)+ 与 raw_text 的界限 docstring
2 共享摘要单元 新建 transports/_http_errors.py:summarize_body / compose_message / response_body
3 openai_compat 收口 _status_to_error 表驱动;429 判类型仍读原文
4 monkey_ocr 收口 _classify_status 同款,含 ResponseNotRead 降级
5 端到端验收 400 调用后 SQLite error 列含摘要——本计划的硬判据
6 文档与版本 1.2.0、README pin >=1.2,<2、CHANGELOG、ARCHITECTURE §6.2
7 合并前门 lint + 全套件 + 全新上下文 verifier

依赖:1‖2 → 3‖4 → 5 → 6 → 7。

计划期钉死的两条实现红线

  1. 429 判 insufficient_quota 必须解析未截断原文,不得改用摘要——摘要会破坏 JSON,超长体一旦改用摘要解析,配额耗尽的源将不再 force_open,把诊断改进变成治理 bug。Task 3.4 有专门回归用例。
  2. message 主体逐字保持 1.1.2 原样,只在末尾追加摘要后缀;状态码→分类映射逐条不变,验收要求既有分类断言零改写。

保真校验

不涉及 reference/ 迁移。错误分类映射不变,保真体现为"既有分类断言全部保留"。

执行期观察

Task 计划提交时 pre-commit 钩子的全套件跑出现一次 tests/e2e/test_compat_projects.py::TestGovDocOnboarding::test_call_site_shape_runs_governed 失败,单独跑与 e2e 全目录跑(7 passed / 23.30s,每例 2-3.5s)均通过,重跑全套件亦通过 → 判为真实网关抖动,非回归。该用例正是 design:issue8-stall-budget 当年记录的三个漂移用例之一,e2e 打真实网关的固有 flaky 面仍在。