Skip to content

perf(harness-ops): plugins sync 4x slower; per-id jq spawns in sweep and finalize, and the single-install re-entry re-runs all of it #12532

Closed

Description

@kyle-sexton

Problem

/harness-ops:plugins sync (plugins/harness-ops/skills/plugins/scripts/sync-run.sh) is about 4x slower than it was a week ago, and the --only-install re-entry that installs one plugin takes more than a minute. The target is a no-change sync and a single-install re-entry that each finish in seconds.

The numbers below come from the run digests (<run_dir>/digest.json and .blocks.jsonl, timings) on one Windows 11 / Git Bash host.

Run harness-ops CLI Updates Total marketplace_update user_sweep finalize
2026-10-28 4.4.0 2.1.312 80 116.8 s 11.9 s 75.7 s (0.95 s/update) 16.1 s
2026-11-02 first pass 4.22.0 2.1.316 87 446 s 34.1 s 365.2 s (4.2 s/update) 37.0 s
2026-11-02 --only-install (1 install) 4.22.0 2.1.316 0 84.0 s 42.0 s

Re-entry steps: pre_install_read 2.5 s, install_enable 21.1 s (October single installs took 3-4 s), cache_content_check 15.3 s, post_read 1.5 s, finalize 42.0 s.

Neither the journal nor the digest recorded per-call CLI time, so these runs cannot split CLI time from script time after the fact.

Attribution

Script (ours):

  • The sweep went from about 2 process spawns per id in 4.4.0 (version_at plus tee) to about 6. Reading the --json result line added cli_reported_version and cli_move_result, each running cli_json (one jq -e per { line) and then another jq.
    • A jq spawn measured 56-60 ms on this host today, so that is about 0.23 s per id, or roughly 20 s of the +289 s sweep growth. This is an estimate (spawn count times measured spawn cost).
  • finalize scales with the number of updated ids. Per moved row it ran version_at, a $(version_direction) subshell, a jq -n for the row, and in monitor_rows three jq calls (id, scope, install path) plus two or three more in monitor_count_at.
    • At today's spawn cost that is about 0.4 s per row.
    • The --only-install re-entry re-runs all of it for every first-pass row, which is why one install paid 42 s of finalize.

Claude Code CLI (reported, not filed upstream):

  • A no-op claude plugin update <id> -s user --json took 1.8-3.3 s (5 calls back to back, mean 2.2 s). claude plugin list --json took 1.5-2.3 s. claude --version took 0.13 s.
  • An interleaved A/B of plugin list --json, 5 calls on each build, gave a mean of 3.30 s on 2.1.312 and 3.27 s on 2.1.316. No version regression showed on that call. An update with the old binary was not run, because update writes state.
  • marketplace update re-clones the whole marketplace on every run. The journal says "Replacing the existing marketplace clone". It was 11.9 s on 10-28 and 34.1 s today. On a no-change run (2026-10-20: total 14.8 s, marketplace_update 10.7 s) it is most of the time.

Environment:

  • CPU load was 63-71% during measurement, with Docker and the CI runner controller running. The same calls varied from 1.5 s to 3.7 s across measurements within the hour.
  • The remaining sweep growth, about 270 s, is CLI plus host load. Without per-call timing the two cannot be separated for that run. The 2.1.316 binary was installed 10 s before the run started, so a first-exec cost is possible but UNVERIFIED.

Method and results (hill-climb, one change at a time)

The bench is a fixture copy of this host's install records with all 92 melodic-software user records set below the catalog. It reads the real catalog clone and uses a stub claude (a bash script, about 0.1 s per call) and a stub cache checker. Because the CLI cost is held near zero, the bench measures the script's own overhead. Host load varied, and two baseline runs differed by 16%.

Step Change Total user_sweep finalize
0 baseline (main) 113.2 s / 134.1 s 68.0 s / 80.5 s 34.7 s / 43.4 s
1 per-call # elapsed journal line; cli: {calls, seconds} per digest block 98.8 s (CLI 17.0 s over 142 calls) 57.0 s 31.4 s
2 sweep: one jq per result line instead of four or more; installed versions for all ids from one read 75.2 s 39.0 s 27.8 s
3 finalize: one joined read of the post snapshot; rows built with builtins; version_direction without a subshell; monitor_rows paths from one read; no jq for a manifest that never mentions monitors 41.9 s 31.5 s 1.8 s

--only-install re-entry, one install, same bench: 28.4 s to 4.4 s (finalize 23.5 s to 1.1 s).

Near-no-change bench, 24 updates plus 49 other-path calls: 30.1 s to 18.3 s. That includes step 4: Step 3a's per-call settings check reads the files with a builtin instead of cksum, asks rev-parse once per path, and builds path_row without jq.

The digest blocks are identical to baseline apart from the run directory path.

Floor and what is left

  • CLI floor: a no-change sync makes one unavoidable call, the marketplace refresh, which re-clones (10.7-34 s on this host). Each update or install adds its own call (1.8-3.3 s no-op today).
  • Script floor: about 6 fleet-state.sh reads at about 1.5 s each, plus projections. The rest of the script's time is now small.

The following need an owner decision and are not in the PR:

  1. Skip claude plugin marketplace update when the remote head equals the clone's HEAD (one git ls-remote). This removes the re-clone from a no-change run.
  2. Reuse the previous snapshot when no CLI call ran between two reads, which saves about 1.5 s per skipped read. The cost is losing detection of a concurrent move inside that window.
  3. cache_content_check took 15.3 s on the re-entry with only 12 records compared, and 2.5 s when re-measured today with 2 compared. The cause is UNVERIFIED.

Cache-content coverage (accuracy)

The re-entry report said "12 of 92 user-scope install(s) compared ... 80 not checked (recorded at an older commit)".

This is not a stale read. The checked records carry the post-sweep versions (for example actionlint 0.16.1 and evals 0.14.10, matching the sweep's newVersion).

The 80 records carry gitCommitSha values that differ from the clone's HEAD at check time:

  • 83e575e3c3 (30 records) and 6e7deae009 (46 records), interleaved in id order.
  • These are neither each plugin's last-change commit (that is 17a72c43cc for the ones checked) nor one HEAD per run.
  • On 2026-10-28 all 80 updated records shared one sha and 80 of 91 matched.

The clone was also re-cloned by something outside the run at 16:56 local, after the re-entry. Concurrent marketplace refreshes during the run are a likely cause, but UNVERIFIED. The HEAD gate in cache-content-check.sh then leaves those records unchecked.

Activity

  1. added
    needs-triage
    on Nov 2, 2026
  2. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    Proposed work class: work-class: scoped
    Basis: automated intake triage; the lanes App applied this class.

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: intent
    Blocked by: none

    I understood this as a performance report on /harness-ops:plugins sync. The script's per-id jq spawns in the sweep and finalize, plus the --only-install re-entry re-running them, are measured and already addressed in a PR. Three items are left for an owner decision. #12525 covers related sync slowness, but from serial per-record updates, so I'm not treating it as a duplicate.

    Open questions:

    1. Skip claude plugin marketplace update when git ls-remote shows the remote head equals the clone's HEAD? RECOMMENDED: yes. It removes the re-clone from a no-change run, and the only cost is one cheap ls-remote.
    2. Reuse the previous snapshot when no CLI call ran between two reads? RECOMMENDED: no for now. It saves about 1.5 s per skipped read but loses detection of a concurrent move.
    3. Is the unexplained cache_content_check slowness (15.3 s vs 2.5 s) in scope here? RECOMMENDED: split it into a separate investigation, because the cause is unverified.

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated triage, applied by the lanes App.

  3. added
    needs-owner-decision
    on Nov 2, 2026
  4. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    The triage verdict left this issue at status: needs-decision:

    • flagged: intent
    • held by status: needs-decision
    • no lanes App verdict comment shows whether an earlier verdict was flagged
  5. added and removed
    needs-triage
    on Nov 2, 2026
  6. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Land the measured script-overhead reductions in sync-run.sh (one jq per result line, batched finalize reads), and decide separately whether to skip the marketplace re-clone via git ls-remote.

    Related work

    Open questions

    1. Skip claude plugin marketplace update when git ls-remote shows the remote head equals the clone's HEAD?
      RECOMMENDED: Yes. It removes the re-clone, which is most of a no-change run, for the cost of one ls-remote. Basis: .base/plugins/harness-ops/skills/plugins/scripts/sync-run.sh:1562
    2. Reuse the previous fleet-state snapshot when no CLI call ran between two reads?
      RECOMMENDED: No for now. It saves about 1.5 s per skipped read but loses detection of a concurrent move. Basis: judgment
    3. Is the unexplained cache_content_check slowness (15.3 s vs 2.5 s) and the 80 unchecked records with differing gitCommitSha in scope here?
      RECOMMENDED: No. Split it into a separate investigation, because the cause is unverified. Basis: judgment
    4. The issue says the script changes are already in a PR that is not named or linked. Should this issue track that PR's merge, or should the work be redone from the issue?
      RECOMMENDED: Track the PR: link it here, and have this issue cover only the owner-decided follow-ups once it merges. Basis: judgment

    Sources read

    • /home/runner/work/claude-code-plugins/claude-code-plugins/refine-data/context.json: issue 12532 has no owner decision comment, no task list, and three decisions left open.
    • plugins/harness-ops/skills/plugins/scripts/sync-run.sh:696: cli_json is defined here and is one of the per-result jq spawn sites.
    • plugins/harness-ops/skills/plugins/scripts/sync-run.sh:778: cli_move_result is defined here.
    • plugins/harness-ops/skills/plugins/scripts/sync-run.sh:1562: the marketplace update runs unconditionally through run_cli, with no ls-remote gate.

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  7. kyle-sexton commented on Nov 2, 2026

    @kyle-sexton
    MemberAuthor

    Related work by a peer session: #12525 (serial other-path updates; fix in #12538 makes them opt-in) and #12539 (remaining wall clock and digest size, split into #12541-#12544). Scope split: this issue and PR #12540 cover the per-id process spawns in sync-run.sh's sweep, finalize, monitor count and Step 3a row building, plus per-call CLI timing in the journal and digest. #12539 owns the marketplace-refresh skip, cache-content check cost and coverage, digest size and report length; the matching items in this issue's "need an owner decision" list and the cache-content section defer to it.

  8. kyle-sexton commented on Nov 3, 2026

    @kyle-sexton
    MemberAuthor

    Script overhead fixed in #12540 (merged). The marketplace-refresh skip is done in #12544; the snapshot-reuse question moved to #12539. Remaining sync floor work: #12541 (cache-content check), #12543 (install record count).

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

    needs-owner-decision

    Type

    Fields

    Work status

    needs-owner-decision

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions