Skip to content

fix: trigger threshold exit when waste ratio equals threshold - #17

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
HeaTTap:fix-fail-over-ratio-boundary
Sep 9, 2026
Merged

fix: trigger threshold exit when waste ratio equals threshold#17
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
HeaTTap:fix-fail-over-ratio-boundary

Conversation

@HeaTTap

@HeaTTap HeaTTap commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #16

What & why

Previously _maybe_fail used ratio > threshold without equality, so a waste ratio exactly at the threshold never triggered the gate exit. This updates the check to ratio >= threshold so thresholds behave as expected.

Changes

  • Changed ratio comparison in _maybe_fail from ratio > threshold to ratio >= threshold in src/ctxlens/cli.py
  • Added unit tests in tests/test_cli.py verifying _maybe_fail at exact threshold raises typer.Exit with EXIT_THRESHOLD and values below threshold or None do not raise

Checklist

@royalpinto007
royalpinto007 merged commit b525ab6 into AgentPostmortem:main Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--fail-over-ratio never fires at exactly the threshold

2 participants