fix(capacity): align two stale checks with the rate-limit edit.
The consultation contract still required await directly before runConsultationWorkflow(toolInput), and a new report test shifted three privacy allowlist lines. Keep the toolInput lock and move that test to the end. No product code change. Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
904dfe9f79
commit
360a667e4f
+18
-2
@@ -36268,7 +36268,7 @@
|
||||
- 修复:对话 10 次/分钟且 120 次/小时,校正回合 5 次/分钟且 40 次/小时,报告生成另加 3 次/小时(每天 5 份仍在)。两档都还有余量才放行;拒绝时不写入任何一档,也不预留点数。响应是 429、`code: rate_limited` 和 `Retry-After`。
|
||||
- 验证:`frontend/tests/request-rate-limit.test.ts`;报告核心测试「hourly rate limit returns 429 and does not reserve」。
|
||||
- 防复发:上述测试锁住桶的边界、拒绝时不记入另一档,以及三条路由在预留点数之前判断。开案路由源码不得调用这组限流。
|
||||
- 相关记录:BUG-723(校正客户端已有的退避,本单不改)、BUG-1302(预热仍不占重计算名额)。
|
||||
- 相关记录:BUG-723(校正客户端已有的退避,本单不改)、BUG-1302(预热仍不占重计算名额)、BUG-1357(打回后补上的两条旧检查)。
|
||||
- 复发自:无
|
||||
- 修复版本:分支 `codex/beta-capacity-20261014`。
|
||||
|
||||
@@ -36283,8 +36283,24 @@
|
||||
- 修复:名额满时最多再等 8 秒,同时等待的人最多 4 个。等不到或等待的人已经满,仍抛 `HeavyComputeBusy`,`Retry-After` 仍是原来的秒数。对话对这种 429 最多再试 2 次,几次等待加起来不超过 15 秒。等待时进度行写「人有点多,排一下队」。仍失败则沿用原来的取消预留退点,只走一次,并告诉用户这一轮没排上、点数已退回。并发上限仍是 2。
|
||||
- 验证:`tests/test_api_heavy_compute_gate.py` 的排队拿到名额、等待者满立刻拒绝、超时仍 429;`frontend/tests/consultation-workflow-retry.test.ts`。
|
||||
- 防复发:上述测试。健康检查仍不进闸。校正客户端原有的退避(BUG-723)没有改。
|
||||
- 相关记录:BUG-717、BUG-723、BUG-1302、BUG-1345、BUG-1355。
|
||||
- 相关记录:BUG-717、BUG-723、BUG-1302、BUG-1345、BUG-1355、BUG-1357。
|
||||
- 复发自:无
|
||||
- 修复版本:分支 `codex/beta-capacity-20261014`。
|
||||
|
||||
## BUG-1357 | 限流改完后两条旧检查没跟上
|
||||
|
||||
- 状态:resolved
|
||||
- 首次发现:2026-10-15
|
||||
- 最近更新:2026-10-15
|
||||
- 影响面:`frontend/tests/consultation-voice-contract.test.ts`;`frontend/tests/personal-report-api.test.ts` 与 `tests/test_repo_privacy_markers.py` 的行号白名单。没有用户界面变化。
|
||||
- 用户现象:同一个人问太密、校正太密、报告太多会先停一下,人多时会先排一小会儿。这些都对。全量检查多出 2 条失败,这一版上不了线。
|
||||
- 触发条件:验收方对 `a54f75e5` 跑前端全量和 Python 全量。
|
||||
- 根因:对话路由把 `runConsultationWorkflow(toolInput` 包进排队重试,源码合同仍要求 `await` 紧贴函数名。报告的小时限流测试插在文件中部,把隐私白名单按行号锁定的三行各下移 13 行。被保护的行为都还在,不是泄漏。上一轮只跑了定向测试,这两条不在那一组里。
|
||||
- 修复:正则仍锁定 `runConsultationWorkflow(toolInput`,不再要求 `await` 紧贴。小时限流测试整段挪到文件末尾,断言原文不变,`SAFE_LINES` 不改。业务代码不改。
|
||||
- 验证:`docs/tasks/PROGRESS-beta-capacity-fix-20261015.md`。语音合同、报告接口、镜像不引用测试共 75 通过、0 失败;隐私扫描 62 通过、0 失败;tsc 退出码 0;lint 0 错误、123 条原有警告。
|
||||
- 防复发:改这三处路由的语句前,在 `frontend/tests` 和 `tests` 里 grep 被改写的原文。新测试不要插在 `SAFE_LINES` 锁定行的上面。
|
||||
- 相关记录:BUG-933、BUG-1014、BUG-1355、BUG-1356
|
||||
- 复发自:BUG-933(源码合同没在同一轮跟上)
|
||||
- 修复版本:分支 `codex/beta-capacity-20261014`。
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# 进度 · 内测容量修复(2026-10-15,第 1 次打回)
|
||||
|
||||
- 分支:`codex/beta-capacity-20261014`
|
||||
- 被验 SHA:`a54f75e5e33775d5dc91f3058f5505a56b498bf2`
|
||||
- 修复单:`docs/tasks/TASK-beta-capacity-fix-20261015.md`
|
||||
- 原任务书:`docs/tasks/TASK-beta-capacity-20261014.md`
|
||||
- 开工时本分支最大 Bug 编号:BUG-1356。本轮新增 BUG-1357。BUG-1351、BUG-1352、BUG-1353 已在本分支文件里,没有重用。
|
||||
|
||||
## 做了什么
|
||||
|
||||
- 先把最新 `origin/staging` 合并进本分支(不改写已推送的 `a54f75e5`)。合并只带进修复单和任务索引的一行。
|
||||
- 语音合同:仍锁「工作流调用的入参是 `toolInput`」,以及用户轮不塞工具 JSON。不再要求 `await` 紧贴函数名。
|
||||
- 隐私白名单:采用修复单推荐的做法 a。把「hourly rate limit returns 429」整段挪到 `personal-report-api.test.ts` 末尾,断言原文不变。`SAFE_LINES` 不改。三行回到 832、860、890,且整行与白名单一致。
|
||||
- 业务代码不改。
|
||||
|
||||
## 断言
|
||||
|
||||
| 位置 | 原值 | 新值 | 原因 |
|
||||
| --- | --- | --- | --- |
|
||||
| `consultation-voice-contract.test.ts`「consult user turn no longer dumps tool JSON」 | `/await runConsultationWorkflow\(toolInput/` | `/runConsultationWorkflow\(toolInput/` | 调用包进 `retryOnConsultationRateLimit`,`await` 不再紧贴函数名。仍锁入参是 `toolInput` |
|
||||
| `personal-report-api.test.ts` 小时限流测试的位置 | 插在「429 at the daily limit」和「502 model_unavailable」之间 | 文件末尾,断言原文不变 | 插在中部让三行白名单各下移 13 行。挪走后行号复原,不改 `SAFE_LINES` |
|
||||
|
||||
## 源码文本再搜一遍
|
||||
|
||||
在 `frontend/tests` 和 `tests` 里核对三条路由被改写的语句:
|
||||
|
||||
- 只有语音合同把 `await runConsultationWorkflow(toolInput` 写成必须匹配。已按上表改。
|
||||
- `consultation-workflow-contract.test.ts` 是在代理分支里断言**不**出现 `await runConsultationWorkflow`,与这次包装无关,没改。
|
||||
- 「暂时无法生成解读」仍在非排队失败的分支里,`consult-first-frame-and-pacing-20260928.test.tsx` 继续对得上,没改。
|
||||
- `toNextResponse` 多了响应头,没有测试按旧函数签名做源码断言。
|
||||
- Python 侧没有按这三处被改写语句做源码文本断言。
|
||||
|
||||
## 偏离与环境缺口
|
||||
|
||||
- 没有改数据库,没跑 `test:db`。没有跑前端全量 `npm test`,没有跑 Python 快速门。
|
||||
- 并发压测 `frontend/scripts/research/beta-load-smoke.mts` 未跑。没有测试验证码,修复单也写明本机和执行侧都连不上测试服务器,不要登预发。没有改前/改后并发数字,没有服务器占用采样。
|
||||
|
||||
## 自测
|
||||
|
||||
| 检查 | 命令 | 结果数字 |
|
||||
| --- | --- | --- |
|
||||
| 前端相关测试 | `node node_modules/tsx/dist/cli.mjs --test tests/consultation-voice-contract.test.ts tests/runtime-sources-no-test-imports.test.ts tests/personal-report-api.test.ts` | 75 通过,0 失败,0 取消 |
|
||||
| 隐私扫描 | `.venv\Scripts\python.exe -m pytest tests/test_repo_privacy_markers.py -q` | 62 通过,0 失败 |
|
||||
| 类型检查 | `frontend\node_modules\.bin\tsc --noEmit -p .` | 退出码 0 |
|
||||
| 前端 lint | `npm run lint` | 0 错误,123 条原有警告 |
|
||||
| 并发压测 | 未跑 `beta-load-smoke.mts` | 没有测试验证码,没有登预发 |
|
||||
@@ -179,7 +179,10 @@ test("consult user turn no longer dumps tool JSON that the model would parrot",
|
||||
assert.doesNotMatch(chartBranch, /JSON\.stringify\(toolInput\)/);
|
||||
assert.doesNotMatch(chartBranch, /经过服务端校验的工具参数/);
|
||||
assert.match(route, /文末技法审计表/);
|
||||
assert.match(chartBranch, /await runConsultationWorkflow\(toolInput/);
|
||||
// 原值: /await runConsultationWorkflow\(toolInput/
|
||||
// 新值: /runConsultationWorkflow\(toolInput/
|
||||
// 原因: 调用包进 retryOnConsultationRateLimit,await 不再紧贴函数名。仍锁工作流入参是 toolInput;用户轮不塞工具 JSON 的断言不动。
|
||||
assert.match(chartBranch, /runConsultationWorkflow\(toolInput/);
|
||||
});
|
||||
|
||||
// 原值: test "the opener is a shape — 反差, 谁推谁修, 扮演哪个象, then at most three actions"(锁 OPENER SHAPE 四步、≤ 20 字行动、降级路线「第 3 步照给」)
|
||||
|
||||
@@ -710,19 +710,6 @@ test("core create: 429 at the daily limit", async () => {
|
||||
assert.equal(response.body.code, "report_rate_limited");
|
||||
});
|
||||
|
||||
test("core create: hourly rate limit returns 429 and does not reserve", async () => {
|
||||
const billing = billingHarness();
|
||||
const response = await resolveReportCreate(baseDeps({
|
||||
billing: billing.billing,
|
||||
consumeReportRateLimit: () => ({ ok: false, retryAfterSeconds: 12, message: "这一小时的报告已经够多了,先停一下。" }),
|
||||
}));
|
||||
assert.equal(response.status, 429);
|
||||
assert.equal(response.body.code, "rate_limited");
|
||||
assert.equal(response.body.retryAfterSeconds, 12);
|
||||
assert.equal(response.headers?.["Retry-After"], "12");
|
||||
assert.equal(billing.reservations, 0);
|
||||
});
|
||||
|
||||
test("core create: 502 model_unavailable when no model is configured", async () => {
|
||||
const persistence = new MemoryPersistence();
|
||||
const response = await resolveReportCreate(baseDeps({
|
||||
@@ -1538,3 +1525,19 @@ test("core read: the detail response has no coverSubject, and never the fingerpr
|
||||
assert.doesNotMatch(body, new RegExp(BIRTH_FP));
|
||||
assert.doesNotMatch(body, /coverSubject|birthFingerprint|birth_date|latitude|longitude|timezone|birthPlaceLabel|北京/);
|
||||
});
|
||||
|
||||
// 原值: 插在「429 at the daily limit」和「502 model_unavailable」之间。
|
||||
// 新值: 整段挪到文件末尾,断言不变。
|
||||
// 原因: 插在中部让 privacy 白名单按行号锁定的三行各下移 13 行。挪到末尾后那三行回到原行号,SAFE_LINES 不改。
|
||||
test("core create: hourly rate limit returns 429 and does not reserve", async () => {
|
||||
const billing = billingHarness();
|
||||
const response = await resolveReportCreate(baseDeps({
|
||||
billing: billing.billing,
|
||||
consumeReportRateLimit: () => ({ ok: false, retryAfterSeconds: 12, message: "这一小时的报告已经够多了,先停一下。" }),
|
||||
}));
|
||||
assert.equal(response.status, 429);
|
||||
assert.equal(response.body.code, "rate_limited");
|
||||
assert.equal(response.body.retryAfterSeconds, 12);
|
||||
assert.equal(response.headers?.["Retry-After"], "12");
|
||||
assert.equal(billing.reservations, 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user