Skip to content

fix(token_budget_guard): stricter of 5h/7d window binds - #14

Merged
lukisch merged 2 commits into
mainfrom
fix/guard-binding-window
Oct 13, 2026
Merged

lukisch merged 2 commits into
mainfrom
fix/guard-binding-window

Conversation

@lukisch

@lukisch lukisch commented Oct 13, 2026

Copy link
Copy Markdown
Member

The guard used seven_day only as a fallback when five_hour was missing, so a fresh 5h window lifted a notaus while the weekly quota was at 97 % (2026-10-13). Now the higher used percentage of both windows decides. Regression test included (fails on old guard), full suite green. Needs second-model review per two-model rule.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FMTv7ecoTBXem1ndYqUtxj

The guard read seven_day only when five_hour was missing. On 2026-10-13 a
fresh 5h window (0 %) lifted a manual notaus while the weekly quota stood
at 97 %. Now the higher used percentage of both windows decides, with its
own resets_at. Regression test: notaus stays with 5h 0 % / 7d 97 %
(fails on the old guard, passes now); suite green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FMTv7ecoTBXem1ndYqUtxj
@github-actions

Copy link
Copy Markdown

Welcome! 👋 Thanks for your first pull request in this repository.

A maintainer will review it soon. Please make sure:

  • Your changes are tested
  • Documentation is updated if needed
  • The PR description explains what and why

Thanks for contributing!

User rule (2026-10-13): after the 5h window resets, the week decides.
More than 10 % of the week left ends sparmodus and notaus; 3-10 % left
keeps the sparmodus but lifts the notaus; 3 % or less keeps the notaus.
Each window is staged against its own thresholds (new config key
thresholds_seven_day, defaults sparmodus 90 / notaus 97 % used), the
stricter stage binds, and messages name the binding window. A notaus is
now lifted as soon as no window demands it; stage 2 keeps at least the
sparmodus. Parametrized tests cover all three bands; suite green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FMTv7ecoTBXem1ndYqUtxj

lukisch commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Cloud-Bot-Review (Zweitmodell): ✅ freigabefähig

  • CI: alle 12 Matrix-Jobs (ubuntu/macOS/windows × 3.10–3.13) grün.
  • Logik geprüft: strengste Stufe über beide Fenster bindet; Gleichstand >0 bevorzugt das Wochenfenster; __RECOVER__ bei stage < 3 mit Stufe-2-Fallback auf manual-spar ist konsistent mit den neuen parametrisierten Tests (7 Fälle decken Grenzwerte 85/95/97/99 ab). Fail-open bei defekter thresholds_seven_day-Config ist gegeben.
  • Kleine Nits (nicht blockierend): import pytest steht mitten in der Testdatei (an den Dateianfang), und remaining2/remaining3 werden weiterhin aus den 5h-Schwellen berechnet – falls sie in Meldungen für das Wochenfenster erscheinen, wären die Wochen-Schwellen korrekter.

Generated by Claude Code

@lukisch lukisch left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zweitmodell-Review (Freigabe empfohlen): Beide Fenster (5h/7d) werden gegen eigene Schwellen gestuft, die strengere Stufe bindet; Notaus-Recovery bei Stufe 2 fällt auf mindestens manual-spar zurück. Parametrisierte Tests decken die Grenzfälle ab, CI (12 Jobs) grün. Nit: import pytest mitten in der Testdatei nach oben ziehen.


Generated by Claude Code

@lukisch
lukisch merged commit a6c8e1e into main Oct 13, 2026
12 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.

1 participant