fix: flag negative and out-of-order timestamps in check_latency (#15) - #18
Closed
Dheerajvarma1 wants to merge 1 commit into
Closed
Conversation
Author
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 & why
Fixes #15.
Root Cause
check_latency()computes response latency asgap = agent_turn.start_s - user_turn.end_sand previously only checkedif gap > budget_s:.As a result, materially negative gaps caused by excessive overlap or
out-of-order timing data were silently ignored because negative values
could never exceed the latency budget. This allowed malformed timing data
to pass without any finding.
Fix
Added an
elif gap < -0.3:check tocheck_latency()that emits ahigh-severity
invalid_timingfinding pointing to the offending agentturn.
Overlap Policy
The existing repository behavior allows small conversational overlap.
Therefore, gaps between
-0.3sand0.0sremain valid and are not flagged.Tests
Added regression tests covering:
Verification
pytest -v— 22 passedruff check .— all checks passed