Bound workflow task latency metric by wall-clock time in metrics test - #1839
Merged
Conversation
test_workflow_metrics_other_types asserted that the workflow task execution latency was under 3s (seconds format) and over 3ms (milliseconds format) as a sanity check of the duration unit. On a loaded CI runner the first workflow task of the HelloWorkflow run took over 3s, failing the seconds assertion ('assert False' from 'any(...)'). Bound the recorded latency by how long the worker actually ran instead, which still distinguishes the two duration formats without assuming a fast machine.
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only change correctly preserves unit validation while accommodating stalled environments.
Pull request overview
Updates the buffered metrics test to avoid failures during slow CI runs.
Changes:
- Measures worker lifetime using
time.monotonic(). - Bounds latency assertions by elapsed time for both duration formats.
File summaries
| File | Description |
|---|---|
tests/worker/test_workflow.py |
Replaces fixed latency thresholds with wall-clock bounds. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
DABH
marked this pull request as ready for review
September 10, 2026 07:55
tconley1428
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
test_workflow_buffered_metricsboundsworkflow_task_execution_latencyby the measured worker lifetime instead of a fixed 3s, in both millisecond and second modes.Why
A stalled CI run took about 9s for the second workflow and failed the fixed
< 3sbound. The wall-clock bound still distinguishes the two unit modes. #1819 touches a different test.Testing
Emulated 4s stall: fails before, passes after. 240/240 flake-finder runs under load. Lint clean.