← Back to Pull requests

fix(plugins): offer same-version off-pin installs with an honest sync label #136126

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 10, 2026 12:41 UTC
Author

fix(plugins): offer same-version off-pin installs with an honest sync label

What does this PR do?

For a catalog plugin installed off-pin (e.g. from repository HEAD via the Desktop install path), the plugin row showed the version label from the catalog pin next to an update button labeled with the same version: "v1.0.0" beside "Update to v1.0.0". The button is fed by update_available, which compares the installed commit SHA to the catalog pin, while its label comes from the pin's declared version. An off-pin install whose declared version equals the pin's therefore got an affordance that changes the commit and nothing visible. This read as "the plugin is broken" and on a real Windows 10 install it triggered a destructive uninstall/reinstall cycle.

The fix keeps the detection SHA-based and makes the label honest. catalog_row_fields takes the installed tree's manifest version (the caller already has it from the same scan); when it equals the pin's version label, the row drops the version label so every surface falls back to the target commit ref: the Desktop's existing updateToPin(agent.catalog_version ?? agent.catalog_sha?.slice(0, 8)) then renders "Update to <sha8>" instead of the self-contradictory "Update to <same version>". Every off-pin install keeps its affordance, including a pin that advanced while both commits declare the same version.

Related Issue

Fixes #136122

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Changes Made

  • hermes_cli/plugins_cmd_catalog.py::catalog_row_fields: new optional keyword installed_version (the installed tree's manifest version). When it equals the pin's version label, catalog_version drops to None. update_available is unchanged (SHA-based).

  • tui_gateway/methods_tools.py::_plugin_rows: passes version from the same discovery scan it already performs (installed_version=str(version) if version else None). No extra I/O.

  • tests/hermes_cli/test_plugins_cmd_catalog.py: one invariant test - a same-version off-pin row keeps the affordance but the presented target differs from the installed version; a pin advance at the same version label keeps the affordance; a real version bump labels the new version; an unknown installed version keeps the SHA-only label.

  • Caller search: catalog_row_fields has exactly one production caller (tui_gateway/methods_tools.py:1817) plus docstring mentions in the generated gateway contract and the Pydantic row contract (tui_gateway/contracts/tools_mcp_plugins.py). The wire contract is unchanged: update_available stays bool, catalog_version was already str | None, no new field, no new config key, no desktop codegen change. The Desktop button (apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx:487) is untouched; its existing ?? catalog_sha?.slice(0, 8) fallback is what renders the commit ref.
  • Precise semantics (what is byte-identical when nothing is wrong):

  • At-pin install: update_available False, exactly as before.

  • Off-pin install with a different declared version (real update): update_available True, "Update to <new version>", same as before.

  • Off-pin install at the pin's version (the bug): the affordance STAYS (SHA-based detection is the point - a pin that advanced to a new commit at the same version is a real update), but the label falls back to the target commit ref instead of claiming "Update to <same version>".

  • Pin without a version label, or plugin without a manifest version: unchanged SHA-only behavior.
  • Deliberately not changed:

  • installed_catalog_state (the dashboard web catalog payload, web_routers/dashboard_ui.py) keeps the SHA-only signal: it has no installed tree version at hand, its entries are labeled by SHA rather than a version-prefixed button, and adding a manifest read per entry would tax every listing. Named here as a scope line.

  • A dedicated "Sync to catalog pin" label was considered and cut: the existing commit-ref fallback already renders truthfully with no new string, while a new i18n key would need translations across 9 desktop locales (the existing updateToPin key is translated in 5).

  • plugins_updates.py's SHA-based update_available (the check-updates CLI path) is a separate surface with its own known issue (#132494); not touched here.
  • How to Test

    1. RED on the pre-fix tree (upstream/main @ 6d2cf3bb73, the base when the branches were cut; all three have since been rebased onto upstream/main @ f925b01791, no overlap with the touched files):

       scripts/run_tests.sh tests/hermes_cli/test_plugins_cmd_catalog.py -q -k sync_to_pin
       -> TypeError: catalog_row_fields() got an unexpected keyword argument 'installed_version'
       0 tests passed, 1 failed
       

    2. GREEN with the fix:

       -> 1 tests passed (in the full file run: 23 pass, 1 pre-existing base failure)
       

    3. Neighborhood on this branch: tests/tui_gateway/test_plugins_manage_install.py, test_plugins_manage_late_activation.py, tests/hermes_cli/test_web_plugins_catalog.py, test_plugins_cmd_list.py - 13 pass, 1 skipped.

    Checklist

    Code

  • I've read the Contributing Guide

  • My commit messages follow Conventional Commits (fix(plugins): ...)

  • I searched for existing PRs to make sure this isn't a duplicate

  • My PR contains only changes related to this fix

  • I've added tests for my changes

  • I've tested on my platform: Windows 10 (git-bash, scripts/run_tests.sh)
  • Checks run and not run, stated plainly:

  • Ran: the red/green pair above via scripts/run_tests.sh, the neighborhood suites listed above, and the full tests/hermes_cli/test_plugins_cmd_catalog.py file.

  • Not run: the full suite; the Desktop app (the change is backend-side and the TSX renderer is unchanged; its existing SHA fallback is what renders the commit ref); scripts/check on this branch (it ran once to completion on fix/plugin-manifest-transient-hold: FAILED on the whole-tree code-health ratchet with 18 pre-existing findings, none in the files these PRs touch; CI's lint lane is the first real verdict for this branch).

  • The label equality is exact string equality of version labels (the pin's catalog version vs the installed manifest version). No semver ordering was added, matching the catalog's own "version is cosmetic, never parsed" contract.
  • Documentation & Housekeeping

  • N/A (no config keys, no schema changes, no doc changes - website/docs describes the version label as cosmetic and that contract is preserved)

  • Cross-platform impact considered: the label fallback is pure data (a version string dropped to None); no platform-specific behavior.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: PRATHAMESH75 Review duration: 78475m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.59) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.59 · 650 lines diff across 8 files
    0.59
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #136126"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 59% (MEDIUM) · Higher = larger blast radius
    59%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 32.6% · Safe to merge
    32.6%