delete Fix_545 readme and give description
This commit is contained in:
parent
f03e904c37
commit
d8158127de
1 changed files with 0 additions and 70 deletions
|
|
@ -1,70 +0,0 @@
|
|||
# Fix Verification for Issue #545: Multiple Duplicate Messages
|
||||
|
||||
## Issue Summary
|
||||
When a subagent completes asynchronously, the main agent was sending the same message 15+ times (matching `max_tool_iterations`), instead of once.
|
||||
|
||||
## Root Cause
|
||||
The LLM iteration loop had no detection for when the same tool was called repeatedly with identical arguments, causing infinite repetition until hitting the iteration limit.
|
||||
|
||||
## Fix Applied
|
||||
Added deduplication logic in `pkg/agent/loop.go` at lines 627-658 in the `runLLMIteration()` function.
|
||||
|
||||
## Code Trace - Bug Scenario (BEFORE FIX)
|
||||
|
||||
Using data from the issue logs, service health check:
|
||||
```
|
||||
max_tool_iterations: 15
|
||||
Tool: message
|
||||
Content: "Subagent-3 completed weather check..."
|
||||
```
|
||||
|
||||
### Iteration Flow (Before Fix):
|
||||
```
|
||||
Iteration 1:
|
||||
├─ LLM sees: [System Prompt, User: "health check"]
|
||||
├─ LLM returns: ToolCall(message, content="Subagent-3 completed...")
|
||||
├─ Message sent ✓
|
||||
├─ Tool result added to messages
|
||||
└─ Continue loop
|
||||
|
||||
Iteration 2:
|
||||
├─ LLM sees: [System, User, Assistant(message call), ToolResult, ...]
|
||||
├─ LLM returns: ToolCall(message, content="Subagent-3 completed...") ← SAME CONTENT
|
||||
├─ Message sent (DUPLICATE #1) ✗
|
||||
├─ Tool result added to messages
|
||||
└─ Continue loop
|
||||
|
||||
Iterations 3-15:
|
||||
├─ Same pattern repeats...
|
||||
└─ RESULT: Message sent 15 times ✗✗✗
|
||||
```
|
||||
|
||||
## Code Trace - Bug Scenario (AFTER FIX)
|
||||
|
||||
### Iteration Flow (After Fix):
|
||||
```
|
||||
Iteration 1:
|
||||
├─ Check: iteration > 1? NO (iteration == 1)
|
||||
├─ Skip dedup check
|
||||
├─ LLM sees: [System Prompt, User: "health check"]
|
||||
├─ LLM returns: ToolCall(message, content="Subagent-3 completed...")
|
||||
├─ Message sent ✓
|
||||
├─ Create: assistantMsg with ToolCalls
|
||||
├─ messages = [..., assistantMsg, tool_result]
|
||||
└─ Continue loop
|
||||
|
||||
Iteration 2:
|
||||
├─ Check: iteration > 1? YES ✓
|
||||
├─ Check: len(messages) >= 2? YES ✓
|
||||
├─ Get: lastAssistantMsg = messages[len-2] = assistantMsg from iteration 1
|
||||
├─ Get: lastTC = lastAssistantMsg.ToolCalls[0]
|
||||
├─ Get: currentTC = LLM's new tool call
|
||||
├─ Compare: lastTC.Name == currentTC.Name? "message" == "message" ✓
|
||||
├─ Compare: json.Marshal(lastTC.Arguments) == json.Marshal(currentTC.Arguments)?
|
||||
│ "Subagent-3..." == "Subagent-3..." ✓ MATCH!
|
||||
├─ Set: finalContent = response.Content
|
||||
├─ Break: Exit loop immediately ← FIX APPLIED!
|
||||
└─ Return: finalContent, iteration=2, nil
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue