mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-06-21 04:33:36 +08:00
fix: prevent tool_result order corruption in s07 reminder injection
This commit is contained in:
@@ -344,12 +344,9 @@ def agent_loop(messages: list):
|
|||||||
global rounds_since_todo
|
global rounds_since_todo
|
||||||
while True:
|
while True:
|
||||||
if rounds_since_todo >= 3 and messages:
|
if rounds_since_todo >= 3 and messages:
|
||||||
last = messages[-1]
|
messages.append({"role": "user",
|
||||||
if last["role"] == "user" and isinstance(last.get("content"), list):
|
"content": "<reminder>Update your todos.</reminder>"})
|
||||||
last["content"].insert(0, {
|
rounds_since_todo = 0
|
||||||
"type": "text",
|
|
||||||
"text": "<reminder>Update your todos.</reminder>",
|
|
||||||
})
|
|
||||||
|
|
||||||
response = client.messages.create(
|
response = client.messages.create(
|
||||||
model=MODEL, system=SYSTEM, messages=messages,
|
model=MODEL, system=SYSTEM, messages=messages,
|
||||||
|
|||||||
Reference in New Issue
Block a user