Skip to content

fix: a research provider cannot outlast the search deadline - #102

Merged
alexeybe1kin merged 1 commit into
mainfrom
fix/research-provider-deadline
Nov 13, 2026
Merged

alexeybe1kin merged 1 commit into
mainfrom
fix/research-provider-deadline

Conversation

@alexeybe1kin

Copy link
Copy Markdown
Collaborator

Hunt toolgate-4 F5. search() passed min(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 past until (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 exhausted and 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.

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.
@alexeybe1kin
alexeybe1kin merged commit 97a108c into main Nov 13, 2026
4 checks passed
@alexeybe1kin
alexeybe1kin deleted the fix/research-provider-deadline branch November 13, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant