fix(agent): restore end_turn in run_conversation finally

Keep relay turn teardown when clearing activity labels after a turn exits.
This commit is contained in:
fangliquanflq
2026-08-01 01:13:28 +08:00
committed by Teknium
parent 06c7f9b26f
commit 2e75aec512
+7 -3
View File
@@ -7563,6 +7563,13 @@ class AIAgent:
finish_task_run(**task_context, error=exc)
raise
finally:
try:
if relay_turn is not None:
relay_runtime.SESSION_COORDINATOR.end_turn(
relay_turn,
outcome=relay_outcome,
)
finally:
try:
if relay_lease is not None:
relay_runtime.SESSION_COORDINATOR.release_conversation(
@@ -7581,9 +7588,6 @@ class AIAgent:
reset_accounting_context(acct_token)
if token is not None:
reset_conversation_context(token)
reset_accounting_context(acct_token)
if token is not None:
reset_conversation_context(token)
def chat(self, message: str, stream_callback: Optional[callable] = None) -> str:
"""