fix: add some more logging for interrupts (#9733)
This commit is contained in:
@@ -1868,6 +1868,13 @@ async def cancel_message(
|
||||
"""
|
||||
# TODO: WHY DOES THIS CANCEL A LIST OF RUNS?
|
||||
actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)
|
||||
logger.info(
|
||||
"[Interrupt] Cancel request received for agent=%s by actor=%s (org=%s), explicit_run_ids=%s",
|
||||
agent_id,
|
||||
actor.id,
|
||||
actor.organization_id,
|
||||
request.run_ids if request else None,
|
||||
)
|
||||
if not settings.track_agent_run:
|
||||
raise HTTPException(status_code=400, detail="Agent run tracking is disabled")
|
||||
run_ids = request.run_ids if request else None
|
||||
|
||||
@@ -580,6 +580,12 @@ async def cancel_conversation(
|
||||
for the agent's default conversation.
|
||||
"""
|
||||
actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)
|
||||
logger.info(
|
||||
"[Interrupt] Cancel request received for conversation=%s by actor=%s (org=%s)",
|
||||
conversation_id,
|
||||
actor.id,
|
||||
actor.organization_id,
|
||||
)
|
||||
|
||||
if not settings.track_agent_run:
|
||||
raise HTTPException(status_code=400, detail="Agent run tracking is disabled")
|
||||
|
||||
@@ -638,7 +638,13 @@ class RunManager:
|
||||
raise NoResultFound(f"Run with id {run_id} not found")
|
||||
agent_id = run.agent_id
|
||||
|
||||
logger.debug(f"Cancelling run {run_id} for agent {agent_id}")
|
||||
logger.info(
|
||||
"[Interrupt] Processing cancellation for run=%s, agent=%s, current_status=%s, current_stop_reason=%s",
|
||||
run_id,
|
||||
agent_id,
|
||||
run.status if run else "unknown",
|
||||
run.stop_reason if run else "unknown",
|
||||
)
|
||||
|
||||
# Cancellation should be idempotent: if a run is already terminated, treat this as a no-op.
|
||||
# This commonly happens when a run finishes between client request and server handling.
|
||||
|
||||
Reference in New Issue
Block a user