mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 21:21:27 +01:00
When a Claude turn ends with background work running, the Runner holds the run terminal and waits for the provider's own next turn. Stop during that wait was acknowledged only in the controller, and the close path sent no command because no turn was active. The Runner released the terminal on suspend, after the closing drain, so the journal never got it. The next run on the task was then refused with journal_not_settled. The wait limit had the same gap. The close path now sends turn.stop before the drain when the run's last turn is still waiting. The Runner already ends the wait and publishes the terminal on that command. A Stop that ends a wait also marks the saved session as cancelled and no longer waiting, as a Stop during a turn does. Tested with the real Runner and the fake sidecar for Stop and for the wait limit. Both tests fail without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>