diff --git a/run_agent.py b/run_agent.py index 72e3000754..61329934f8 100644 --- a/run_agent.py +++ b/run_agent.py @@ -9067,6 +9067,11 @@ class AIAgent: durable_turn_lease_turn_active = False durable_turn_lease_interrupt_message = None token = None + # Initialized alongside `token`: the turn-lease timeout/interrupt + # early returns leave the try block before set_affinity_scope() runs, + # and the finally reads this name unconditionally (UnboundLocalError + # otherwise — the 4 red cross-process lease tests on PR #97158). + affinity_token = None acct_token = None task_started = False task_finished = False