Mark any incomplete tool parts as "error" with "Tool execution aborted". Mirrors the TS abort handling at the end of the process loop.
(&mut self)
| 775 | /// Mark any incomplete tool parts as "error" with "Tool execution aborted". |
| 776 | /// Mirrors the TS abort handling at the end of the process loop. |
| 777 | fn abort_incomplete_tools(&mut self) { |
| 778 | let now = chrono::Utc::now().timestamp_millis(); |
| 779 | for tc in self.tool_calls.values_mut() { |
| 780 | match &tc.state { |
| 781 | ToolState::Completed { .. } | ToolState::Error { .. } => { |
| 782 | // Already terminal — skip |
| 783 | } |
| 784 | _ => { |
| 785 | tc.state = ToolState::Error { |
| 786 | input: tc.parsed_input.clone(), |
| 787 | error: "Tool execution aborted".to_string(), |
| 788 | metadata: None, |
| 789 | time: ErrorTime { |
| 790 | start: now, |
| 791 | end: now, |
| 792 | }, |
| 793 | }; |
| 794 | } |
| 795 | } |
| 796 | } |
| 797 | } |
| 798 | } |
| 799 | |
| 800 | impl LlmProcessor { |