Skip to content

Commit d196ccf

Browse files
committed
Fix MCP timeout handling on Python 3.10; document 3.10 support
1 parent 00131ae commit d196ccf

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FSM-driven execution · OpenAI-compatible · built for daily use and easy custom
77

88
[![CI](https://github.com/beacoder/python-agent-harness/actions/workflows/ci.yml/badge.svg)](https://github.com/beacoder/python-agent-harness/actions/workflows/ci.yml)
99
[![PyPI](https://img.shields.io/pypi/v/python-agent-harness.svg)](https://pypi.org/project/python-agent-harness/)
10-
[![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)
10+
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
1111
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
1212

1313
</div>
@@ -225,7 +225,7 @@ python_agent_harness/
225225

226226
## Development
227227

228-
Requires Python ≥ 3.11. CI runs against Python 3.11, 3.12, and 3.13.
228+
Requires Python ≥ 3.10. CI runs against Python 3.10, 3.11, 3.12, and 3.13.
229229

230230
```sh
231231
make test # unit tests

python_agent_harness/mcp/manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from __future__ import annotations
2424

2525
import asyncio
26+
import concurrent.futures
2627
import contextlib
2728
import threading
2829
import time
@@ -102,7 +103,10 @@ def run(
102103
while True:
103104
try:
104105
exc = future.exception(timeout=0.1)
105-
except TimeoutError:
106+
# concurrent.futures.TimeoutError is the builtin TimeoutError on
107+
# 3.11+ but a distinct class on 3.10 — catch the futures one so
108+
# the poll-timeout branch works on every supported Python.
109+
except concurrent.futures.TimeoutError:
106110
# future still running: enforce deadline / cancellation
107111
if deadline is not None and time.monotonic() >= deadline:
108112
future.cancel()

0 commit comments

Comments
 (0)