fix: enforce max_minutes on late provider responses - #3
Open
r0jin wants to merge 1 commit into
Open
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.
What
Re-check the transport-clock time budget after each provider response and before processing its tool calls.
This prevents late
declare_successanddeclare_failureresponses from bypassingbudgets.max_minutes, while preserving the existingmax_stepsandmax_llm_callscounting semantics.The issue was reproducible with a 6-second
max_minutesdeadline where a provider returned after advancing the mock transport clock to 7 seconds. Before this change, the latedeclare_successwas still accepted.Kind of change
quackd/verbs/) — I updateddocs/architecture.mdandquackd list-verbsshows it.duckfile (ducks/) —quackd validatepasses and I ran it with--provider fake --transport sim2dquackd/transport/upstream_api.pymarkedVERIFIED(with a link) orUNVERIFIED, anddocs/transport-status.mdis updatedTesting
Added deterministic regression coverage for:
declare_successaftermax_minutesexpiry →budgetdeclare_failureaftermax_minutesexpiry →budgetThe in-budget test also uses
max_llm_calls=1to ensure the fix does not incorrectly reject the final permitted provider response.Checklist
uv run ruff check . && uv run ruff format --check . && uv run mypy && uv run pytestpass locally