Skip to content

feat: add cancel interface for /runs/stream - #3

Open
yyquiet wants to merge 1 commit into
mainfrom
feature/runs-cancel
Open

yyquiet wants to merge 1 commit into
mainfrom
feature/runs-cancel

Conversation

@yyquiet

@yyquiet yyquiet commented Mar 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • 实现 /runs/stream 的 cancel 接口,支持取消正在运行的流请求
  • 新增 RunCancelStateful 模型(预留扩展)
  • 新增 RunningTask 数据类和 task registry
  • 新增 register_run, get_running_run, unregister_run, cancel_run 方法
  • GraphExecutor.stream_graph 中添加 cancel_event 支持
  • 新增 POST /threads/{thread_id}/runs/cancel API 端点

Test plan

  • 单元测试全部通过 (8 tests passed)

🤖 Generated with Claude Code

- Add RunCancelStateful model for future extensibility
- Add RunningTask dataclass and task registry in RunsService
- Add register_run, get_running_run, unregister_run, cancel_run methods
- Add cancel_event support in GraphExecutor.stream_graph
- Add POST /threads/{thread_id}/runs/cancel API endpoint
- Add unit tests for runs_service, graph_executor, and run_routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant