feat: add global p95 latency guardrail - #6
Merged
Conversation
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.
Summary
Adds a global
max_p95_latency_msguardrail so release decisions can fail on tail-latency regressions, not just average latency drift.Why
Recent telemetry keeps highlighting production agent pain around slow long-tail responses and regression detection. Average latency can look healthy while p95 degrades.
What changed
global.max_p95_latency_msto gate spec parsing (GateSpec).p95_latency_msto JSON and markdown report output.Validation evidence
All checks run from repo root (
/Users/bwise/.openclaw/workspace/projects/agent-release-gate):python3 -m pytest→ ✅19 passed in 0.17s(and rerun after cleanup:19 passed in 0.04s)python3 -m pytest tests/test_evaluator.py→ ✅11 passed in 0.03spython3 -m ruff check .→ ✅All checks passed!python3 -m mypy src→ ✅Success: no issues found in 5 source filespython3 -m build→ ✅ built sdist + wheel successfullyPYTHONPATH=src python3 -m agent_release_gate.cli evaluate --spec <tmp>/spec.yaml --results <tmp>/results.jsonexit_code=1,gate_passed=False,p95_latency_ms=2500.0, reasonP95 latency 2500.0ms exceeds limit 1000msRisk
Low. Additive, opt-in config only; existing specs continue to behave as-is unless
max_p95_latency_msis set.