Fresh clone, followed the manual setup in CONTRIBUTING, and the server won't boot.
$ python -m uvicorn app:app
File "app.py", line 677, in <module>
from routes.chat_routes import setup_chat_routes
File "routes/chat_routes.py", line 19, in <module>
from src.agent_loop import stream_agent_loop
File "src/agent_loop.py", line 1503, in <module>
def _resolved_tool_event_name(event: dict[str, Any]) -> str:
NameError: name 'Any' is not defined. Did you mean: 'any'?
src/agent_loop.py line 15 is:
from typing import AsyncGenerator, List, Dict, Optional, Set
No Any. Two functions want it though:
- line 1503,
_resolved_tool_event_name(event: dict[str, Any])
- line 1877,
_ody_qwen_terminal_tool_summary(tool_event: dict[str, Any])
There's no from __future__ import annotations in the file, so those annotations get evaluated the moment the def runs, which is at import time. So the module can't be imported at all. chat_routes pulls stream_agent_loop out of it, app.py pulls in chat_routes, and the whole entrypoint goes down with it.
pytest doesn't survive it either:
$ python -m pytest
!!!!! Interrupted: 21 errors during collection !!!!!
Same NameError all 21 times.
git checkout main isn't a workaround. git diff main dev -- src/agent_loop.py is empty.
Adding Any to that import line is all it takes. I checked the rest of the tree for the same shape (annotation evaluated at def time referencing a typing name the module never imported) across all 1057 .py files and these two lines are the only hits, so it really is just the one import.
Why CI is green on this
Took me a while to work out, and I think it's worth fixing separately.
compileall is genuinely fine with it, since the syntax is valid and it's the name lookup that fails:
$ python -m compileall -q src/agent_loop.py && echo ok
ok
The pytest job would have caught it, but it never got as far as running pytest. On the snapshot push it died in the "Check for docs-only changes" step:
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
##[error]Process completed with exit code 128.
That step does git diff --name-only "$BASE" "$HEAD" with BASE from github.event.before, falling back to HEAD~1..HEAD. On an initial commit before is the all-zeroes SHA and there is no HEAD~1, so both fail and the step exits 128. Every later step is gated on that step's output, so pip install and python -m pytest were skipped entirely.
The job shows as failed, but continue-on-error: true on python-tests (ci.yml:109) means it doesn't fail the run, so the overall CI check still reported success. I get why that flag is there given the comment above it about flaky tests, just noting that combination is what let this through.
I've got a branch with the import fix plus tests, happy to send a PR. The CI thing I've left alone, seemed like your call.
Python 3.12.10, dev at 142b93a.
Fresh clone, followed the manual setup in CONTRIBUTING, and the server won't boot.
src/agent_loop.pyline 15 is:No
Any. Two functions want it though:_resolved_tool_event_name(event: dict[str, Any])_ody_qwen_terminal_tool_summary(tool_event: dict[str, Any])There's no
from __future__ import annotationsin the file, so those annotations get evaluated the moment thedefruns, which is at import time. So the module can't be imported at all. chat_routes pullsstream_agent_loopout of it, app.py pulls in chat_routes, and the whole entrypoint goes down with it.pytest doesn't survive it either:
Same NameError all 21 times.
git checkout mainisn't a workaround.git diff main dev -- src/agent_loop.pyis empty.Adding
Anyto that import line is all it takes. I checked the rest of the tree for the same shape (annotation evaluated at def time referencing a typing name the module never imported) across all 1057 .py files and these two lines are the only hits, so it really is just the one import.Why CI is green on this
Took me a while to work out, and I think it's worth fixing separately.
compileall is genuinely fine with it, since the syntax is valid and it's the name lookup that fails:
The pytest job would have caught it, but it never got as far as running pytest. On the snapshot push it died in the "Check for docs-only changes" step:
That step does
git diff --name-only "$BASE" "$HEAD"withBASEfromgithub.event.before, falling back toHEAD~1..HEAD. On an initial commitbeforeis the all-zeroes SHA and there is noHEAD~1, so both fail and the step exits 128. Every later step is gated on that step's output, so pip install andpython -m pytestwere skipped entirely.The job shows as failed, but
continue-on-error: trueonpython-tests(ci.yml:109) means it doesn't fail the run, so the overall CI check still reported success. I get why that flag is there given the comment above it about flaky tests, just noting that combination is what let this through.I've got a branch with the import fix plus tests, happy to send a PR. The CI thing I've left alone, seemed like your call.
Python 3.12.10, dev at 142b93a.