feat(projects): cancel in-flight chat streams and analysis - #355
Open
Hustler490 wants to merge 1 commit into
Open
Hustler490 wants to merge 1 commit into
Hustler490 wants to merge 1 commit into
Conversation
Hustler490
force-pushed
the
feat/101-cancel-project-chat
branch
from
October 4, 2026 15:58
42fe90d to
9be7a2b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #101
What
A client can now stop an in-flight project chat stream or analysis.
Changes
app/services/cancellation.py- a bounded, thread-safe cancellation registry keyed byrequest_id(LRU-capped, cleared when a request finishes).app/workspaces/routes.pyPOST /api/projects/<id>/chat/streamnow:is_cancelledbetween chunks and stops yielding immediately,GeneratorExiton client disconnect, closes the provider stream, and persists no partial assistant message,request_idwhen done.POST /api/projects/<id>/analyzechecks the same signal before running and again before its side effects; if cancelled it returns{cancelled: true}and skips activity/notification/event writes.POST /api/projects/<id>/cancelmarks arequest_idas cancelled (owner-scoped).Acceptance criteria
Validation
pytest tests/test_project_cancel.py tests/test_project_routes.py tests/test_chat_settings.py tests/test_rate_limit_endpoints.py tests/test_event_wiring.py-> all pass.ruff checkandblack --checkclean on the changed files.test_migrations.py::test_conversation_shares_table_upgradedfails (stale column assertion, unrelated).