teknium1
2afb405337
fix(approval): withdraw the queue entry when no client can answer; commit choices under the lock
...
Why: for an old WebSocket client that never advertised server→client requests,
send_async already failed fast (on_result(None)) but _emit_approval_request ignored
it, so the approval wait — owned by tools.approval's queue, not server_requests —
still idled for the whole approvals.timeout (300s) with no prompt anywhere. The
same held for a -32601 error frame. on_result(None) now withdraws the queue entry
(withdraw_gateway_approval: cancelled cause, never a user deny) so
_await_gateway_decision returns at once; the agent sees a withdrawn prompt.
resolve_gateway_approval committed entry.result/reason/event.set() AFTER
releasing _lock, so _drop_entry (which reads result and leaves the queue under
the lock) could still pop-and-lose a choice the client was acked for. Every
committer (resolve, clear_session, unregister_gateway_notify) now commits inside
the same critical section that pops the entry, which is what _drop_entry's
docstring promised.
_drop_entry mapped a withdrawn wait to settle("set") — the raw poll-state token
went out as the request.cancel reason. It is now session_closed, and a choice
from another surface is resolved (both RequestCancelReason values).
Tests: restore test_server_request_error_response_fails_fast (an error frame
settles send() to None promptly); the approval fail-fast probe from the review
(silent WS peer, timeout 3 -> was 3.2s, now immediate); a lock-instrumented
resolve test; a settle-reason test. The test_protocol `server` fixture imports
server_requests before its sys.modules patch window so the module server.py binds
its sinks on is the one tests import — the PR's fail-fast test only passed in a
full-file run before (order dependency).
Part of #112548
2026-09-17 09:04:38 -07:00
..
2026-09-16 17:09:50 -07:00
2026-09-14 22:01:32 +00:00
2026-09-16 17:21:14 -07:00
2026-09-17 09:02:55 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 17:13:22 -07:00
2026-09-15 04:12:13 -07:00
2026-09-17 20:38:43 +05:30
2026-09-11 19:39:12 -07:00
2026-09-17 09:04:38 -07:00
2026-09-03 13:49:57 -07:00
2026-09-15 21:46:37 -07:00
2026-09-03 13:49:57 -07:00
2026-09-17 09:04:38 -07:00
2026-09-03 09:44:26 -07:00
2026-09-17 00:34:50 -05:00
2026-09-17 21:17:26 +05:30
2026-09-16 17:19:58 -07:00
2026-09-16 16:55:05 -07:00
2026-09-16 22:25:33 -07:00
2026-09-16 22:25:33 -07:00
2026-09-16 17:19:58 -07:00
2026-09-03 17:13:22 -07:00
2026-09-12 01:35:05 -07:00
2026-09-16 16:59:03 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 13:49:57 -07:00
2026-09-03 14:16:54 -07:00
2026-09-02 22:47:50 -07:00
2026-09-02 22:47:50 -07:00
2026-09-15 06:16:38 -07:00
2026-09-15 06:16:38 -07:00
2026-09-11 19:39:12 -07:00
2026-09-03 14:16:54 -07:00
2026-09-13 12:35:36 -07:00
2026-09-16 16:57:03 -07:00
2026-09-03 14:16:54 -07:00
2026-09-03 14:16:54 -07:00
2026-09-15 06:16:38 -07:00
2026-09-03 14:16:54 -07:00
2026-09-10 10:35:07 -07:00
2026-09-17 09:02:55 -07:00
2026-09-16 17:12:11 -07:00
2026-09-17 09:02:55 -07:00
2026-09-15 04:56:01 -07:00
2026-09-13 05:09:43 -07:00
2026-09-16 14:34:22 -07:00
2026-09-16 21:15:09 +05:30
2026-09-03 17:13:22 -07:00
2026-09-16 17:47:50 -07:00
2026-09-04 00:15:16 -07:00
2026-09-16 17:14:28 -07:00
2026-09-02 23:08:22 -07:00
2026-09-15 19:09:29 -07:00
2026-09-15 03:45:41 -07:00
2026-09-15 03:45:41 -07:00
2026-09-11 19:39:12 -07:00
2026-09-15 04:13:47 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 03:56:17 -07:00
2026-09-15 18:41:46 -07:00
2026-09-03 00:10:18 -07:00
2026-09-16 16:56:46 -07:00
2026-09-08 02:26:05 +05:30
2026-09-15 04:12:13 -07:00
2026-09-15 04:12:13 -07:00
2026-09-10 10:23:12 -07:00
2026-09-06 12:02:43 -07:00
2026-09-13 21:05:42 -07:00
2026-09-15 18:40:52 -07:00
2026-09-16 16:56:46 -07:00
2026-09-03 17:13:22 -07:00
2026-09-15 03:45:41 -07:00
2026-09-03 00:10:18 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-11 15:29:15 -07:00
2026-09-03 17:13:22 -07:00
2026-09-09 11:46:36 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 22:48:08 -07:00
2026-09-03 03:31:03 -07:00
2026-09-03 13:33:47 -07:00
2026-09-07 00:28:46 +05:30
2026-09-17 21:17:26 +05:30
2026-09-15 03:57:24 -07:00
2026-09-03 13:10:52 -07:00
2026-09-15 03:57:24 -07:00
2026-09-17 21:17:26 +05:30
2026-09-16 17:19:31 -07:00
2026-09-03 17:13:22 -07:00
2026-09-12 21:55:07 -07:00
2026-09-16 16:59:03 -07:00
2026-09-02 22:50:57 -07:00
2026-09-13 21:03:11 -07:00
2026-09-16 16:42:47 -07:00
2026-09-16 16:42:47 -07:00
2026-09-11 19:39:12 -07:00
2026-09-16 17:21:14 -07:00
2026-09-13 14:37:17 -07:00
2026-09-16 10:43:48 -07:00
2026-09-12 12:32:55 -07:00
2026-09-17 00:11:27 -07:00
2026-09-10 02:21:16 +05:30
2026-09-16 14:34:59 -07:00
2026-09-15 13:00:12 +05:30
2026-09-15 19:00:42 -07:00
2026-09-15 04:54:30 -07:00
2026-09-15 09:29:00 -07:00
2026-09-16 16:50:27 -07:00
2026-09-03 17:13:22 -07:00
2026-09-10 02:21:16 +05:30
2026-09-02 23:56:55 -07:00
2026-09-15 19:04:29 -07:00
2026-09-13 05:09:43 -07:00
2026-09-17 08:51:30 -07:00
2026-09-16 16:52:05 -07:00
2026-09-15 04:12:13 -07:00
2026-09-17 08:51:30 -07:00
2026-09-16 21:15:37 +05:30
2026-09-12 01:35:05 -07:00
2026-09-13 15:41:01 -07:00
2026-09-07 22:47:33 +05:30
2026-09-15 04:55:14 -07:00
2026-09-11 15:27:23 -07:00
2026-09-17 08:51:30 -07:00
2026-09-17 21:18:03 +05:30
2026-09-17 08:51:30 -07:00
2026-09-16 00:32:15 -07:00
2026-09-09 12:19:13 +05:30
2026-09-03 01:43:42 -07:00
2026-09-04 00:15:16 -07:00
2026-09-02 22:59:19 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-13 20:46:22 -07:00
2026-09-12 21:13:40 -07:00
2026-09-04 00:15:16 -07:00
2026-09-16 17:01:30 -07:00
2026-09-03 17:13:22 -07:00
2026-09-11 19:58:07 -07:00
2026-09-13 14:35:32 -07:00
2026-09-16 00:32:15 -07:00
2026-09-17 08:52:27 -07:00
2026-09-03 09:44:26 -07:00
2026-09-12 22:09:19 -07:00
2026-09-04 00:15:16 -07:00
2026-09-11 15:26:46 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-17 08:53:48 -07:00
2026-09-15 18:39:09 -07:00
2026-09-16 17:55:07 -07:00
2026-09-11 11:54:49 -07:00
2026-09-03 01:36:04 -07:00
2026-09-11 15:26:46 -07:00
2026-09-15 03:58:05 -07:00
2026-09-03 01:41:16 -07:00
2026-09-15 19:03:33 -07:00
2026-09-04 08:15:22 -07:00
2026-09-17 08:47:01 -07:00
2026-09-03 13:33:47 -07:00
2026-09-17 08:47:01 -07:00
2026-09-09 12:19:13 +05:30
2026-09-15 19:03:33 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 00:55:09 -07:00
2026-09-15 19:01:39 -07:00
2026-09-13 05:09:43 -07:00
2026-09-15 14:15:59 +05:30
2026-09-07 05:59:43 -07:00
2026-09-11 11:54:49 -07:00
2026-09-15 14:15:59 +05:30
2026-09-16 17:43:11 -07:00
2026-09-12 21:50:30 -07:00
2026-09-06 07:17:03 -07:00
2026-09-03 00:05:14 -07:00
2026-09-11 11:54:49 -07:00
2026-09-04 00:15:16 -07:00
2026-09-06 07:17:03 -07:00
2026-09-16 00:32:15 -07:00
2026-09-16 17:23:44 -07:00
2026-09-03 13:27:01 -07:00
2026-09-15 18:33:15 -07:00
2026-09-16 17:05:08 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 01:09:12 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 03:46:29 -07:00
2026-09-16 17:56:08 -07:00
2026-09-15 18:58:30 -07:00
2026-09-05 19:01:22 +05:30
2026-09-07 06:05:51 -07:00
2026-09-03 13:24:04 -07:00
2026-09-15 10:48:49 +05:30
2026-09-15 02:22:22 -05:00
2026-09-16 06:27:23 -05:00
2026-09-10 11:48:01 -07:00
2026-09-14 16:16:08 -07:00
2026-09-03 01:13:51 -07:00
2026-09-12 01:35:05 -07:00
2026-09-03 09:44:26 -07:00
2026-09-11 15:26:46 -07:00
2026-09-11 15:44:00 -07:00
2026-09-13 05:09:43 -07:00
2026-09-15 03:41:43 -07:00
2026-09-13 21:04:08 -07:00
2026-09-10 02:21:16 +05:30
2026-09-15 00:41:13 +05:30
2026-09-12 10:00:08 +05:30
2026-09-03 13:17:25 -07:00
2026-09-13 05:07:50 -07:00
2026-09-13 05:09:43 -07:00
2026-09-16 17:21:37 -07:00
2026-09-15 05:36:37 -07:00
2026-09-15 18:25:17 -07:00
2026-09-03 13:20:22 -07:00
2026-09-15 03:54:01 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 05:32:38 -07:00
2026-09-03 13:20:22 -07:00
2026-09-03 01:17:43 -07:00
2026-09-03 13:20:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 03:54:01 -07:00
2026-09-03 13:20:22 -07:00
2026-09-13 05:07:50 -07:00
2026-09-16 17:12:11 -07:00
2026-09-13 12:35:36 -07:00
2026-09-17 09:02:55 -07:00
2026-09-13 09:18:54 -07:00
2026-09-17 09:02:55 -07:00
2026-09-13 05:07:50 -07:00
2026-09-11 19:14:24 -07:00
2026-09-03 13:30:31 -07:00
2026-09-13 14:39:29 -07:00
2026-09-03 13:24:36 -07:00
2026-09-03 13:24:36 -07:00
2026-09-13 05:07:11 -07:00
2026-09-15 18:42:38 -07:00
2026-09-15 18:43:05 -07:00
2026-09-05 18:46:16 +05:30
2026-09-16 17:43:40 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 00:10:38 -07:00
2026-09-15 04:12:13 -07:00
2026-09-13 12:35:36 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 00:27:38 -07:00
2026-09-03 17:13:22 -07:00