Repository navigation
v0.6.4 - Access Freezes After Content Refusals, Server Node Monitoring, Automatic Model Pricing, and Large Requests Without CPU Spikes
v0.6.4 - Access Freezes After Content Refusals, Server Node Monitoring, Automatic Model Pricing, and Large Requests Without CPU Spikes
Seventeen pull requests since v0.6.3. Pair it with codeProxy v0.7.3 to see the server node cards, access freezes, the request log's Agent column and the price resync. Six database migrations run at startup, and Codex content refusals now freeze the requester's access to Codex by default. See Upgrade Notes.
Highlights
1. Large requests no longer pin the CPU
- Translating a large Responses request for Antigravity rewrote the whole request once per item, so the cost grew with request size times item count. On 2026-11-16 a burst of multi-megabyte Codex requests carrying screenshots held the production slot at its CPU quota, and database reads timed out behind it; a CPU profile put 66.5% of the time in that translation. The request is now built in one pass (#1301).
- An audit of the other request translators found 15 more loops of the same shape across the Claude, OpenAI-compatible, Gemini, Gemini CLI and Antigravity targets. All of them are rewritten (#1303).
- The single-node watchdog now SIGKILLs the active slot only when it stops answering HTTP. A slot that is slow and answers 503 is left alone; on 2026-11-16 the overloaded slot was killed with its requests in flight (#1302).
2. Access freezes after upstream content refusals
- Codex's
cyber_policyrefusal is recognized as an upstream content refusal. The request is no longer retried on other accounts, no account is cooled down, and the route trace recordsupstream_content_refusal. - Each refusal is kept as evidence against the requester: the portal account that owns the key (covering all of its keys), or the key itself when it has no portal account. Once the tenant's threshold is reached (default 1; 0 only records), the requester's access to that provider is frozen while other providers keep working. A request that only the frozen provider can serve gets a 403
provider_access_frozenwith an explanation, before anything is sent upstream. - Freezes, the evidence, the threshold and manual release live under
/v0/management/end-users/access-freezes, and every automatic freeze is audited (#1297).
3. Server node and database monitoring
GET /v0/management/clusterreturns a resource snapshot of every node: CPU including steal, memory, the slot's quota, traffic, egress and disks (#1304, #1307).- The leader probes the shared PostgreSQL server, and the new optional
clirelay-hostagent(unit file indeploy/cluster/hostagent/) reports the disks of a database host that runs no node (#1307). - Disk growth is measured between low-water marks, so request bodies passing through
/tmpno longer look like a disk filling up (#1310). A disk's read-only flag now comes from the filesystem instead of the sandboxed view of the mount (#1309).
4. DNS failover and shared Redis
clirelay-dnswatchcan manage Cloudflare-proxied records (proxied, off by default) (#1304) and gains a primary/standby mode: a node markedstandby: truestays out of DNS while a primary serves, takes over once every primary is down, and steps back after a primary recovers (#1306).- The dnswatch unit now loads on systemd 249 (Ubuntu 22.04), and
-checkshows the standby node (#1308). - In cluster mode, a shared Redis command lost to packet loss is retried once within the request's budget and no longer marks the node's shared state unavailable. That now takes timeouts in more than half of the recent results, or a streak of failures lasting at least 3 seconds; a refused connection still degrades at once (#1305).
5. Model pricing and request costs
- New models get their price from catalog listings automatically. After a price change, the costs of the last seven days of request logs and usage rollups are brought in line: by default only requests logged without a price are filled, and
"resync_history": "reprice_7d"recomputes all of them to correct a wrong price (#1313). - Listings that give no price, such as most video and music generators, are skipped instead of rewriting a zero price on every run (#1314).
6. Request logs record the client
- Every request log row records which client sent it (Codex Desktop, CLI, exec, VS Code and SDK, Claude Code, Gemini CLI, Qwen Code, Antigravity, OpenCode, Cherry Studio and others), its version and the User-Agent, and the logs can be filtered by client (#1311).
7. Codex and Antigravity
- Opt-in incremental upstream requests for Codex (ChatGPT accounts):
codex-upstream-incrementalkeeps one upstream WebSocket per conversation and sends only what a turn adds plusprevious_response_id, for HTTP Responses and Chat Completions clients alike.shadowcompares and logs without changing what is sent, and anything that does not line up goes in full. Off by default (#1315). - A Responses WebSocket session pinned to an account that has run out of its 5-hour or weekly quota now moves to another account, instead of failing every turn with
exceeded retry limit, last status: 429(#1316). Thanks to the relay user who reported it. - Refreshing an Antigravity account's live model list resolves the account's proxy in its own tenant instead of the system configuration (#1312). Thanks @deicer (#1300).
Detailed Changes
Backend CliRelay
- fix(responses-ws): move a pinned session off an account that ran out of quota (#1316)
- feat(codex): send turns upstream as increments over a pinned websocket (#1315)
- fix(usage): skip autofill listings that give no price (#1314)
- feat(usage): price new models automatically and resync logged request costs (#1313)
- fix(antigravity): use the tenant proxy for live model refresh, landing #1300 (#1312)
- feat(usage): record which client sent each request (#1311)
- fix(nodemetrics): measure disk growth between low-water marks (#1310)
- fix(nodemetrics): take read_only from the filesystem, not the sandboxed view (#1309)
- fix(dnswatch): start on systemd 249 and show the standby node in -check (#1308)
- feat(cluster): disks on every node, the PostgreSQL server from the leader, and the database host (#1307)
- feat(dnswatch): keep standby nodes out of DNS while a primary serves (#1306)
- fix(cluster): stop one lost shared Redis command from taking the node off the shared state (#1305)
- feat(cluster): node resource snapshots in /cluster and proxied dnswatch records (#1304)
- fix(translator): stop quadratic rewrites in the remaining request translators (#1303)
- fix(deploy): only SIGKILL a slot that stops answering, not a slow one (#1302)
- fix(translator): stop quadratic rewrites of large Antigravity requests (#1301)
- feat(accessfreeze): freeze a requester's access to a provider after an upstream content refusal (#1297)
Upgrade Notes
- Update the panel as well. codeProxy v0.7.3 shows the server node and database cards, access freezes with their release, the request log's Agent column and the price resync report. Each appears only on a backend that declares it.
- Content refusals freeze by default. With the default threshold of 1, the first Codex
cyber_policyrefusal freezes that requester's access to Codex until an administrator releases it. Set the tenant's threshold to 0 in the panel, or withPUT /v0/management/end-users/access-freezes/settings, to only record refusals. - Six database migrations run at startup. They add the access freeze tables, node snapshots, a hosts table, the request log client columns, one-hour cache writes on request logs and the pricing resync job queue.
- Incremental Codex upstream stays off until
codex-upstream-incremental.modeis set toshadoworon; seeconfig.example.yaml. - Host scripts are not deployed by the release. Hosts running
deploy/single-node/clirelay-watchdog.shor the dnswatch unit should copy the new versions by hand.clirelay-hostagentis built fromcmd/clirelay-hostagentand is not part of the release archives. - The Go toolchain and the deploy script version are unchanged.
Binaries for six platforms and the GHCR image ghcr.io/kittors/clirelay:v0.6.4 are published by the release workflows. Released together with codeProxy v0.7.3.
中文说明(点击展开)
v0.6.4 - 上游内容拒绝后冻结访问、服务器节点监控、模型自动定价、大请求不再打满 CPU
自 v0.6.3 起共 17 个 PR。请与 codeProxy v0.7.3 一起升级,才能看到服务器节点卡片、访问冻结、请求日志的 Agent 列和改价重算。启动时会执行 6 个数据库迁移;Codex 的内容安全拒绝默认会冻结发起者对 Codex 的访问。详见升级提示。
核心更新
1. 大请求不再打满 CPU
- 把大的 Responses 请求翻译给 Antigravity 时,每处理一个元素就重写一遍整个请求,成本是「请求大小 × 元素个数」。2026-11-16 一批带截图的数 MB Codex 请求让生产 slot 一直顶在 CPU 配额上,读库操作排在后面超时;CPU 剖析显示 66.5% 的时间花在这段翻译上。现在一次构建完成(#1301)。
- 逐个审计其余请求翻译器,在 Claude、OpenAI 兼容、Gemini、Gemini CLI 和 Antigravity 目标上又找到 15 处同样的循环,全部改写(#1303)。
- 单机看门狗只在当前 slot 不再回应 HTTP 时才 SIGKILL。只是慢、回 503 的 slot 不再被杀;2026-11-16 那次过载的 slot 连同在途请求一起被杀掉了(#1302)。
2. 上游内容拒绝后冻结访问
- Codex 的
cyber_policy拒绝被识别为上游内容安全拒绝:不再换号重试,不冷却任何账号,路由记录写upstream_content_refusal。 - 每次拒绝都作为证据记在发起者名下:发起者是 Key 所属的门户账号(作用于其名下所有 Key),没有门户账号的 Key 就是 Key 本身。达到租户阈值后(默认 1;0 表示只记录),冻结发起者对该上游类型的访问,其他上游照常可用。只有被冻结的上游能提供的请求,在发往上游之前就返回 403
provider_access_frozen,并附说明。 - 冻结记录、证据、阈值和手动解冻都在
/v0/management/end-users/access-freezes下,每次自动冻结都记审计(#1297)。
3. 服务器节点与数据库监控
GET /v0/management/cluster返回每个节点的资源快照:含 steal 的 CPU、内存、slot 配额、流量、出口和磁盘(#1304、#1307)。- leader 探测共享 PostgreSQL;新增可选的
clirelay-hostagent(单元文件在deploy/cluster/hostagent/),上报不跑节点的数据库主机自己的磁盘(#1307)。 - 磁盘增长改为在低水位之间计算,经过
/tmp的请求体不再被当成磁盘在涨(#1310);磁盘只读标志改从文件系统读取,不再取沙箱里看到的挂载视图(#1309)。
4. DNS 故障切换与共享 Redis
clirelay-dnswatch可以管理 Cloudflare 代理(橙云)记录(proxied,默认关闭)(#1304),并新增主备模式:标了standby: true的节点在有主节点服务时不进 DNS,所有主节点都挂了才接管,主节点恢复后再退出(#1306)。- dnswatch 单元在 systemd 249(Ubuntu 22.04)上可以加载了,
-check会显示备用节点(#1308)。 - 集群模式下,因丢包丢失的共享 Redis 命令会在请求预算内重试一次,不再因此把整台节点的共享状态标成不可用。现在要近期结果里超时过半,或连续失败持续至少 3 秒才降级;连接被拒绝仍立即降级(#1305)。
5. 模型定价与请求费用
- 新模型自动从模型清单取价。改价后,近 7 天请求日志和用量汇总的费用会对齐到新价:默认只补记录时没有价格的请求,
"resync_history": "reprice_7d"会全部重算,用来纠正填错的价格(#1313)。 - 不给价格的清单条目(多数视频、音乐生成模型)直接跳过,不再每轮都把零价写一遍(#1314)。
6. 请求日志记录客户端
- 每条请求日志都记下发起的客户端(Codex Desktop、CLI、exec、VS Code 与 SDK,Claude Code、Gemini CLI、Qwen Code、Antigravity、OpenCode、Cherry Studio 等)、版本和 User-Agent,并可按客户端筛选(#1311)。
7. Codex 与 Antigravity
- Codex(ChatGPT 账号)可选的增量上游请求:
codex-upstream-incremental为每个会话保持一条上游 WebSocket,每轮只发新增内容加previous_response_id,HTTP Responses 和 Chat Completions 客户端都受益。shadow模式只比对、记日志,不改变发出的内容;对不上的一律整包发送。默认关闭(#1315)。 - Responses WebSocket 会话钉住的账号用完 5 小时或每周额度后,会换到别的账号,不再每轮都以
exceeded retry limit, last status: 429失败(#1316)。感谢报告这个问题的 relay 用户。 - 刷新 Antigravity 账号的实时模型列表时,在账号所属租户里解析它的代理,不再用系统配置(#1312)。感谢 @deicer(#1300)。
详细变更
后端 CliRelay
- fix(responses-ws):会话钉住的账号额度用完后换号(#1316)
- feat(codex):经钉住的 WebSocket 向上游只发增量(#1315)
- fix(usage):自动补价跳过不给价格的清单条目(#1314)
- feat(usage):新模型自动定价并重算已记录的请求费用(#1313)
- fix(antigravity):刷新实时模型时使用租户代理,合入 #1300(#1312)
- feat(usage):记录每个请求的客户端(#1311)
- fix(nodemetrics):在低水位之间计算磁盘增长(#1310)
- fix(nodemetrics):只读标志取自文件系统而非沙箱视图(#1309)
- fix(dnswatch):在 systemd 249 上启动,
-check显示备用节点(#1308) - feat(cluster):每个节点的磁盘、leader 探测的 PostgreSQL 与数据库主机(#1307)
- feat(dnswatch):主节点服务时备用节点不进 DNS(#1306)
- fix(cluster):丢一条共享 Redis 命令不再让节点脱离共享状态(#1305)
- feat(cluster):
/cluster返回节点资源快照,dnswatch 支持代理记录(#1304) - fix(translator):消除其余请求翻译器里的平方级重写(#1303)
- fix(deploy):只 SIGKILL 不再回应的 slot,不杀只是慢的(#1302)
- fix(translator):消除大 Antigravity 请求的平方级重写(#1301)
- feat(accessfreeze):上游内容拒绝后冻结发起者对该上游的访问(#1297)
升级提示
- 同时升级面板。 codeProxy v0.7.3 显示服务器节点与数据库卡片、访问冻结与解冻、请求日志的 Agent 列和改价重算结果,都只在后端声明支持时出现。
- 内容拒绝默认会冻结。 默认阈值为 1,第一次 Codex
cyber_policy拒绝就会冻结该发起者对 Codex 的访问,直到管理员解冻。在面板或用PUT /v0/management/end-users/access-freezes/settings把租户阈值设为 0,即只记录不冻结。 - 启动时执行 6 个数据库迁移:访问冻结表、节点快照、主机表、请求日志客户端列、请求日志的 1 小时缓存写入列和改价重算任务队列。
- Codex 增量上游默认关闭,把
codex-upstream-incremental.mode设为shadow或on才生效,见config.example.yaml。 - 主机脚本不随发版部署。 运行
deploy/single-node/clirelay-watchdog.sh或 dnswatch 单元的主机需手工更新到新版本。clirelay-hostagent从cmd/clirelay-hostagent构建,不在发布包里。 - Go 工具链和部署脚本版本都没有变化。
发布工作流会产出六个平台的二进制和 GHCR 镜像 ghcr.io/kittors/clirelay:v0.6.4。本版与 codeProxy v0.7.3 一起发布。