Patrick Buckley
7a32c51a1c
fix: synthesize cancelled tool results instead of stripping turns ( #237 )
...
* fix: synthesize cancelled tool results instead of stripping turns
When a user cancels during tool execution, the model previously lost
all context about what was attempted (assistant message + tool_calls
stripped entirely). Now synthesizes tool_result messages with
is_error=true and "Cancelled by user." content for any tool_calls
that lack matching results. This keeps the conversation valid for
both providers while preserving the full tool call structure so the
model knows what was tried.
Also applies to KeyboardInterrupt with "Interrupted by user." text.
* fix: persist synthesized cancel results to DB, assert is_error in test
Copilot review: synthesized tool messages were in-memory only,
creating a mismatch with DB that could break rewind/retry. Now
calls save_message() for each synthesized result. Also adds
is_error=True assertion to the cancel test.
2026-03-29 17:09:17 -07:00
..
2026-03-02 00:33:37 -08:00
2026-03-23 11:11:40 -07:00
2026-03-18 14:24:10 -07:00
2026-03-04 13:02:58 -08:00
2026-03-10 19:32:37 -07:00
2026-03-17 17:02:25 -07:00
2026-03-24 03:13:23 -07:00
2026-03-13 21:21:09 -07:00
2026-03-11 01:58:39 -07:00
2026-03-15 15:04:22 -07:00
2026-03-28 14:24:53 -07:00
2026-03-29 17:09:17 -07:00
2026-03-28 14:24:53 -07:00
2026-03-13 04:12:46 -07:00
2026-03-04 13:02:58 -08:00
2026-03-23 11:11:40 -07:00
2026-03-14 11:42:18 -07:00
2026-03-23 12:26:41 -07:00
2026-03-24 03:13:23 -07:00
2026-03-13 21:21:09 -07:00
2026-03-29 05:21:08 -07:00
2026-03-02 00:33:37 -08:00
2026-03-23 14:55:14 -07:00
2026-03-03 22:57:34 -08:00
2026-03-16 14:47:06 -07:00
2026-03-23 11:11:40 -07:00
2026-03-21 16:35:47 -07:00
2026-03-02 00:33:37 -08:00
2026-03-13 04:12:46 -07:00
2026-03-23 11:11:40 -07:00
2026-03-26 18:10:23 -07:00
2026-03-28 22:09:52 -07:00
2026-03-04 06:47:30 -08:00
2026-03-02 16:55:12 -08:00
2026-03-24 03:13:23 -07:00
2026-03-28 15:48:11 -07:00
2026-03-15 17:12:13 -07:00
2026-03-12 15:46:00 -07:00
2026-03-12 16:57:31 -07:00
2026-03-21 16:12:50 -07:00
2026-03-20 20:01:26 -07:00
2026-03-23 11:11:40 -07:00
2026-03-15 14:28:03 -07:00
2026-03-13 21:21:09 -07:00
2026-03-28 16:18:12 -07:00
2026-03-29 01:58:08 -07:00
2026-03-29 03:50:21 -07:00
2026-03-29 01:58:08 -07:00
2026-03-05 17:24:00 -08:00
2026-03-07 12:49:07 -08:00
2026-03-17 17:02:25 -07:00
2026-03-23 11:11:40 -07:00
2026-03-21 00:14:46 -07:00
2026-03-07 12:49:07 -08:00
2026-03-23 11:11:40 -07:00
2026-03-17 02:19:22 -07:00
2026-03-28 22:09:52 -07:00
2026-03-16 14:47:06 -07:00
2026-03-29 13:33:58 -07:00
2026-03-03 18:28:39 -08:00
2026-03-29 13:33:58 -07:00
2026-03-07 12:49:07 -08:00
2026-03-29 14:18:39 -07:00
2026-03-02 00:33:37 -08:00
2026-03-02 16:55:12 -08:00
2026-03-10 19:32:37 -07:00
2026-03-23 11:11:40 -07:00
2026-03-05 16:05:00 -08:00
2026-03-02 16:55:12 -08:00
2026-03-05 18:11:36 -08:00
2026-03-12 11:43:06 -07:00
2026-03-21 00:31:53 -07:00
2026-03-07 12:49:07 -08:00
2026-03-03 21:22:24 -08:00
2026-03-04 06:04:59 -08:00
2026-03-28 22:09:52 -07:00
2026-03-23 11:11:40 -07:00
2026-03-28 22:09:52 -07:00
2026-03-29 05:21:08 -07:00
2026-03-29 01:58:08 -07:00
2026-03-14 11:42:18 -07:00
2026-03-17 17:02:25 -07:00
2026-03-17 01:26:44 -07:00
2026-03-17 16:09:06 -07:00
2026-03-17 01:26:44 -07:00
2026-03-23 11:11:40 -07:00
2026-03-16 15:45:21 -07:00
2026-03-17 01:26:44 -07:00
2026-03-28 22:09:52 -07:00
2026-03-03 22:57:34 -08:00
2026-03-23 11:11:40 -07:00
2026-03-23 11:11:40 -07:00
2026-03-13 21:21:09 -07:00
2026-03-25 22:43:35 -07:00
2026-03-25 17:48:34 -07:00
2026-03-25 16:35:55 -07:00
2026-03-25 16:07:05 -07:00
2026-03-23 14:55:14 -07:00
2026-03-12 14:49:58 -07:00
2026-03-17 17:02:25 -07:00
2026-03-29 16:17:48 -07:00
2026-03-23 11:11:40 -07:00
2026-03-28 23:07:47 -07:00
2026-03-23 11:11:40 -07:00
2026-03-10 08:18:28 -07:00
2026-03-23 16:09:03 -07:00
2026-03-15 15:04:22 -07:00
2026-03-28 22:09:52 -07:00