mirror of
https://github.com/usestrix/strix.git
synced 2026-08-19 01:55:46 +02:00
Every error path cancels the agent subtree before returning, so children unwind while their sessions are still open. The success path did not: when root called finish_scan with children still mid-turn, the finally closed their sessions underneath them, the in-flight save raised "SQLiteSession is closed", and those children were marked crashed - failing a scan whose report was already written. Cancelling the descendants moves into the finally, ahead of the session close, so it runs on every path - clean finish included. The per-branch cancels are dropped since the finally now covers them; each branch keeps only its own root status. cancel_descendants targets child tasks (root runs inline with no task), and the finally already awaits snapshot and cleanup under cancellation, so the added await is safe there. Fixes #1012. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>