mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:49:26 +08:00
`ChatOrchestrator.handle()` runs the capability in its own task and only reads the bus, so a consumer that stopped reading never reached that task. Pressing Stop persisted the turn as cancelled while the capability kept calling the model and running tools until it finished on its own. A capability parked on `ask_user` was never cancelled at all: once the turn dropped its references it was destroyed mid-await, `_run`'s cleanup failed before `unregister_bus`, and the turn's StreamBus stayed in the registry for the life of the process. Cancel and await the capability task in a `finally` around the consumption loop, the same shape `llm.factory.stream()` already uses, so both a cancelled consumer and a stream closed early take the capability down with them. A normal turn is unaffected: its task has finished by the time the loop ends.