Implementation Plan: T5-P4-A7-WP1 Eliminate 'anthropic'.casefold() from _quota_refresh_loop and resolve_provider() from _prime_quota_cache#4098
Merged
Trecek merged 5 commits intoJun 13, 2026
Conversation
…a_check bool - Add QuotaPolicy frozen dataclass to _type_protocols_infra.py - Add QuotaPolicy to core/__init__.pyi stub - Migrate _quota_refresh_loop and _prime_quota_cache signatures to accept supports_quota_check: bool keyword - Delete resolve_provider() from server/_misc.py - Update tools_kitchen.py call sites (2) to derive bool from ctx.backend.capabilities.anthropic_provider_capable - Update _lifespan.py call sites (_fleet_auto_gate_boot, _pre_reveal_kitchen, _food_truck_auto_gate_boot, _skill_auto_gate_boot) to use new signature - Update tools_fleet_dispatch.py quota_checker lambda - Update test stubs and assertions to match new signature - Add test_quota_refresh_loop_returns_immediately_when_unsupported and test_prime_quota_cache_skips_when_unsupported tests - Update test_quota_capability_isolation.py docstring and assertion message to reference supports_quota_check bool
…uotaPolicy addition - test_schema_version_convention.py: update _LEGACY_JSON_WRITES line numbers for tools_kitchen.py (shifted by new _supports_quota computation lines) - test_type_protocol_shards.py: add QuotaPolicy to test_infra_shard_all expected set - test_subpackage_isolation.py: raise tools_kitchen.py line limit 1275→1280 to accommodate supports_quota_check bool computation at call sites Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…icate expressions Adds _backend_supports_quota(ctx) to server/_guards.py and replaces the verbatim 4-location repetition of ctx.backend.capabilities.anthropic_provider_capable in _lifespan.py and 2-location repetition in tools_kitchen.py with calls to the helper. Addresses reviewer findings: cohesion/_lifespan.py:271, arch/_lifespan.py:347, cohesion/tools_kitchen.py:273. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ools_fleet_dispatch Precomputes _supports_quota as a named bool before the execute_dispatch call, matching the pattern used in _lifespan.py and tools_kitchen.py. The quota_checker lambda now captures _supports_quota by closure, removing the inline ternary inside it. Addresses reviewer findings: arch/tools_fleet_dispatch.py:372, cohesion/tools_fleet_dispatch.py:375. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and tools_kitchen.py edits The _backend_supports_quota import insertion shifted json.dumps write sites by 1 line in _lifespan.py and by -5 lines in tools_kitchen.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Replace the hardcoded
'anthropic'.casefold()string comparison in_quota_refresh_loopand theresolve_provider()call in_prime_quota_cachewith a typedQuotaPolicyfrozen dataclass carrying asupports_quota_check: boolfield. Call sites derive the bool fromctx.backend.capabilities.anthropic_provider_capable, removing all raw provider string passing to quota functions.resolve_provider()is deleted from_misc.py.Closes #4025
Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260612-160904-076305/.autoskillit/temp/make-plan/t5_p4_a7_wp1_quota_policy_plan_2026-06-12_161500.md🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown