Commit 98f96d5
fix: CancelTaskAsync re-fetches task after UpdateStatusAsync (alternative approach) (#283)
* fix: re-fetch task after UpdateStatusAsync in CancelTaskAsync
CancelTaskAsync discarded the return value of ITaskStore.UpdateStatusAsync,
so the returned AgentTask reflected the pre-cancellation status. Beyond just
Status, a custom store may update additional fields during status transitions
(e.g. UpdatedAt, ETag). Re-fetching the full task after the update ensures the
returned AgentTask is fully authoritative for all store implementations.
The bug was masked by InMemoryTaskStore because GetTaskAsync returns a reference
to the cached object that UpdateStatusAsync mutates in place.
Fixes #277
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: throw instead of silently falling back to stale task on null re-fetch
If GetTaskAsync returns null after a successful UpdateStatusAsync, ?? task
would return the original object with pre-cancellation status, reintroducing
the bug. Throw instead to surface the inconsistency loudly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Gijs Walraven <gijs.walraven@delaware.pro>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Roman Konecny <rokonecn@microsoft.com>1 parent e9d269e commit 98f96d5
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| |||
0 commit comments