Returns `true` when the per-run cancellation token (or any parent it was derived from, such as the session-level token) has been fired. Used by lifecycle `complete()` to classify a failed run as `Cancelled` vs `Failed` when an `Err` comes back from the agent loop.
(&self)
| 190 | /// Used by lifecycle `complete()` to classify a failed run as `Cancelled` |
| 191 | /// vs `Failed` when an `Err` comes back from the agent loop. |
| 192 | pub(super) async fn was_cancelled(&self) -> bool { |
| 193 | self.cancel_token |
| 194 | .lock() |
| 195 | .await |
| 196 | .as_ref() |
| 197 | .map(|t| t.is_cancelled()) |
| 198 | .unwrap_or(false) |
| 199 | } |
| 200 | |
| 201 | pub(super) async fn finish(&self) { |
| 202 | self.active_tools.write().await.clear(); |