Repository navigation
fix: a research provider cannot outlast the search deadline - #102
Merged
Merged
Conversation
Each provider got min(8, remaining) as an httpx timeout but makes several calls in a row, each with that full value, so one provider could run 24-48 s, past the search deadline and the owner's tool time limit (hunt toolgate-4 F5). Each provider now runs under a wall clock of the time left; when it runs out the search reports the deadline and drops the late answer.
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.
Hunt toolgate-4 F5.
search()passedmin(8.0, remaining)to each provider as an httpx per-phase timeout. Several providers make calls in a row, each with that full timeout: Stack Exchange 3 sites, YouTube 1 + 5, Product Hunt 2, GitHub 2. So one provider could run 24-48 s, past search's 24 s deadline and pastuntil(the owner's tool_seconds) from search_bundle.Now
_within()runs each provider in a daemon thread (copied context) and waits only for the time left. When it runs out, the search records<provider>: shared deadline exhaustedand stops, as it already did when the deadline passed between providers. A late provider ends at its own per-call timeouts and its answer is dropped. Provider errors are re-raised and handled as before. Slow-drip page fetches (F6) are a separate item.Test (toolgate/tests/test_tool_settings.py): a provider making 3 calls of 1 s against a 0.5 s deadline. The search must return in under 2 s with the deadline failure. It fails on main. Local: tool settings + every research test file, 290 passed. ruff ok, types ok.