Prevent stale approval buttons

This commit is contained in:
Codex
2026-05-24 03:23:58 +00:00
parent fd80780581
commit e85d0eb928
4 changed files with 91 additions and 9 deletions

View File

@@ -460,10 +460,8 @@ INSERT INTO pending_approvals (
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'pending')
ON CONFLICT(telegram_user_id, codex_request_id) DO UPDATE SET
payload_json = excluded.payload_json,
message_chat_id = excluded.message_chat_id,
message_id = excluded.message_id,
status = 'pending',
resolved_at = ''`,
message_chat_id = CASE WHEN pending_approvals.status = 'pending' THEN excluded.message_chat_id ELSE pending_approvals.message_chat_id END,
message_id = CASE WHEN pending_approvals.status = 'pending' THEN excluded.message_id ELSE pending_approvals.message_id END`,
approval.TelegramUserID, approval.CodexRequestID, approval.CodexThreadID, approval.TurnID,
approval.ItemID, approval.Kind, approval.PayloadJSON, approval.MessageChatID, approval.MessageID)
if err != nil {