Add bounded cache-aware Hugging Face routing - #599
Draft
KirschBluteX wants to merge 1 commit into
Draft
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
Tau's existing Hugging Face routing pins the first successful backing provider for a session. That preserves locality, but it can also keep an automatic session on a route that repeatedly reports no effective cache reuse for a long, stable prefix.
This adds a fixed, bounded evaluator for automatic Hugging Face routes:
Candidates come from the model API's live conversational mappings and are ordered deterministically. Discovery failures, unavailable candidates, and exhausted budgets leave the current route usable and surface a diagnostic instead of looping.
The policy remains in
tau_coding.tau_agentgains only a provider-neutral flag that preserves whether a cache-read counter was reported. Automatic state and transitions use the existing session index and custom-entry mechanisms,/sessionreports the evaluator state, and route events render in transcript, final-text, JSON, and TUI output. Configured or extension-selected routes remain locked;/route automaticexplicitly resets evaluation. Existing pinned records without route-source metadata remain explicit.If route-state persistence fails after a completed response, Tau keeps the previous route and runtime, records a diagnostic, and still settles the completed turn. Route-specific pricing remains separate in #574.
Closes #572.
Validation
uv run pytest -qon Linux - 1533 passed, 3 skippeduv run ruff check .uv run ruff format --check .uv run mypyon Linux - no issues in 102 source fileshugo --minifywith Hugo 0.152.2 - 33 pages builtpagefind --site publicwith Pagefind 1.5.2 - 28 pages and 3,255 words indexedgit diff origin/main...HEAD --check