Skip to content

test: auto-retry ollama tests on transient ReadTimeout#1369

Merged
ajbozarth merged 1 commit into
generative-computing:mainfrom
ajbozarth:fix/1367-ollama-flaky-retry
Jul 6, 2026
Merged

test: auto-retry ollama tests on transient ReadTimeout#1369
ajbozarth merged 1 commit into
generative-computing:mainfrom
ajbozarth:fix/1367-ollama-flaky-retry

Conversation

@ajbozarth

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1367

Description

Loaded CI runners occasionally stall a non-streaming Ollama request past the backend's 300 s read timeout, surfacing as httpx.ReadTimeout and failing unrelated PRs. A rerun reliably passes — the stall is a transient dead connection, not slow inference, so a fresh request succeeds. (Confirmed from run 28479500311: the failure fired exactly 300 s after the prior test, on a trivial "Say 'hi'" prompt against an already-warm model. The 300 s timeout was added in #1302 to convert a silent 15-minute hang into a prompt failure; this completes that "fail fast, then recover" intent.)

pytest_collection_modifyitems stamps a flaky marker on every ollama-marked test (no per-test annotations):

pytest.mark.flaky(reruns=2, reruns_delay=5, only_rerun="ReadTimeout")

only_rerun="ReadTimeout" means genuine assertion/logic failures still fail on the first run and are never masked. Retries are scoped to all ollama tests since the stall isn't telemetry-specific — telemetry is just the densest cluster of consecutive non-streaming calls. Widening to all e2e later is a one-line change to the marker gate.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Verified: the real ReadTimeout flake reproduced locally and passed on auto-retry; a synthetic httpx.ReadTimeout retried twice while an injected AssertionError failed immediately with no rerun.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

Loaded CI runners occasionally stall a non-streaming Ollama request past
the backend's read timeout, surfacing as httpx.ReadTimeout. A fresh
request reliably succeeds, so stamp a pytest-rerunfailures flaky marker
on ollama-marked tests gated by only_rerun="ReadTimeout" — transient
stalls retry, genuine assertion/logic failures still fail on first run.

Closes generative-computing#1367

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>

@AngeloDanducci AngeloDanducci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajbozarth ajbozarth enabled auto-merge July 6, 2026 20:48
@ajbozarth ajbozarth added this pull request to the merge queue Jul 6, 2026
Merged via the queue into generative-computing:main with commit 4ac92b3 Jul 6, 2026
8 checks passed
@ajbozarth ajbozarth deleted the fix/1367-ollama-flaky-retry branch July 6, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telemetry Test Flakes

2 participants