feat: restore parallel ops and diagnostics changes

This commit is contained in:
Codex
2026-07-14 06:40:02 +02:00
parent fcc5227cc1
commit a91238c200
22 changed files with 2039 additions and 63 deletions
+19 -1
View File
@@ -157,8 +157,26 @@
- `runtime.templates` 保存可复用的 Sub2API runtime 规则模板。模板本身不是账号绑定,不会自动接管未在 YAML 中声明的手工账号。
- `pool.defaultTempUnschedulableTemplate` 是 YAML-managed 账号的默认临时不可调度模板引用;`profiles.entries[].tempUnschedulableTemplate` 可以为明确声明的账号选择其他模板。`codex-pool sync --confirm` 只向这些 managed 账号渲染 `temp_unschedulable_enabled``temp_unschedulable_rules`
- YAML 未声明的账号属于 `runtime-manual``codex-pool runtime list|get` 可以显示其实际状态和 `matchingTemplate`,但与模板不同不构成 drift,也不得由 `sync` 自动纳管。
- `codex-pool runtime errors`实际 Sub2API 日志按账号聚合错误。规则状态码只能取 `account_upstream_error` 的观测值;`openai.forward_failed` 只作为脱敏错误摘要证据,不能凭摘要推测未观测状态码。
- `codex-pool runtime errors` 优先从 Sub2API 原生 admin/ops 能力读取服务数据:
- dashboard overview 提供请求分母、客户可见错误率和上游错误率;
- account availability 提供账号可用、限流、过载和错误状态;
- concurrency 提供组与账号容量、当前占用和排队;
- upstream errors 提供账号、状态码和根因详情;
- system-log 索引未保留策略事件时,才从 target runtime 日志补临时不可调度、failover、选号失败和 `forward_failed`,并披露 fallback
- 规则状态码只能取 `account_upstream_error` 的观测值;
- `openai.forward_failed` 只作为脱敏错误摘要证据,不能凭摘要推测未观测状态码;
- Sub2API Ops 上游错误记录覆盖全部错误账号和状态码,默认输出全池与账号主因;
- `policyEffectiveness` 通过 `request_id` 关联临时不可调度、切号、无候选和最终网关响应,并提供可交给 `trace` 的 request id
- 规则命中必须有 `account_temp_unschedulable` 日志证据,状态码相同不代表响应体关键词也命中;
- `requestIdCoverage` 必须披露事件关联缺口,缺少 request id 时不能用零关联证明策略链未发生;
- HTTP 200 与 `forward_failed` 可以在流式响应中并存,必须单列这类请求,不能仅凭最终 HTTP 状态判断客户收到完整终止事件;
- 窗口内最终错误占比只描述目标 API 路径的已完成日志事件,必须保留 `since``tail` 和分母覆盖边界;
- `--full` 才展开模型、小时、流式分布和有限详情样本;
- 账号当前并发只作为查询时快照,不能替代错误发生瞬间的历史并发证据;
- 没有账号全部路由尝试数时,只能报告错误数量,不能把错误记录数当作错误率;
- Ops 样本与 runtime 日志保持独立计数,不把时间邻近当作请求级关联。
- 手工账号的 runtime 配置必须通过 `codex-pool runtime apply|delete` 受控修改。写操作必须显式指定 `--account`,不带 `--confirm` 时只生成 dry-run,带 `--confirm` 才通过 Sub2API admin API 写入。
- `codex-pool trace` 优先使用原生 `/admin/ops/requests``/admin/ops/system-logs`target runtime 日志只补索引缺失的邻近事件;必须显式披露 target、runtime mode、主数据源、上下文数据源和读取状态。PK01 host-Docker 回退时不得固定读取 k3s Deployment,并且必须合并 Docker stdout/stderr 日志流。HTTP 200 与 `forward_failed` 并存且没有 failover 时应标记为 `degraded`
- 内置临时不可调度配置与外部 `sentinel.*` 是独立控制面。runtime 模板负责请求路径即时冷却与 failover;`sentinel.*` 负责账号 marker health、隔离、恢复和 probe 周期,任一控制面都不得静默重写另一控制面的状态或规则。
- The external sentinel write surface is intentionally limited to the Sub2API admin `schedulable` action. Sentinel freeze/restore may set `schedulable=false|true`, but must not write, clear, or indirectly clear Sub2API request-path runtime state such as `temp_unschedulable_until`, `temp_unschedulable_reason`, rate-limit, overload, or model-rate-limit state. In particular, sentinel restore must not call Sub2API `recover-state`, because that endpoint is a broader runtime-state recovery operation rather than a pure schedulability restore.
- Codex accounts selected by YAML do not declare `schedulable` as durable configuration. `codex-pool sync --confirm` must not restore existing account schedulability merely because YAML selects the account or sentinel state lacks an active quarantine. Existing `schedulable=false` is runtime state: the sentinel first reads Sub2API's actual account state, schedules a recovery probe for unschedulable managed accounts, and restores `schedulable=true` only after the marker probe matches.