Skip to content

fix(skills): honour overall_timeout and bound ClawHub catalog walk - #43326

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-80729e53
Jun 10, 2026
Merged

fix(skills): honour overall_timeout and bound ClawHub catalog walk#43326
teknium1 merged 1 commit into
mainfrom
hermes/hermes-80729e53

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

hermes skills browse/search now return promptly instead of hanging for minutes on a slow source. Salvage of #38481 by @briandevans onto current main.

Root cause was two bugs that made the existing overall_timeout a no-op:

  1. parallel_search_sources managed its executor with with ThreadPoolExecutor(...) as pool, whose __exit__ calls shutdown(wait=True) — blocking the caller until the slowest worker (ClawHub) finished, regardless of the timeout.
  2. ClawHub's _load_catalog_index walked up to 750 sequential pages (50k+ skills, each request timeout=30) with no wall-clock bound, so it realistically never terminated early.

Changes

  • tools/skills_hub.py: manage the executor manually and shutdown(wait=False, cancel_futures=True) in finally so overall_timeout is 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.
  • Tests: timeout-honoured regression (TestParallelSearchSourcesTimeout) + catalog-walk budget/cache tests.

Validation

Before After
slow source (10s) + overall_timeout=1s blocks ~10s returns in 1.00s, slow source flagged timed-out, fast source still delivered
budget-truncated catalog walk caches partial data does not write cache
targeted suite 14 passed

E2E verified with real imports against current main.

Closes #38481.

Infographic

skills-browse-timeout-fix

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.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-80729e53 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10649 on HEAD, 10649 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5579 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/skills Skills system (list, view, manage) labels Jun 10, 2026
@teknium1
teknium1 merged commit 105625d into main Jun 10, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-80729e53 branch June 10, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants