Repository navigation
Description
Friction
tests/test_gateway_review_stall.py::TestSingleRetryLayerAndStatusRules::test_five_personas_with_one_transient_503_sees_exactly_six_calls failed once in a full uv run devops ci run and passed alone and in the next full run; its cause is not known.
Evidence
- 2026-10-16, full run with pytest-xdist and pytest-randomly:
assert (6, 'failed') == (6, 'reviewed'). All six expected calls reached the fake transport (five personas and one retry of a transient 503), yet the file's review stage endedfailed, whichReviewPipelineOrchestratorsets only when reviewing the file raises (src/devops_cli/ai/review/pipeline.py, theexceptblocks that setstage = "failed"and recorderror). - Not reproduced: 12 concurrent runs of the test alone, and the 10 modules
tests/test_gateway*.py,tests/test_ai_client*.pyandtests/test_review_pipeline*.pyunder pytest-randomly seeds 11, 22, 33, 44, 55 and 66 (164 passed each). - The test now asserts the recorded
errorwith the stage, so the next failure names the exception.
Remedy
When it next fails, read the named exception and remove the order, load or shared-state dependency at its source. Until then, run the module in the full suite's conditions (devops ci test --repeat 3, several seeds) to find the predecessor test that leaves the state behind.
Proposed design
Problem statement
The test test_five_personas_with_one_transient_503_sees_exactly_six_calls in tests/test_gateway_review_stall.py occasionally fails with a 'failed' stage instead of the expected 'reviewed' stage, even though all expected calls (six) are made to the fake transport. This failure is intermittent and occurs only under specific conditions in full test runs, suggesting a race condition or shared state dependency from previous tests.
Acceptance criteria
- Criterion 1: The test passes consistently without intermittent failures when run in isolation
Verification: Run the test alone with pytest and confirm it passes 100% of the time - Criterion 2: The test continues to pass in a full test suite with multiple seeds
Verification: Executeuv run devops ciwith several different pytest-randomly seeds and verify the test does not fail - Criterion 3: The error message when the test fails shows the specific exception that caused the failure
Verification: Modify the test to assert on the recorded error and observe that it names the actual exception in the failure case
Key questions
- What specific condition causes the test to fail?: The test fails when a previous test leaves behind state that interferes with the test's execution, specifically causing the ReviewPipelineOrchestrator to set the stage to 'failed' instead of 'reviewed'. [sources: src/devops_cli/ai/review/pipeline.py]
- What exception causes the failure?: The specific exception is not yet known, but it's captured in the error field of the review stage and will be named when the test fails again. [sources: tests/test_gateway_review_stall.py]
- What are the conditions under which this test fails?: The test fails intermittently in full runs with pytest-xdist and pytest-randomly, but not when run in isolation or in subsequent full runs. [sources: tests/test_gateway_review_stall.py]
- What should be done to fix the intermittent test failure?: When the test next fails, read the named exception and remove the order, load or shared-state dependency at its source. Until then, run the module in the full suite's conditions to find the predecessor test that leaves the state behind. (proposed) [sources: tests/test_gateway_review_stall.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 17, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate describes a test fix for a transient failure.The issue is a test flake that impacts CI reliability but does not affect core functionality.The change affects only a single flaky test and does not provide user-facing benefits.Requires identifying the root cause of the flake and potentially modifying shared state or dependencies.fix(ci): the v0.2.36 release pull request's checks pass: the service …
fix(ci): the v0.2.36 release pull request's checks pass: the service …
feat(release): v0.2.36 (#1615)
dan-petty commentedon Oct 19, 2026
Evidence (2026-10-19): the second failure names a wrapper, not the exception
The test failed again in a pre-push
uv run devops cirun (pytest-xdist, worker gw15, 14.5 s for the test):bypassingis empty). So the connection message does not describe a connection.LLMClient._retry_chat_dispatch(src/devops_cli/ai/client/unified.py:667-670). Its lastexcept Exceptionturns any exception raised while a reply is dispatched or parsed into_connection_error(exc), keeping the original only as__cause__. AKeyError, a validation error or a lock timeout therefore reads as "Cannot connect to AI provider API". Theerrorthis test records names the wrapper, not what failed.Remedy, amended
httpx2.TransportErrorand its subclasses) to the connection error. Let any other exception propagate under its own type, or wrap it in anAIClientErrorthat names the type. Add a test that a non-transport exception raised in dispatch does not report "Cannot connect".Step 1 is also a product defect: a user whose reply fails to parse is told to check their network and API key.
dan-petty commentedon Oct 19, 2026
Status set to Ready at 0ae4ea4 (see proposed design in issue body).
fix(test): isolate review stall cache state and report dispatch excep…
dan-petty commentedon Oct 19, 2026
What changed
#1696, merged into
release/v0.2.37as 1eec7a1.6 file(s) changed.
How it was verified
Check runs at 8072521:
Acceptance Criteria of
docs/agent/tasks/task-1609-five-persona-transient-503-flake.md:LLMClient._retry_chat_dispatchmaps onlyhttpx2.TransportErrorand subclasses to_connection_error.AIClientErrornaming the exception type.LLMResponseCachesafely tolerates concurrently unlinked files.test_five_personas_with_one_transient_503_sees_exactly_six_callsisolates settings and response cache state and passes reliably.changelog.d/1609.mdadded.feat(release): v0.2.37 (#1720)