Skip to content

fix(lazy_deps): range huggingface-hub + never downgrade a shared dependency - #70115

Closed
teknium1 wants to merge 2 commits into
mainfrom
fix/lazy-deps-hf-hub-range
Closed

fix(lazy_deps): range huggingface-hub + never downgrade a shared dependency#70115
teknium1 wants to merge 2 commits into
mainfrom
fix/lazy-deps-hf-hub-range

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

hermes update can no longer downgrade huggingface-hub (or any shared dependency) out from under its other consumers — fixing the Hindsight local-embeddings breakage in #60783.

Root cause: LAZY_DEPS["tool.trace_upload"] exact-pinned huggingface-hub==1.2.3. active_features() marks a feature active from mere package presence (hub is a transitive of faster-whisper/tokenizers in the core lock), so every post-update lazy refresh reinstalled the stale pin, downgrading hub below the >=1.5.0,<2 range that transformers/sentence-transformers (Hindsight local embeddings) require. The daemon then failed on startup with a misleading "sentence-transformers is required" error.

Changes

  • tools/lazy_deps.py: tool.trace_upload pin widened to huggingface-hub>=1.5.0,<2.0 (the range transformers requires; HfApi surface used by trace upload — whoami/create_repo/upload_file — is stable across 1.x)
  • tools/lazy_deps.py: generic no-downgrade guard in _is_satisfied() — any lazy spec whose only path to satisfaction is moving an already-installed package backwards is treated as satisfied, the installed version is left in place, and a maintainer warning is logged. Fixes the class, not just this pin.
  • tests/tools/test_lazy_deps.py: invariant test that the trace-upload spec admits transformers' whole accepted range (fails loudly if ever re-pinned into conflict); regression test that a newer compatible hub is treated as current

Validation

Before After
hermes update with hub 1.24.0 installed downgrades to 1.2.3, Hindsight daemon fails refresh no-op, hub left at 1.24.0
old ==1.2.3 spec vs installed 1.24.0 silent downgrade guard holds installed version + warns
legit upgrade spec (floor above installed) installs still installs (guard only blocks backwards moves)
  • scripts/run_tests.sh tests/tools/test_lazy_deps.py — 66/66 green
  • Live E2E in a clean venv with real huggingface-hub 1.24.0: new range satisfied, feature_missing() empty, no-downgrade guard exercised against the old pin
  • HfApi call surface verified present with identical kwargs on 1.24.0

Credit

Salvages #60797 by @falkoro (earliest submitter — range fix + invariant tests; floor raised from 1.2.3 to transformers' 1.5.0 during conflict resolution) and #68008 by @spiky02plateau (no-downgrade guard). Both authorships preserved via cherry-pick. Same-cluster PRs #66261 (@stigrunar) and #63936 (@lipton-agent-hermes) reached the same range independently.

Fixes #60783.

Infographic

infographic

falkoro and others added 2 commits July 23, 2026 07:33
…aking Hindsight

tool.trace_upload pinned huggingface-hub==1.2.3, but huggingface-hub is a
shared dependency: transformers (via sentence-transformers, the Hindsight
local-embeddings provider) requires huggingface-hub>=1.5.0,<2.0.

active_features() flags a feature as active from mere package presence,
so having sentence-transformers installed marks tool.trace_upload active
even for users who never ran a trace upload. On the next hermes update,
_refresh_active_lazy_features() sees the ==1.2.3 pin unsatisfied and
downgrades the shared package, breaking Hindsight startup with
ImportError: huggingface-hub>=1.5.0,<2.0 is required.

Widen the pin to huggingface-hub>=1.2.3,<2.0 (ranges are the norm in
LAZY_DEPS; the == pin was the outlier): every transformers-compatible
version now satisfies the spec, so the refresh treats it as current
instead of downgrading, and a fresh lazy install resolves to a current
1.x. The HfApi surface trace upload uses (whoami / create_repo /
upload_file) is stable across the whole 1.x line.

Tests pin the invariant: the trace_upload spec must admit every version
transformers accepts (loud failure if someone re-pins it into conflict),
and feature_missing() must report a newer in-range hub as satisfied.

Fixes #60783
…r huggingface-hub

An exact ==1.2.3 pin on huggingface-hub (feature tool.trace_upload)
force-downgraded the shared venv on every lazy refresh whenever the core
embedding stack (transformers/sentence-transformers, used by
local/local_embedded Hindsight) had installed a newer version — transformers
5.x requires huggingface-hub>=1.5,<2.0, so the downgrade made
sentence_transformers unimportable and the embedded Hindsight daemon abort
at startup (silent memory loss until noticed).

Two layers:
- Track the compatibility range the trace-upload client actually needs
  (>=1.5,<2.0) instead of an exact pin, so an already-healthy shared
  version satisfies the spec and is left alone.
- Add a general no-downgrade guard in _is_satisfied: a lazy, opt-in
  backend must never move an already-installed package backwards; treat
  'installed newer than the pin allows' as satisfied and warn to widen
  the pin. Legitimate upgrades (installed below the spec) are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MN8RMDLwxCfFxwtADoEJJf
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

running on 3ab819d


Still running 1 job: Build&Test Docker image / build (amd64, ubuntu-latest, linux/amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=do...

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence upload failed.

Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso)

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/memory Memory tool and memory providers area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades duplicate This issue or pull request already exists labels Jul 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #68008. Both current diffs implement the same shared-dependency no-downgrade guard and compatible huggingface-hub range; #68008 is the earlier open canonical PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lazy_deps: huggingface-hub==1.2.3 pin conflicts with transformers >=1.5.0 requirement, breaks Hindsight local embeddings

4 participants