Skip to content

fix(claude-ops): refuse to downgrade in plugins sync and document marketplace remove - #3936

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/plugins-sync-downgrade-guard
Sep 7, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/plugins-sync-downgrade-guard

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #3930
Closes #3931

Summary

/claude-ops:plugins sync selected update candidates on string inequality and called claude plugin update unconditionally, so a marketplace catalog that read lower than the installed versions rolled the whole fleet back and the report printed the rollback under Updated:. Separately, the skill presented its run journal under ${CLAUDE_PLUGIN_DATA} as a recovery source without saying that claude plugin marketplace remove deletes it along with every install record for the marketplace.

Fix

  • fleet-state.sh compares direction with a numeric major.minor.patch triple. A catalog version lower than installed is a proven downgrade, withheld from update-candidates-user and the new update-candidates-project, and named by the new downgrade-candidates selector (id\tscope\tinstalled\tcatalog). Null, unparseable, and tied versions stay fail-open candidates, as before.
  • sync: Steps 2 and 3 sweep only the guarded selectors; withheld ids go under Action needed with the likely cause (a marketplace source that moved backward); --allow-downgrade is the explicit opt-in; Step 6 classifies every old/new pair by direction so a backward move renders under the new Downgraded: row and never Updated:, including for fail-open ids the CLI still touched; Step 1 saves pre-refresh.<mp>.json before each refresh and Step 6 diffs catalog_versions across consecutive snapshots to name the first interval a catalog moved backward; a failed refresh no longer widens the sweep to unguarded installed-user; audit predicts Would withhold.
  • converge: the update-to-highest strategy is BLOCKED when the catalog is below the highest installed scope (plugin update installs the catalog version, not the sibling scope's).
  • gotchas.md gains a section stating that marketplace remove, with plugins still installed, deletes every install record at every scope, each plugin's CLAUDE_PLUGIN_DATA directory (this skill's plugins-sync/runs/ included), and the marketplace's enabledPlugins/pluginConfigs entries, with no --keep-data on that subcommand; the settings map is a recovery source only where something outside Claude Code holds it. sync.md states the journal's durability boundary; scope-semantics.md separates its post-uninstall observation from the still-installed case. Four-part verification record included.
  • claude-ops 0.43.0 -> 0.44.0, CHANGELOG entry, one new eval case.

Verification

  • fleet-state.test.sh: 90 cases, 240 assertions, 0 failed (86 cases before). New cases cover catalog lower / higher / null / unparseable / prerelease tie, update-candidates-project, downgrade-candidates, --from for all three, required-field rejection, and the selector error text.
  • Independent fresh-context verifier built its own fixture (installed 0.43.0, catalog 0.38.21): update-candidates-user emits nothing, downgrade-candidates emits the id with both versions; with catalog 0.44.0 the reverse. Mutation check: inverting the compare fails 8 cases.
  • The verified marketplace remove claims come from the CLI bundle (2.1.263; same strings in 2.1.260 and 2.1.261), the plugin-marketplaces and plugins-reference pages fetched 2026-09-07, and --help output. No mutating claude plugin command was run.
  • shellcheck -x, shfmt -d, markdownlint-cli2 (0 issues), check-purged-em-dashes.sh --check, check-changelog-parity.sh --check --check-bump origin/main, check-changed-skills.sh origin/main (plugins: PASS), evals schema validation (check-jsonschema) and check-evals-quality.sh: all pass. affected-tests.sh --run selects ~155 suites via the version bump; fleet-state.test.sh passes inside it, and the failures seen locally are Windows symlink/fixture-git environment failures in unrelated plugins.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01QKEaVqVaeGnNeFq14sc6pW

@kyle-sexton
kyle-sexton marked this pull request as ready for review September 7, 2026 15:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T15:06:37.778576Z 706a34f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…ketplace remove

fleet-state.sh compares direction: a catalog version parsed to a numeric
triple that is lower than the installed one is a proven downgrade,
withheld from update-candidates-user and the new update-candidates-project
and named by the new downgrade-candidates selector. sync sweeps only the
guarded selectors, reports withheld ids under Action needed with the likely
cause, takes --allow-downgrade as the explicit opt-in, classifies every
old/new pair by direction in Step 6 so a backward move renders under
Downgraded: and never Updated:, snapshots the catalog before each Step 1
refresh and diffs consecutive snapshots to name the interval a catalog
moved backward, and no longer widens to installed-user on a failed
refresh. converge blocks its update-to-highest strategy when the catalog
is below the highest installed scope.

gotchas.md, sync.md and scope-semantics.md state that marketplace remove
with plugins still installed deletes every install record at every scope,
each plugin's CLAUDE_PLUGIN_DATA directory including this skill's run
journal, and the marketplace's settings entries, with no --keep-data on
that subcommand; verified against the CLI bundle, the plugin-marketplaces
and plugins-reference pages, and --help on 2026-09-07 (Claude Code
2.1.263, win32).

Closes #3930
Closes #3931

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QKEaVqVaeGnNeFq14sc6pW
@kyle-sexton
kyle-sexton force-pushed the fix/plugins-sync-downgrade-guard branch from 706a34f to d5b6ea0 Compare September 7, 2026 15:05
@kyle-sexton
kyle-sexton merged commit be3fb2a into main Sep 7, 2026
3 checks passed
@kyle-sexton
kyle-sexton deleted the fix/plugins-sync-downgrade-guard branch September 7, 2026 15:22
kyle-sexton added a commit that referenced this pull request Sep 7, 2026
…pshot (#3938)

Closes #3937

## Summary

The catalog-regression check added to the `plugins` skill in 0.44.0
diffs consecutive run-journal
snapshots and names the first interval in which a marketplace catalog
moved backward. The earliest
snapshot in that chain, `pre-refresh.<mp>.json`, was written by
`sync.md`'s Step 1 in the same code
fence as `claude plugin marketplace update`. The `audit` action runs the
same algorithm with every
mutating call replaced by a prediction, so the skill read Step 1 as
wholly mutating and said so
outright: Step 3's `audit` bullet stated "Step 1 never runs", and the
run journal's `audit` paragraph
listed only Steps 2-5 among the reports an `audit` run writes. An
`audit` run's regression check
therefore started at `pre` and lost its first interval, the one that
isolates the refresh point.

The snapshot is a read, taken through the read-only `fleet-state.sh`.
`audit` legitimately declines
only the `claude plugin marketplace update` call beside it.

## Fix

Prose only; no script changed.

- **`context/sync.md` Step 1** splits its one code fence in two, each
labelled: the snapshot is a
read both actions take, the refresh is the `sync`-only mutation that
`audit` renders as
`would run:`. The rationale paragraph now states what a regression in
the `pre-refresh` to `pre`
interval means per action: under `sync` this run's own refresh pulling a
source that moved
backward, under `audit` the catalog changing under the run, since that
run issued no refresh.
- **Step 3's `audit` bullet** now reads "Step 1's refresh never runs
(its snapshot is a read and is
  still taken)" instead of "Step 1 never runs".
- **The "Run journal" section**: the `pre-refresh.<mp>.json` table row,
the file-list paragraph, the
catalog-regression bullet, and the `audit` scratch-directory paragraph
now read for both actions,
and place the scratch `run_dir`'s creation before Step 1 rather than
before Step 2.
- **`SKILL.md`**: the action table row ("every mutating CLI call
replaced with a prediction; the
reads those calls sit beside still run") and the "Action: audit"
section, which now states the
Step 1 snapshot is taken and why, and describes the scratch directory
the same way.
- **`evals/evals.json`**: eval 2, `audit-issues-zero-mutating-calls`,
gains an expectation that the
response still takes the pre-refresh snapshot before declining the
refresh, with its
  `expected_output` amended to match.

`fleet-state.test.sh` gains no case: no script changed, and its only
`sync.md` mention is a comment.
The behaviour under test is prose the model executes, which is what the
eval covers.

Out of scope and deliberately untouched: the downgrade guard's own
logic, and the version parser's
three-component ceiling being framed only as a prerelease-suffix case.

## Verification

Rebased onto `main` at 90cd27d after `fad23dfeb` took 0.44.1; this
change is 0.44.2. Both commits
are signature-verified.

- `check-skill.sh plugins` (skill-quality's static contract gate): `PASS
— 0 errors, 1 warning(s)`.
The warning is the pre-existing 200-line soft target (SKILL.md is 419
lines against a 500 hard
cap; it was 413 before this change). Its internal probes reported
`markdownlint clean` and passed
all three bundled script suites: `fleet-state.test.sh`,
`cache-content-check.test.sh`,
  `normalize-enabled-plugins.test.sh`.
- `fleet-state.test.sh` standalone, the one suite `affected-tests.sh
--explain` attributes to
  `sync.md`: `90 cases, 0 failed`.
- `check-evals-quality.sh`: `PASS (0 warning(s) across 1 file(s))`. The
evals file also validates
  against the bundled `evals.schema.json`.
- `markdownlint-cli2` over the three changed markdown files: `Summary: 0
issues in 0 files`.
- `check-changelog-parity.sh` in all four modes: `--check`,
`--check-bump origin/main`,
`--check-preserved origin/main` (184 headings compared), `--check-order`
(93 changelogs). All pass.
- `check-purged-em-dashes.sh --check`: 98 declared paths, 130 files
scanned, no em dashes.
- A separate fresh-context verifier subagent audited the committed diff
blind to the reasoning that
produced it, against pass/fail criteria: does `audit` now take the
snapshot, does it still issue
zero mutating calls, is the first interval available in both actions,
does the committed prose
match the (unchanged) scripts, and do the repo's conventions hold.
Verdict: PASS on all eight
criteria, no must-fix items. Its nice-to-haves are folded into the
second commit.

No `claude plugin` mutating command was run at any point in producing
this change.

## Related

Refs #3930 (the downgrade guard's originating report) and #3936 (the PR
that added the guard and
this snapshot chain).

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: ksextonmelodic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant