Skip to content

Commit 2b0dfd8

Browse files
committed
fix: increase wait times in MCP tools tests for better handling of long-running processes
1 parent 52422da commit 2b0dfd8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test_mcp_tools.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
WAIT_OVERRIDE = {
6262
101: 4.0,
6363
102: 4.0,
64-
103: 12.0,
65-
104: 15.0,
64+
103: 20.0,
65+
104: 25.0,
6666
105: 6.0,
67-
106: 12.0,
68-
107: 12.0,
67+
106: 20.0,
68+
107: 25.0,
6969
}
7070

7171
def drain(proc, seconds=2.0):
@@ -218,16 +218,16 @@ def run():
218218
}
219219
}
220220

221-
wait_time = WAIT_OVERRIDE.get(payload["id"], 3.0)
222-
out = send(proc, payload, wait=wait_time)
221+
wait_time = WAIT_OVERRIDE.get(payload["id"], 5.0)
222+
out = send(proc, payload, wait=wait_time) + drain(proc, wait_time)
223223

224-
if not out.strip():
225-
# Some tools (especially ones calling local LLMs) can take longer than
226-
# our initial wait window. Give them more time and capture any output.
227-
extra_wait = max(5.0, wait_time)
228-
extra = drain(proc, extra_wait)
229-
if extra:
230-
out += extra
224+
# If the tool still hasn't produced output (possible for long-running AI calls),
225+
# keep waiting in generous chunks until we see something or the process exits.
226+
while not out.strip():
227+
extra = drain(proc, wait_time)
228+
if not extra.strip():
229+
break
230+
out += extra
231231

232232
if payload["id"] == 102:
233233
vec2_output = out

0 commit comments

Comments
 (0)