Commit 22cc8f9
committed
v0.55.2 — Fix /stop race condition + misleading 'No active task' message
Two bugs in the OnCommand /stop handler:
1. Race condition: both /stop's OnCommand handler and handleChatMessage's
cancellation handler called LoadAndDelete on chatRunInfos. The loser
saw an empty map and reported 'No active task to stop' even though the
cancel function was found and called.
2. Missing fallback: when the cancel func was found but chatRunInfos was
empty (race or first-iteration timing), the handler fell through to
'No active task' instead of reporting cancellation.
Fix: use Load (read-only) instead of LoadAndDelete for chatRunInfos,
leaving cleanup to handleChatMessage's defer. Track whether the cancel
func was actually called, and report '⏹️ Task cancelled.' when run info
is unavailable but cancellation was successful.1 parent a36e450 commit 22cc8f9
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
387 | 388 | | |
388 | 389 | | |
389 | 390 | | |
| 391 | + | |
390 | 392 | | |
391 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
392 | 397 | | |
393 | | - | |
| 398 | + | |
394 | 399 | | |
395 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
396 | 405 | | |
397 | 406 | | |
398 | 407 | | |
| |||
0 commit comments