* Fix agent loop continuing after cancellation in letta_agent_v3 Bug: When a run is cancelled, _check_run_cancellation() sets self.should_continue=False and returns early from _step(), but the outer for loop (line 245) continues to the next iteration, executing subsequent steps even though cancellation was requested. Symptom: User hits cancel during step 1, backend marks run as cancelled, but agent continues executing steps 2, 3, etc. Root cause: After the 'async for chunk in response' loop completes (line 255), there was no check of self.should_continue before continuing to the next iteration of the outer step loop. Fix: Added 'if not self.should_continue: break' check after the inner loop to exit the outer step loop when cancellation is detected. This makes v3 consistent with v2 which already had this check (line 306-307). 🐾 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta <noreply@letta.com> * add integration tests * fix: misc fixes required to get cancellations to work on letta code localhost --------- Co-authored-by: Letta <noreply@letta.com> Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
5.5 KiB
5.5 KiB