Spaces:
Running
Running
fix: parallel tool results matched in FIFO order, not reverse
Browse filesScanning backwards filled the last empty slot first, so when the agent
called search_symbol three times in parallel the first result landed in
the third slot and vice versa. Results arrive in the same order as calls
(backend uses zip), so forward scan is always correct.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ui/src/App.jsx +4 -2
ui/src/App.jsx
CHANGED
|
@@ -499,8 +499,10 @@ export default function App() {
|
|
| 499 |
prev.map((m) => {
|
| 500 |
if (m.id !== assistantId) return m;
|
| 501 |
const calls = [...m.toolCalls];
|
| 502 |
-
// Find
|
| 503 |
-
|
|
|
|
|
|
|
| 504 |
if (calls[i].tool === tool && !calls[i].output) {
|
| 505 |
calls[i] = { ...calls[i], output };
|
| 506 |
break;
|
|
|
|
| 499 |
prev.map((m) => {
|
| 500 |
if (m.id !== assistantId) return m;
|
| 501 |
const calls = [...m.toolCalls];
|
| 502 |
+
// Find the first (oldest) unfilled slot for this tool — results arrive
|
| 503 |
+
// in the same order as calls were emitted, so FIFO matching is correct.
|
| 504 |
+
// Scanning backwards was wrong: parallel same-name calls got swapped.
|
| 505 |
+
for (let i = 0; i < calls.length; i++) {
|
| 506 |
if (calls[i].tool === tool && !calls[i].output) {
|
| 507 |
calls[i] = { ...calls[i], output };
|
| 508 |
break;
|