Skip to content

Fix Ollama test timeout on CPU-only CI runners#77

Merged
0xba1a merged 2 commits intobala/add_ollama_local_modelfrom
copilot/sub-pr-73-again
Dec 2, 2025
Merged

Fix Ollama test timeout on CPU-only CI runners#77
0xba1a merged 2 commits intobala/add_ollama_local_modelfrom
copilot/sub-pr-73-again

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

CI test test_writing_bot_ollama fails with ConnectionError: Remote end closed connection without response due to Ollama model cold start on CPU-only runners.

Changes

  • Add request timeout in ollama_local.py: Set timeout=(30, 600) on requests.post() to handle model loading time (30s connect, 600s read)
  • Add model warm-up fixture in conftest.py: New ollama_model_warmed_up session-scoped fixture pre-loads model before tests run
# Before: no timeout, connection drops during cold start
response = requests.post(server, json=payload, headers=headers)

# After: explicit timeout handles slow model loading
response = requests.post(server, json=payload, headers=headers, timeout=(30, 600))

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…up fixture

Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ollama.com
    • Triggering command: /usr/bin/curl curl -fsSL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add ollama-local support to Microbots Fix Ollama test timeout on CPU-only CI runners Dec 2, 2025
Copilot AI requested a review from 0xba1a December 2, 2025 08:21
@0xba1a 0xba1a marked this pull request as ready for review December 2, 2025 08:22
@0xba1a 0xba1a merged commit 4ec2208 into bala/add_ollama_local_model Dec 2, 2025
@0xba1a 0xba1a deleted the copilot/sub-pr-73-again branch December 2, 2025 08:23
0xba1a added a commit that referenced this pull request Dec 3, 2025
* Introduce ollama-local support to Microbots

* Add step to clean disk space

* Use small coding model instead of qwen3 which is 20 GiB

* Replace "result" with "thoughts" in mock messages

* Fix member name

* Update test/bot/test_reading_bot.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/llm/README_OLLAMA_TESTING.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/microbots/llm/ollama_local.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/microbots/llm/ollama_local.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add ollama-local support to Microbots (#75)

* Initial plan

* Address all PR review comments in a single commit

Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>

* Fix unit test failure

* change "result" to "thoughts" in test_llm.py

* Add invalid response unit test to test the exception handling code

* fix test_llm failure and modify it as unit test

* Update tests to install ollama if it is not available

* Pass model name and port from test code to llm using environmental variables

* Use qwen3 model from a constant and update test.yml to sqeeze space from the GitHub runner

* Update unit test based on changes made

* Use a smaller model for testing in GitHub runner

* Disable the clean-up code as using smaller model

* Update 2bot test to run faster

* Run only ollama tests for faster check

* Further modifications to run only ollama tests

* Pass json requirement as part of user message

* Add a brief timeout for the model to be ready after being pulled

* Fix Ollama test timeout on CPU-only CI runners (#77)

* Initial plan

* Fix Ollama test timeout: add timeout to requests.post and model warm-up fixture

Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>

* Install ollama model using Marketplace action

* Increase timeout for local model based tests

* Increase response timeout for local timeout

* Increase timeout to 10 minutes

* Test mistral model

* Try qwen2.5-coder

* Try mistral with new system heuristics

* Flexible verification of ollama tests

* Handle non-json response of local model

* Run ollama_local tests separately

* Fix retry check logic and append llm message before adding user correction message

* add back rerun in test.yml

* Ignore even the json exception from local llm

* Disable the final assert also

* Remove unnecessary else case in _create_llm function

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 0xba1a <2942888+0xba1a@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants