mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(copilot): clean up stream registry on enqueue failure in auto-approve
If enqueue_copilot_turn failed after stream_registry.create_session, the session was left in "running" state in Redis — locking the session until the TTL expired. Now calls mark_session_completed on failure so the session is released immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -119,13 +119,21 @@ async def _run_auto_approve(
|
||||
tool_name="chat",
|
||||
turn_id=turn_id,
|
||||
)
|
||||
await enqueue_copilot_turn(
|
||||
session_id=session_id,
|
||||
user_id=user_id,
|
||||
message=AUTO_APPROVE_MESSAGE,
|
||||
turn_id=turn_id,
|
||||
is_user_message=True,
|
||||
)
|
||||
try:
|
||||
await enqueue_copilot_turn(
|
||||
session_id=session_id,
|
||||
user_id=user_id,
|
||||
message=AUTO_APPROVE_MESSAGE,
|
||||
turn_id=turn_id,
|
||||
is_user_message=True,
|
||||
)
|
||||
except Exception:
|
||||
# If enqueueing fails, mark the session completed so it doesn't
|
||||
# stay stuck in "running" state in the stream registry forever.
|
||||
await stream_registry.mark_session_completed(
|
||||
session_id, error_message="Auto-approve enqueue failed"
|
||||
)
|
||||
raise
|
||||
logger.info("decompose_goal auto-approve fired for session %s", session_id)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user