AochenShen99
a5599c100c
fix(gateway): honour on_disconnect on /wait endpoints ( #3267 )
...
* fix(gateway): honour on_disconnect on /wait endpoints (#3265 )
The non-streaming /threads/{tid}/runs/wait and /runs/wait handlers used
to await record.task directly with no disconnect handling and silently
swallow CancelledError. When a long tool call (e.g. pip install inside
a custom skill) kept the connection idle long enough for an
intermediate HTTP layer to time out, the handler would still read the
in-progress checkpoint and return it as if the run had completed
normally -- masking a half-finished run as a successful response.
Add wait_for_run_completion in app.gateway.services that mirrors
sse_consumer's bridge-consumption pattern: subscribe to the stream
bridge until END_SENTINEL, poll request.is_disconnected on every
wake-up, and on real client disconnect cancel the background run when
record.on_disconnect is "cancel". Wire it into both wait endpoints.
The streaming path was unaffected because sse_consumer already has
this loop; this just brings /wait to parity.
* fix(gateway): skip checkpoint serialization on /wait disconnect
Copilot review on #3267 caught a follow-on of the same #3265 bug: when
the client disconnects, wait_for_run_completion breaks out of the bridge
loop and cancels the run, but the /wait endpoint then continues to read
the checkpointer and serializes whatever partial checkpoint exists as a
normal 200 response.
Have the helper return a bool — True only when END_SENTINEL was observed
— and skip the checkpoint serialization path on False. Also reorder the
inner check so END_SENTINEL is honoured even when is_disconnected() flips
true in the same iteration; the run truly finished so the real final
checkpoint is still valid.
2026-05-28 07:22:39 +08:00
..
2026-05-26 23:03:49 +08:00
2026-05-26 23:30:24 +08:00
2026-05-12 23:18:54 +08:00
2026-04-26 15:09:25 +08:00
2026-05-26 23:30:24 +08:00
2026-03-27 20:03:30 +08:00
2026-04-30 11:40:28 +08:00
2026-05-21 14:44:34 +08:00
2026-05-21 14:44:34 +08:00
2026-05-20 10:16:31 +08:00
2026-05-06 10:17:55 +08:00
2026-05-15 22:15:58 +08:00
2026-05-16 09:24:40 +08:00
2026-04-26 11:08:11 +08:00
2026-04-26 22:20:57 +08:00
2026-04-26 11:08:11 +08:00
2026-04-28 11:34:07 +08:00
2026-05-20 16:37:36 +08:00
2026-05-02 15:19:28 +08:00
2026-05-21 14:36:07 +08:00
2026-04-14 10:29:44 +08:00
2026-04-26 11:09:55 +08:00
2026-05-26 23:03:49 +08:00
2026-04-19 22:00:58 +08:00
2026-03-30 07:41:18 +08:00
2026-04-25 19:40:06 +08:00
2026-04-07 18:21:22 +08:00
2026-05-01 22:19:50 +08:00
2026-05-21 16:49:31 +08:00
2026-03-29 21:03:58 +08:00
2026-05-04 09:56:16 +08:00
2026-05-04 09:56:16 +08:00
2026-05-02 15:04:11 +08:00
2026-03-14 22:55:52 +08:00
2026-04-26 11:05:47 +08:00
2026-03-29 15:31:18 +08:00
2026-05-07 16:15:15 +08:00
2026-05-07 16:15:15 +08:00
2026-05-09 09:27:02 +08:00
2026-05-05 23:17:42 +08:00
2026-05-22 21:44:05 +08:00
2026-05-13 23:45:47 +08:00
2026-05-13 23:45:47 +08:00
2026-05-26 23:30:24 +08:00
2026-05-20 10:00:17 +08:00
2026-05-10 22:28:29 +08:00
2026-05-10 22:28:29 +08:00
2026-04-30 11:25:33 +08:00
2026-04-11 17:48:04 +08:00
2026-03-31 22:19:27 +08:00
2026-04-10 17:43:39 +08:00
2026-05-09 19:39:36 +08:00
2026-04-26 11:09:56 +08:00
2026-04-08 17:13:39 +08:00
2026-04-26 11:09:55 +08:00
2026-04-06 22:14:12 +08:00
2026-04-18 22:47:42 +08:00
2026-04-10 17:43:39 +08:00
2026-05-21 21:18:10 +08:00
2026-05-11 17:38:37 +08:00
2026-05-21 21:18:10 +08:00
2026-05-23 00:09:06 +08:00
2026-05-11 17:38:37 +08:00
2026-05-21 21:06:19 +08:00
2026-03-23 18:07:33 +08:00
2026-03-14 22:55:52 +08:00
2026-03-26 14:20:18 +08:00
2026-05-18 22:07:01 +08:00
2026-05-26 23:19:57 +08:00
2026-05-19 22:11:46 +08:00
2026-04-24 16:00:14 +08:00
2026-04-28 11:34:07 +08:00
2026-05-22 21:20:28 +08:00
2026-05-07 08:34:43 +08:00
2026-05-07 08:34:43 +08:00
2026-04-30 12:41:09 +08:00
2026-04-11 16:52:10 +08:00
2026-05-08 10:13:11 +08:00
2026-05-20 10:16:31 +08:00
2026-05-17 08:26:04 +08:00
2026-05-01 13:23:26 +08:00
2026-04-30 22:27:14 +08:00
2026-05-07 16:15:15 +08:00
2026-05-21 14:36:07 +08:00
2026-05-21 07:27:00 +08:00
2026-05-21 10:28:57 +08:00
2026-04-25 09:18:13 +08:00
2026-03-14 22:55:52 +08:00
2026-05-27 08:32:57 +08:00
2026-05-19 22:11:46 +08:00
2026-04-03 11:21:58 +08:00
2026-05-15 10:26:35 +08:00
2026-05-15 10:26:35 +08:00
2026-04-26 11:13:01 +08:00
2026-04-26 15:09:25 +08:00
2026-04-17 12:00:31 +08:00
2026-04-26 11:09:55 +08:00
2026-04-26 15:09:25 +08:00
2026-05-20 22:34:10 +08:00
2026-04-14 15:01:06 +08:00
2026-05-05 23:17:42 +08:00
2026-05-15 22:30:05 +08:00
2026-03-22 20:39:26 +08:00
2026-04-26 11:05:47 +08:00
2026-04-26 11:09:55 +08:00
2026-04-09 16:07:16 +08:00
2026-03-20 17:18:59 +08:00
2026-03-26 15:07:05 +08:00
2026-05-05 23:17:42 +08:00
2026-05-09 09:49:08 +08:00
2026-05-21 16:22:09 +08:00
2026-04-26 11:13:01 +08:00
2026-04-10 20:40:30 +08:00
2026-05-17 15:23:42 +08:00
2026-03-14 22:55:52 +08:00
2026-03-14 22:55:52 +08:00
2026-05-21 14:44:34 +08:00
2026-04-26 15:09:25 +08:00
2026-05-15 10:32:09 +08:00
2026-05-22 21:42:14 +08:00
2026-05-23 22:43:34 +08:00
2026-05-21 14:48:28 +08:00
2026-05-23 00:09:06 +08:00
2026-05-21 14:48:28 +08:00
2026-04-26 15:09:25 +08:00
2026-05-20 14:52:58 +08:00
2026-05-03 23:40:59 +08:00
2026-05-22 21:20:28 +08:00
2026-05-22 21:20:28 +08:00
2026-05-22 21:20:28 +08:00
2026-04-07 17:15:24 +08:00
2026-05-21 14:44:34 +08:00
2026-04-09 17:21:23 +08:00
2026-04-09 17:21:23 +08:00
2026-04-18 08:46:59 +08:00
2026-05-21 20:35:46 +08:00
2026-05-17 08:59:42 +08:00
2026-03-30 16:02:23 +08:00
2026-03-26 14:20:18 +08:00
2026-05-02 16:22:35 +08:00
2026-05-12 23:18:54 +08:00
2026-05-12 23:18:54 +08:00
2026-05-09 19:43:50 +08:00
2026-05-10 22:00:57 +08:00
2026-05-01 13:23:26 +08:00
2026-03-25 16:28:33 +08:00
2026-04-23 14:06:14 +08:00
2026-05-21 21:18:10 +08:00
2026-05-01 13:23:26 +08:00
2026-05-03 23:40:59 +08:00
2026-05-07 08:34:43 +08:00
2026-05-07 08:34:43 +08:00
2026-03-30 16:02:23 +08:00
2026-04-06 14:51:10 +08:00
2026-05-18 22:19:32 +08:00
2026-05-08 10:08:53 +08:00
2026-04-23 23:59:47 +08:00
2026-05-02 06:37:49 +08:00
2026-04-12 16:40:21 +08:00
2026-05-10 22:47:30 +08:00
2026-04-28 14:53:18 +08:00
2026-05-15 10:26:35 +08:00
2026-05-21 07:47:19 +08:00
2026-05-21 21:18:10 +08:00
2026-03-26 17:39:16 +08:00
2026-05-12 23:21:22 +08:00
2026-05-18 22:25:02 +08:00
2026-05-23 23:25:38 +08:00
2026-05-22 21:42:14 +08:00
2026-05-12 23:21:22 +08:00
2026-03-14 22:55:52 +08:00
2026-05-21 16:49:31 +08:00
2026-05-26 23:58:08 +08:00
2026-05-10 22:00:57 +08:00
2026-05-13 23:52:19 +08:00
2026-03-26 14:20:18 +08:00
2026-05-10 23:09:03 +08:00
2026-05-19 22:11:46 +08:00
2026-05-22 21:20:28 +08:00
2026-04-06 15:09:57 +08:00
2026-04-24 22:45:41 +08:00
2026-05-21 16:49:31 +08:00
2026-05-21 16:49:31 +08:00
2026-05-21 16:49:31 +08:00
2026-05-12 23:18:54 +08:00
2026-05-05 23:17:42 +08:00
2026-05-09 18:21:54 +08:00
2026-04-26 11:13:01 +08:00
2026-05-25 09:26:18 +08:00
2026-04-26 15:09:25 +08:00
2026-05-02 15:16:16 +08:00
2026-04-15 23:54:30 +08:00
2026-04-28 11:13:17 +08:00
2026-04-06 15:18:34 +08:00
2026-05-28 07:22:39 +08:00
2026-04-10 20:49:28 +08:00
2026-05-21 16:49:31 +08:00