Skip to content

[bug] install-plugin.sh --postgres leaves mixed package versions in the deps directory on upgrade #573

Closed

Description

@cdeust

What happened

Upgrading an existing PostgreSQL plugin install from 4.21.0 to 4.22.0 with bash scripts/install-plugin.sh failed at verification step 6/7:

ImportError: tokenizers>=0.22.0,<=0.23.0 is required for a normal functioning of this module, but found tokenizers==0.23.2.
[FAIL] sentence-transformers

scripts/setup.sh:224 (the PostgreSQL path) runs python3 -m pip install -q --target "$DEPS_DIR" --no-deps --require-hashes -r requirements/setup.txt directly into the persistent $CLAUDE_PLUGIN_DATA/deps. Without --upgrade, pip keeps every top-level entry that already exists and prints WARNING: Target directory .../deps/<pkg> already exists. Specify --upgrade to force replacement. It skips the package directories but adds the new versioned *.dist-info next to the old ones. After the upgrade, the deps directory held the old code under new metadata:

package dist-info present code actually loaded
sentence-transformers 5.6.1 and 6.0.1 5.6.1
transformers 5.14.1 and 5.16.1 5.14.1
tokenizers 0.22.2 and 0.23.2 mixed
huggingface_hub 1.26.0 and 1.30.0 mixed

scripts/setup.py:224 (the SQLite path) makes the same direct --target call. Its comment says skip-if-present is deliberate for concurrency (ADR-0749). That holds on a first install, not across versions.

The launcher already has the correct upgrade path: scripts/launcher_deps_install.py installs into a scratch target, commits entry by entry with rollback (commit_entry), and prunes superseded *.dist-info (_commit_resolved_entries). The install scripts bypass it.

Reproduction steps

  1. Plugin 4.21.0 installed with --postgres, deps populated in ~/.claude/plugins/data/hypermnesia-mcp-cortex-plugins/deps.
  2. claude plugin update hypermnesia-mcp@cortex-plugins → 4.22.0.
  3. CLAUDE_PLUGIN_ROOT=<4.22.0> CLAUDE_PLUGIN_DATA=<data> bash scripts/install-plugin.sh.
  4. Step 3/7 prints the already exists warnings, and step 6/7 fails on sentence-transformers.

Expected behavior

An upgrade leaves exactly one version of each package in the deps directory, the one pinned by requirements/setup.txt, and verification passes. Workaround used on 2026-09-15: install into a fresh directory (pip install --target deps.new ... -r requirements/setup.txt), check it through the launcher and a real embedding, then swap it in. The re-run of install-plugin.sh then passed all 7 steps.

Environment

  • macOS 26, Python 3.14.4, PostgreSQL 17.9
  • Cortex 4.21.0 → 4.22.0

Severity

High (every upgrade that changes a pinned dependency breaks the embedding stack until the deps directory is rebuilt by hand)

Evidence required to close

A test that upgrades a deps directory holding version N of a package to the version N+1 pinned in requirements/setup.txt, through both setup.sh and setup.py, and asserts that exactly one *.dist-info per distribution remains and matches the pin. Both scripts should route through the launcher's scratch-and-commit install instead of a direct --target.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions