fix(chat): delete needs the person's own yes; chat action ids never repeat

- chatChannels delete with confirm=true now runs only in the person's very
  next turn and only when their own message of that turn agrees, checked by a
  small fail-closed YES/NO call on the router model chain (the message fenced
  as data). A refusal, question, other topic or error cancels the request;
  an unconfirmed request lapses after one turn. The reply model's confirm
  flag alone can no longer delete.
- chat_action ids carry a per-run nonce and the session, so a late answer
  meant for an earlier connection (or worker run) never completes a newer
  action.
- Tests: agree, refuse, other topic, lapse, classifier failure, late answer
  across reconnects. Eval test_chat_delete_consent: 12 of 12 on qwen2.5:7b,
  3 runs. Spec and llm_contexts updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-11 14:08:35 +09:00
parent fe4e296361
commit 0182823592
8 changed files with 200 additions and 18 deletions

View File

@@ -239,6 +239,9 @@ which carry Discord's own time.
-> {"type": "chat_action_result", "id": "a1", "ok": true, "message_ids": ["..."]}
-> {"type": "chat_action_result", "id": "a1", "ok": false, "error": "..."}
```
Action ids are unique across connections and worker runs, and an answer whose id is not waiting
on this connection is ignored, so a late answer meant for an earlier connection never completes a
newer action.
With no registered channels the tool is not offered. An action waits up to 15 s for its result
(then it fails), and a closed session fails every waiting action. Each reply counts as one turn
per person, so a delete is confirmed only in that person's later reply.