diff --git a/.trellis/workspace/zl-q/index.md b/.trellis/workspace/zl-q/index.md index 80e1fd5..fa6d19a 100644 --- a/.trellis/workspace/zl-q/index.md +++ b/.trellis/workspace/zl-q/index.md @@ -8,7 +8,7 @@ - **Active File**: `journal-1.md` -- **Total Sessions**: 5 +- **Total Sessions**: 6 - **Last Active**: 2026-04-13 @@ -19,7 +19,7 @@ | File | Lines | Status | |------|-------|--------| -| `journal-1.md` | ~276 | Active | +| `journal-1.md` | ~318 | Active | --- @@ -29,6 +29,7 @@ | # | Date | Title | Commits | |---|------|-------|---------| +| 6 | 2026-04-13 | 修复追问链路与上限判定 | - | | 5 | 2026-04-13 | feat: 邀请码显示功能 - 后端API + 前端对接 | - | | 4 | 2026-04-13 | 绑定积分重注册余额恢复提交 | `c55be6d` | | 3 | 2026-04-13 | 积分重注册余额恢复验证 | - | diff --git a/.trellis/workspace/zl-q/journal-1.md b/.trellis/workspace/zl-q/journal-1.md index f568834..f924e07 100644 --- a/.trellis/workspace/zl-q/journal-1.md +++ b/.trellis/workspace/zl-q/journal-1.md @@ -259,6 +259,48 @@ **验证**: ruff check ✅ / flutter analyze ✅ +### Git Commits + +(No commits - planning session) + +### Testing + +- [OK] (Add test results) + +### Status + +[OK] **Completed** + +### Next Steps + +- None - task complete + + +## Session 6: 修复追问链路与上限判定 + +**Date**: 2026-04-13 +**Task**: 修复追问链路与上限判定 + +### Summary + +定位并修复 follow_up 上下文解析报错;将追问上限改为基于 assistant 回复数;补充单测与集成测试并通过。 + +### Main Changes + +| 项目 | 说明 | +|------|------| +| 追问报错根因 | `worker-agent.log` 中 `AgentChatMessageMetadata` 校验失败,原因是历史 metadata 存在 snake_case 字段与 alias 契约不一致 | +| 结构修复 | `divination` 相关模型启用 `populate_by_name=True`,允许 snake_case/alias 一致解析;用户消息缓存写入统一 `by_alias=True` | +| 上限逻辑 | 会话运行上限由按 user 消息数改为按 assistant 消息数统计 | +| 回归测试 | 新增 `backend/tests/unit/test_runtime_context_messages.py` 覆盖 snake_case metadata 场景 | +| 集成测试 | 新增 `backend/tests/integration/test_follow_up_flow.py`,验证 chat->follow_up 成功、assistant=2 后再次 follow_up 返回 409 | + +**验证结果**: +- `uv run ruff check`(相关文件)通过 +- `uv run pytest backend/tests/unit/test_runtime_context_messages.py backend/tests/unit/test_runtime_models_worker_output.py backend/tests/unit/test_history_message_schema.py` 通过 +- `./infra/scripts/app.sh restart` 后,`uv run pytest backend/tests/integration/test_follow_up_flow.py` 通过 + + ### Git Commits (No commits - planning session)