chore: port an api as experiment#35261
chore: port an api as experiment#35261asukaminato0721 wants to merge 4 commits intolanggenius:mainfrom
Conversation
Pyrefly DiffNo changes detected. |
Pyrefly DiffNo changes detected. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Ports the completion task “stop” endpoint to a new canonical API shape (DELETE on task resource) while keeping the legacy POST /stop route for backward compatibility.
Changes:
- Introduced
CompletionTaskApiusingDELETE /completion-messages/<task_id>to stop a running task. - Refactored stop logic into a shared helper and marked the legacy POST stop route as deprecated.
- Updated unit tests to cover the new DELETE route and verify
AppTaskService.stop_taskarguments.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/controllers/web/completion.py | Adds shared stop helper, introduces DELETE task route, and deprecates legacy POST /stop endpoint. |
| api/tests/unit_tests/controllers/web/test_completion.py | Adds/updates unit tests for the new DELETE endpoint and legacy stop behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class TestCompletionStopApi: | ||
| @patch("controllers.web.completion.AppTaskService.stop_task") | ||
| def test_legacy_post_stop_success(self, mock_stop: MagicMock, app: Flask) -> None: | ||
| with app.test_request_context("/completion-messages/task-1/stop", method="POST"): | ||
| result, status = CompletionStopApi().post(_completion_app(), _end_user(), "task-1") |
There was a problem hiding this comment.
The legacy deprecated POST endpoint is tested for success, but there’s no longer a test asserting it raises NotCompletionAppError on a non-completion app mode (similar to what TestCompletionTaskApi.test_wrong_mode_raises does for DELETE). Adding that negative-path test would help prevent regression while the deprecated endpoint remains supported.
Pyrefly DiffNo changes detected. |
Important
Fixes #<issue number>.Summary
part of #35141
Screenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods