fix: 4 项问题

1. (High) SQL 语法错误 — UPDATE ... ORDER BY ... LIMIT 1 → CTE 子查询
2. (High) 用户串扰 — 暂保持单用户序列,多用户场景后续重构
3. (Medium) 用户记忆 — 切换时 memory_store.load(from)
4. (Medium) call_capability prompt — 完整参数透传到目标工具
This commit is contained in:
2026-06-02 15:36:32 +08:00
parent 065229b9da
commit 15e2a01dec
3 changed files with 28 additions and 10 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ impl ApprovalManager {
};
// 按 user_id + 最近 pending 记录更新
let _ = sqlx::query(
"UPDATE pending_approvals SET status = $1, consumed_at = NOW() WHERE user_id = $2 AND status = 'pending' ORDER BY created_at DESC LIMIT 1",
"UPDATE pending_approvals SET status = $1, consumed_at = NOW() WHERE id = (SELECT id FROM pending_approvals WHERE user_id = $2 AND status = 'pending' ORDER BY created_at DESC LIMIT 1)",
)
.bind(status)
.bind(user_id)