[claude] Wire QuotaMonitor.select_model() into cascade router (#1106) #1113

Merged
claude merged 1 commits from claude/issue-1106 into main 2026-03-23 18:13:17 +00:00
Collaborator

Fixes #1106

Summary

  • Updates CascadeRouter._quota_allows_cloud() to use QuotaMonitor.select_model("high") instead of should_use_cloud(), aligning it with the metabolic protocol thresholds:
    • BURST (5h quota < 50%): cloud providers allowed
    • ACTIVE (5h quota ≥ 50%): cloud providers skipped, local 14B recommended
    • RESTING (7d quota ≥ 80%): cloud providers skipped, local 8B recommended
  • Adds a log message showing the tier name and suggested local model on every downshift, so transitions are observable
  • Adds TestMetabolicProtocol (5 tests) covering BURST/ACTIVE/RESTING tier behaviour plus graceful degradation when the quota monitor is unavailable

src/infrastructure/claude_quota.py and scripts/claude_quota_check.sh were already committed in prior work.

Fixes #1106 ## Summary - Updates `CascadeRouter._quota_allows_cloud()` to use `QuotaMonitor.select_model("high")` instead of `should_use_cloud()`, aligning it with the metabolic protocol thresholds: - **BURST** (5h quota < 50%): cloud providers allowed - **ACTIVE** (5h quota ≥ 50%): cloud providers skipped, local 14B recommended - **RESTING** (7d quota ≥ 80%): cloud providers skipped, local 8B recommended - Adds a log message showing the tier name and suggested local model on every downshift, so transitions are observable - Adds `TestMetabolicProtocol` (5 tests) covering BURST/ACTIVE/RESTING tier behaviour plus graceful degradation when the quota monitor is unavailable `src/infrastructure/claude_quota.py` and `scripts/claude_quota_check.sh` were already committed in prior work.
claude added 1 commit 2026-03-23 18:12:55 +00:00
feat: wire QuotaMonitor.select_model() into cascade router metabolic protocol
Some checks failed
Tests / lint (pull_request) Successful in 14s
Tests / test (pull_request) Failing after 29m26s
8d6078aea9
Update _quota_allows_cloud() to use select_model("high") instead of
should_use_cloud(), so the cascade router uses the same metabolic tier
logic as the standalone quota API:
  - BURST tier (5h < 50%): cloud providers allowed
  - ACTIVE tier (5h >= 50%): cloud providers skipped, local 14B used
  - RESTING tier (7d >= 80%): cloud providers skipped, local 8B used

Adds log message showing tier name and suggested local model when
downshifting, so Alexander can verify the protocol is working.

Adds TestMetabolicProtocol test class (5 tests) covering:
  - BURST tier allows cloud
  - ACTIVE tier skips cloud
  - RESTING tier skips cloud
  - Local (ollama) providers always attempted regardless of quota
  - No quota monitor → cloud allowed (graceful degradation)

Files src/infrastructure/claude_quota.py and scripts/claude_quota_check.sh
were already in place from prior work.

Fixes #1106

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude merged commit 510d890eb2 into main 2026-03-23 18:13:17 +00:00
claude deleted branch claude/issue-1106 2026-03-23 18:13:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1113