fix(skills): honour overall_timeout and bound ClawHub catalog walk - #43326
Merged
Conversation
parallel_search_sources accepted an overall_timeout but never honoured it. The ThreadPoolExecutor ran inside a `with ... as pool` block, whose __exit__ calls shutdown(wait=True); even after as_completed() raised TimeoutError on schedule, leaving the block blocked the caller until every worker finished. A single slow source (e.g. ClawHub) therefore stalled the entire browse for minutes. Manage the executor manually and shut it down with wait=False, cancel_futures=True in a finally, so the timeout actually returns and not-yet-started work is dropped. ClawHubSource._load_catalog_index walked up to 750 sequential pages with no wall-clock bound (each request under its own timeout=30, so nothing errored), and wrote the result to the index cache unconditionally — so an interrupted or slow walk poisoned the cache with a partial catalog. Add a CATALOG_WALK_BUDGET_SECONDS deadline that breaks the walk early, and only write the cache when the walk reaches a natural stop (cursor exhausted or page cap), never on a budget-truncated walk. Adds regression tests covering both bugs (timeout honoured + slow source flagged; budget abort does not poison cache) plus their happy-path invariants.
Contributor
🔎 Lint report:
|
This was referenced Jun 10, 2026
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
hermes skills browse/searchnow return promptly instead of hanging for minutes on a slow source. Salvage of #38481 by @briandevans onto currentmain.Root cause was two bugs that made the existing
overall_timeouta no-op:parallel_search_sourcesmanaged its executor withwith ThreadPoolExecutor(...) as pool, whose__exit__callsshutdown(wait=True)— blocking the caller until the slowest worker (ClawHub) finished, regardless of the timeout._load_catalog_indexwalked up to 750 sequential pages (50k+ skills, each requesttimeout=30) with no wall-clock bound, so it realistically never terminated early.Changes
tools/skills_hub.py: manage the executor manually andshutdown(wait=False, cancel_futures=True)infinallysooverall_timeoutis honoured.tools/skills_hub.py: bound the ClawHub catalog walk with a 12s wall-clock budget (CATALOG_WALK_BUDGET_SECONDS); skip caching a budget-truncated walk so partial data can't poison the cache.TestParallelSearchSourcesTimeout) + catalog-walk budget/cache tests.Validation
overall_timeout=1sE2E verified with real imports against current
main.Closes #38481.
Infographic