From f4bc6aa856d928c469971d7e49b2ac695845635a Mon Sep 17 00:00:00 2001 From: Teknium Date: Thu, 2 Apr 2026 00:17:44 -0700 Subject: [PATCH] fix: scope extras retry to [all] group only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _load_installable_optional_extras() was returning ALL extras from pyproject.toml except 'all', which included 'rl' and 'yc-bench' — extras not referenced by [all] that install heavy research deps (atroposlib, tinker, wandb) from git repos. Changed to parse the [all] group's references and only retry those 18 extras. Also moved tomllib import to function-level since it only runs during the rare fallback path. --- hermes_cli/main.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 3bc9cca4334..8c3f8b55a68 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -47,7 +47,6 @@ import argparse import os import subprocess import sys -import tomllib from pathlib import Path from typing import Optional @@ -2912,8 +2911,15 @@ def _invalidate_update_cache(): def _load_installable_optional_extras() -> list[str]: - """Return optional dependency groups except the aggregate ``all`` extra.""" + """Return the optional extras referenced by the ``all`` group. + + Only extras that ``[all]`` actually pulls in are retried individually. + Extras outside ``[all]`` (e.g. ``rl``, ``yc-bench``) are intentionally + excluded — they have heavy or platform-specific deps that most users + never installed. + """ try: + import tomllib with (PROJECT_ROOT / "pyproject.toml").open("rb") as handle: project = tomllib.load(handle).get("project", {}) except Exception: @@ -2923,7 +2929,17 @@ def _load_installable_optional_extras() -> list[str]: if not isinstance(optional_deps, dict): return [] - return [name for name in optional_deps if name != "all"] + # Parse the [all] group to find which extras it references. + # Entries look like "hermes-agent[matrix]" or "package-name[extra]". + all_refs = optional_deps.get("all", []) + referenced: list[str] = [] + for ref in all_refs: + if "[" in ref and "]" in ref: + name = ref.split("[", 1)[1].split("]", 1)[0] + if name in optional_deps: + referenced.append(name) + + return referenced