Files
Jyotisha/docs/tasks/PROGRESS-consultation-session-capacity-20260915.md
T
jesse-ux 51a65d927f
Independent Staging Quality Gate / validate (push) Failing after 6m19s
Independent Staging Quality Gate / publish (push) Skipped
docs(tasks): record BUG-732 implementation SHA
2026-09-16 07:41:41 +08:00

64 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS · 对话上限一半被思考文本吃掉(2026-09-15)
工作树:`.worktrees/consultation-session-capacity-20260915`
分支:`codex/consultation-session-capacity-20260915`
任务书基线:`6b3248bf`;开工时 `origin/staging` = **`11893c7f`**。
修复提交:`11829cf7`
本机 Windows。无 Docker。
未改 `frontend/src/app/api/consult/route.ts``page.tsx`、Skill。未 bump Skill。BUG 号核对:该 SHA 最大号仍是 **BUG-720**,本单用预占 **BUG-732**,无冲突。
| 任务 | 状态 | 说明 |
| --- | --- | --- |
| 5.1 对话额度只数 `text` | 完成(运行时 DB 为环境缺口) | 新迁移 `20260916010000_consultation_session_capacity.sql` `CREATE OR REPLACE``v_chars``sum(length(elem->>'text'))` |
| 5.2 物理上限 `length(elem::text)` | 完成(同上) | 算式见下;两档都返回 `session_full` |
| 5.3 详情接口体积 | 完成(夹具量过) | 见下表;1.41 MiB 写入 `BLOCKED.md` 观察,本单不改接口 |
| 5.4 BUG-732 | 完成 | 关联 BUG-464;不是回归 |
## 实现要点
- 只新增一份迁移。函数签名、返回列、`error_code` 取值、advisory lock、`request_id` 幂等、200 条上限、`char_length(v_text) > 16000` 均未改。
- 物理上限算术(迁移注释原文):50 rounds × (~4,000 body + ~4,000 thinkingText + ~3,000 thinkingSections + ~3,000 receipts) ≈ 700,000。Headroom → 1,000,000。
- 实测 receipt(典型三域本命:12 行技法审计 + workflow + agentExecutionReceiptJSON **1,738 字符 / 1,950 字节**,小于任务书 3,000**不调高** 1,000,000。
- 实测 `thinkingSections` JSON 字符:1 域 1,246、2 域 1,968、3 域 2,702(任务书 1,521 / 2,243 / 2,977,同量级,计划文案有漂移)。
- 未删、未截断任何已存字段。
## 详情 JSON 体积(5.3
夹具:每轮用户提问 100 汉字 + 助手正文 4,000 汉字 + 思考 4,000 汉字 + 三域 `natalConsultationThinkingPlan` + 上面那份典型 receipt。`GET /api/sessions/[id]``{ session }``sessionSelect``messages`)。
| 口径 | 轮次 | UTF-8 字节 | MiB |
| --- | ---: | ---: | ---: |
| 改前(旧合并额度大约卡住的地方) | 19 | 562,240 | 0.536 |
| 改后(任务书字符口径约 50 轮) | 50 | 1,479,034 | 1.411 |
50 / 19 ≈ **2.63**。1.411 MiB 在 2 vCPU 上打开长会话会偏沉,观察项进 `BLOCKED.md`;分页不在本单。
PostgreSQL `length()` 按字节,与 BUG-464 相同。4,000 汉字正文 ≈ 12,000 字节,按字节撞 200,000 会早于「50 轮汉字」。上表 50 轮是任务书字符口径对照,不是汉字会话在线上能存到的轮数。物理上限 1,000,000 字节在这组夹具上仍晚于对话额度触发。
## 既有断言改动
| 文件 | 原值 | 新值 | 原因 |
| --- | --- | --- | --- |
| `database-local-business.test.ts` 迁移已应用列表 | 最末 `20260915010000_rectification_touch_chat_session.sql` | 另加 `20260916010000_consultation_session_capacity.sql` 及「不得复制进 db/migrations」 | 新迁移必须被 runner 应用到 |
未改幂等 / advisory lock / `session_missing` / 200 条满员三条既有用例。未改 `chat-session-authority.test.ts`(仍读 20260901010000 原文件,原文件未改)。
## 测试
| 命令 | 结果 |
| --- | --- |
| `./node_modules/.bin/tsc --noEmit` | 0 错 |
| `npx tsx --test tests/consultation-session-capacity.test.ts` | 6 pass / 0 fail |
| `npx tsx --test tests/consultation-*.test.ts tests/chat-session-*.test.ts` | 220 tests / 208 pass / **12 fail**:全部是 Windows `SKILL.md` symlink `EPERM``consultation-agentic-runtime``consultation-birth-time-mode``consultation-workflow-request` 整文件,以及 methodology 读 live skill 的 9 条)。与本单无关,既有环境缺口。本单 6 条与 `chat-session-*` 全绿 |
| `npx eslint`(本单三个测试文件 `--max-warnings 0` | 0 error / 0 warning |
| `npm run lint` | **0 error** / 119 warning(既有,未动) |
| `npm run db:migrate:check` | **blocked**`SCHEMA_DATABASE_URL is required` |
| `npm run test:db` | **blocked**39 tests / 7 pass / 27 fail / 5 skip。失败均为 `spawnSync docker ENOENT` 或 Windows symlink EPERM。本单 `database-consultation-session-capacity` **skip**`docker unavailable on this host`),不得写成通过 |
| 全量 `npx tsx --test tests/*.test.ts` | 3089 tests / 3001 pass / 73 fail / 15 skip。失败为无 Docker `ENOENT`、Windows `SKILL.md` symlink `EPERM`、以及 `G:\\G:\\` 路径加倍,与既有环境缺口同类。本单 6 条静态合同在该套件里通过;DB 用例 skip |
## 收尾限制
- 运行时 Postgres 合同本机未跑。有 Docker 的验收机必须跑 `npm run test:db`
- 详情接口未分页。50 轮夹具 1.41 MiB,见 `BLOCKED.md`