Skip to content

fix(claude-code): numeric-aware plugin-cache version selection (fixes #95) - #101

Open
Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-95-version-sort
Open

Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-95-version-sort

Conversation

@Srinivasan8888

Copy link
Copy Markdown

Problem

The Claude Code adapter selects the "latest" plugin-cache version with a plain lexicographic sorted():

  • _latest_cache_dir() — plugins/evo/src/evo/host_install/claude_code.py
  • doctor() cache-staleness check — same file

'0.9.0' > '0.10.0' lexically (because '9' > '1'), so versions[-1] returns 0.9.0 when 0.10.0/0.11.0 also exist.

Impact:

  • _stage_hook_drain stages the native evo-hook-drain binary into the 0.9.0/bin/ dir, but Claude Code resolves ${CLAUDE_PLUGIN_ROOT} to 0.10.0, whose bin/ lacks it → hooks that need the binary break (evo direct delivery).
  • doctor() prints ✗ cache stale: installed=0.9.0, marketplace=0.10.0 (rc=1) even though 0.10.0 is installed — a false failure that also makes evo update skip the host.

The sibling codex.py adapter already solves this with a numeric-aware _ver_key; this ports the same fix.

Fix

Add a numeric-aware _ver_key and use it at both sort sites.

Tests

tests/unit/test_claude_cache_version.py (TDD, failing first): _latest_cache_dir picks 0.11.0 over 0.9.0, and 0.8.10 over 0.8.9; returns None on an empty cache. Existing test_claude_code_install_paths.py still passes.

Fixes #95.

…exically

_latest_cache_dir() and doctor()'s cache-staleness check used a plain
lexicographic sorted(), so '0.9.0' sorts after '0.10.0' and the wrong
cache dir is chosen once a two-digit minor/patch exists. That stages the
native evo-hook-drain binary into the wrong version dir (breaking hooks
under ${CLAUDE_PLUGIN_ROOT}) and makes doctor report a false
'cache stale' (rc=1), which also makes 'evo update' skip the host.

Add a numeric-aware _ver_key (mirroring the codex adapter, which already
does this) and use it at both sort sites.

Fixes evo-hq#95.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude Code host: plugin-cache 'latest version' uses lexicographic sort, picks wrong version (0.9.0 > 0.10.0)

1 participant