1
This commit is contained in:
@@ -94,3 +94,26 @@
|
||||
1. `legacyResultProfile` 继续长期作为结果页主列表来源风险很高
|
||||
2. 只做“按 id 回贴图片字段”在对象集合会漂移的链路里不够稳
|
||||
3. 后续如果继续推进后端单一真相源,应优先把结果页对象集合完全改为服务端最新 compile/preview 结果,而不是继续让前端桥接层承担最终裁决
|
||||
|
||||
---
|
||||
|
||||
## 8. 2026-04-21 补充:新建共创会话 500 根因
|
||||
|
||||
后续联调里又发现一条与资产合并无关、但会直接阻断创作入口的后端问题:
|
||||
|
||||
1. 点击“创建新 RPG 游戏”时,`POST /api/runtime/custom-world/agent/sessions` 返回 `500`
|
||||
2. 表面上前端只看到“服务器内部错误”,实际根因在路由层
|
||||
|
||||
本次补查确认:
|
||||
|
||||
1. `server-node/src/routes/customWorldAgent.ts` 这组路由内部直接使用 `request.userId!`
|
||||
2. 但路由文件本身在 `2026-04-21` 修复前没有挂 `requireJwtAuth(...)`
|
||||
3. 结果是 HTTP 请求虽然带了登录 token,但 `request.userId` 并不会被注入
|
||||
4. 后端继续拿 `undefined` 作为 `userId` 创建 / 读取 agent session,最终在仓储写库阶段触发 `500`
|
||||
|
||||
修复方式:
|
||||
|
||||
1. 在 `createCustomWorldAgentRoutes(...)` 顶部统一补上 `router.use(requireJwtAuth(context.config, context.userRepository))`
|
||||
2. 让 session 创建、读取、发消息、执行 action、读取 operation / card 详情全部走同一层鉴权注入
|
||||
|
||||
这次补丁的意义不是新增功能,而是把 `custom-world agent` 路由和其他 `rpg-entry / rpg-profile / rpg-runtime` 受保护接口重新对齐,避免再出现“路由里依赖 `request.userId`,但入口没挂鉴权”的低层断线问题。
|
||||
|
||||
Reference in New Issue
Block a user