The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: initialize affinity_token before the turn-lease early returns
kshitijk4poor45bd48ff6701
diff --git a/run_agent.py b/run_agent.pyindex 72e30007543..61329934f83 100644--- a/run_agent.py+++ b/run_agent.py@@ -9067,6 +9067,11 @@ class AIAgent:durable_turn_lease_turn_active = Falsedurable_turn_lease_interrupt_message = Nonetoken = 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 = Noneacct_token = Nonetask_started = Falsetask_finished = False