The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
perf(skills): pool the guarded HTTP client across do_install's resolve + fetch
kshitijk4poor6f928eb3aea3
diff --git a/hermes_cli/skills_hub.py b/hermes_cli/skills_hub.pyindex 23af390b929..2a13c909679 100644--- a/hermes_cli/skills_hub.py+++ b/hermes_cli/skills_hub.py@@ -677,7 +677,7 @@ def do_install(identifier: str, category: str = "", force: bool = False,"""Fetch, quarantine, scan, confirm, and install a skill. ``source_id`` pins resolution to oneadapter; callers that know the provenance (``do_update``) must pass it so a bare identifiercannot resolve to a same-named skill elsewhere."""- from tools.skills_hub import HubLockFile, ensure_hub_dirs+ from tools.skills_hub import HubLockFile, ensure_hub_dirs, skills_hub_http_sessionfrom tools.skills_hub_install import install_from_quarantine, quarantine_bundlefrom tools.skills_guard import should_allow_installc = console or _console@@ -685,11 +685,13 @@ def do_install(identifier: str, category: str = "", force: bool = False,sources = _pinned_sources(c, _sources(), source_id, identifier)if sources is None:return- identifier = _full_identifier(identifier, sources, c)- if not identifier:- return- c.print(f"\n[bold]Fetching:[/] {identifier}")- meta, bundle, _matched_source = _resolve_source_meta_and_bundle(identifier, sources)+ # One pooled guarded client for the whole resolve + fetch fan-out (tree, SKILL.md, N support files).+ with skills_hub_http_session():+ identifier = _full_identifier(identifier, sources, c)+ if not identifier:+ return+ c.print(f"\n[bold]Fetching:[/] {identifier}")+ meta, bundle, _matched_source = _resolve_source_meta_and_bundle(identifier, sources)if not bundle:_print_fetch_failure(c, sources, identifier, meta=meta, source=_matched_source)returndiff --git a/tests/hermes_cli/test_skills_hub.py b/tests/hermes_cli/test_skills_hub.pyindex e46612c6388..ea67b2b43d9 100644--- a/tests/hermes_cli/test_skills_hub.py+++ b/tests/hermes_cli/test_skills_hub.py@@ -349,6 +349,12 @@ def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatchassert client_kwargs[0]["timeout"] == hub._DEFAULT_HTTP_TIMEOUTassert client_kwargs[0]["follow_redirects"] is False+ # Install runs the same resolve + fetch sequence (plus the per-file fan-out) and must pool too.+ clients.clear()+ monkeypatch.setattr(cli_hub, "_resolve_url_bundle_name", lambda *_a, **_k: False)+ cli_hub.do_install("example/id", console=Console(file=StringIO()))+ assert len(clients) == 1+