Cancellable turns: /clear aborts an in-flight streaming response #42
Labels
No labels
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie#42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
Make an in-flight
piturn cancellable, and prove it end-to-end by wiring/clearto cancel a streaming response cleanly. Today teloxide serializes updates per-chat, so a/clearsent mid-stream can't even run until the response finishes; and killing the process mid-stream surfaces a spurious "crashed" error. After this slice,/clearduring streaming stops the turn cleanly and resets the session.This is the foundation for mid-stream abort-and-resend (follow-up slice). It introduces the cancel primitive and the concurrency needed to act on a chat while it is streaming.
End-to-end behavior across all layers:
pi): the response read loop becomes cancellable. On cancel it writes anabortcommand topi(see RPC reference inCONTEXT.md), keeps reading until the abortedagent_endso the process returns to idle, and reports anAbortedoutcome distinct from a normal response or a crash./clearissued mid-stream routes through the cancel primitive: abort the turn, delete the in-flight placeholder/answer message(s), then recreate the session./helpand/startleave any in-flight turn untouched.Acceptance criteria
/clearsent while a response is streaming stops the turn cleanly with no "crashed"/error message shown to the user/clear, the session is reset and the next message starts a fresh sessionaborttopiand drains toagent_end; the process is reused (not killed) where a session still existsBlocked by
None - can start immediately
Implementation complete on branch sandcastle/issue-42 (commit 6c30405). No Rust toolchain in sandbox so CI must validate compilation and tests.