Skip to content

The agent that grows with you

Merge pull request #141343 from NousResearch/fix/pkg12-msg-cli

Teknium50de19c13b67
diff --cc gateway/session_authority.py
index ffff6db6593,6ce6bc9a6e0..7c2216852e7
--- a/gateway/session_authority.py
+++ b/gateway/session_authority.py
@@@ -1120,10 -1114,15 +1124,16 @@@ class SessionAuthority
async def _execute_claimed(self, ref, live, row):
"""Run the claimed admission: ``(response, outcome)``. The executing stamp clears the moment
- execution returns; a lost managed worker pauses the FIFO and re-raises ManagedExecutionUnknown."""
+ execution returns; a lost managed worker settles an automation turn (``settled_unknown``) or pauses
+ the FIFO and re-raises ManagedExecutionUnknown."""
from gateway.session_finite import execute_finite_admission
from gateway.session_managed_worker import ManagedExecutionUnknown
+ review = getattr(live.review, '_background_review_run', None)
+ if review is not None and not review.request_done.is_set():
+ # A cold /refine's review shares the session id, as the resident agent's does: cancel it
+ # before the turn (its bounded wait runs off-loop).
+ from agent.background_review import cancel_background_review_for_live_turn
+ await asyncio.to_thread(cancel_background_review_for_live_turn, live.review)
try:
try:
return await execute_finite_admission(self, ref, row), 'completed'