fix: make rounds_since_todo a local variable

This commit is contained in:
ggttyy1
2026-07-11 19:47:55 +08:00
parent 4faf3e4c52
commit ffe1fef0b5
3 changed files with 3 additions and 12 deletions

View File

@@ -232,11 +232,8 @@ register_hook("Stop", summary_hook)
# agent_loop — same as s04 + nag reminder counter # agent_loop — same as s04 + nag reminder counter
# ═══════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════
rounds_since_todo = 0
def agent_loop(messages: list): def agent_loop(messages: list):
global rounds_since_todo rounds_since_todo = 0
rounds_since_todo = 0 # 每轮新对话从0开始计数
while True: while True:
# s05: nag reminder — inject if model hasn't updated todos for 3 rounds # s05: nag reminder — inject if model hasn't updated todos for 3 rounds
if rounds_since_todo >= 3 and messages: if rounds_since_todo >= 3 and messages:

View File

@@ -312,11 +312,8 @@ register_hook("Stop", summary_hook)
# agent_loop — same as s05 + nag reminder, task auto-dispatches # agent_loop — same as s05 + nag reminder, task auto-dispatches
# ═══════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════
rounds_since_todo = 0
def agent_loop(messages: list): def agent_loop(messages: list):
global rounds_since_todo rounds_since_todo = 0
rounds_since_todo = 0 # 每轮新对话从0开始计数
while True: while True:
# s05: nag reminder # s05: nag reminder
if rounds_since_todo >= 3 and messages: if rounds_since_todo >= 3 and messages:

View File

@@ -356,11 +356,8 @@ register_hook("Stop", summary_hook)
# agent_loop — same as s05-s06 + nag reminder # agent_loop — same as s05-s06 + nag reminder
# ═══════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════
rounds_since_todo = 0
def agent_loop(messages: list): def agent_loop(messages: list):
global rounds_since_todo rounds_since_todo = 0
rounds_since_todo = 0 # 每轮新对话从0开始计数
while True: while True:
if rounds_since_todo >= 3 and messages: if rounds_since_todo >= 3 and messages:
messages.append({"role": "user", messages.append({"role": "user",