A voice command is refused before it is sent if it would pass the daily budget - #20
Merged
Merged
Conversation
…ly budget The voice agent only checked whether the budget was already spent, so the last command of the day went through in full and could end it over budget. It now estimates the command from its request size, as contexts and AI Task do, holds the estimate while the call runs, and reports the size to the tracker so the estimate learns from voice requests too.
This was referenced Sep 23, 2026
…n error The check refuses a command whose estimate does not fit, which happens with tokens left. The line said the budget "is spent". It now says not enough is left, in all 13 languages. With no fallback agent, the reply was an action_done response. The Assist dialog and a satellite read that as a command that went through. It is now an error, no_intent_match for a sentence not understood and failed_to_handle for the budget, a rejected key and no answer, as the default agent answers.
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.
The voice agent checked only whether the day's budget was already spent. A command that started one token under the budget went through in full, so the day could end over the budget by one command.
The agent now does what contexts and AI Task do:
payload_bytesand estimates its tokens before the call.record, so voice commands also update bytes per token.Tests:
test_a_command_that_would_pass_the_budget_is_not_sentandtest_a_voice_command_teaches_the_estimate. Both fail on 1a6c968 and pass here.Local gate: ruff, ruff format, mypy --strict, pytest (409 passed, 12 skipped, coverage 96.85%), config_flow 100%, mkdocs --strict, hassfest (0 invalid). EXIT 0.
Part 1 of the 1.16 work. Targets
feature/1.16.