Skip to content

feat(harness-ops): read claude plugin --json results in plugins sync-run.sh - #10363

Merged
kyle-sexton merged 9 commits into
mainfrom
feat/harness-ops-sync-run-json
Oct 27, 2026
Merged

kyle-sexton merged 9 commits into
mainfrom
feat/harness-ops-sync-run-json

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #6757

Summary

plugins sync now calls claude plugin install and claude plugin update with --json and reads
the result line. An update's updateOutcome and newVersion decide whether it moved and to which
version. The English sentence no longer decides.

Fix

  • sync-run.sh:
    • cli_json finds the result line.
    • cli_move_result and cli_reported_version read updateOutcome (updated, up_to_date)
      and newVersion.
    • cli_outcome_line falls back to the result's message.
  • Two facts are still a scrape, and why: unset userConfig options and a disabled-by-default install
    have no --json field. Both appear only as sentences inside message, so unset_user_config_of
    and install_disabled_notice match those sentences in message. Output with no result line, as
    from a CLI older than the flag (2.1.268), is still read as text.
  • context/sync.md states both rules.
  • Test stub: prints the recorded result-line shapes, has a reword mode that keeps the fields and
    changes the sentence, and has a text mode for an older CLI.
  • fixtures/cli-json-results.jsonl records the real lines. A contract check holds every stub line
    to its recording's keys and updateOutcome.

Verification

  • The evidence is attended, captured on this machine: WSL2, Claude Code 2.1.310, a throwaway
    CLAUDE_CONFIG_DIR and HOME, against a guarded local staging of this repository's marketplace,
    with non-essential traffic off. The full record is in the session's
    .work/issue-lane-powers/PROBE-claude-cli.md (gitignored, not in this PR). The raw result lines
    are in plugins/harness-ops/skills/plugins/scripts/fixtures/cli-json-results.jsonl. That run
    shows:
    • update --json with a version change returns "updateOutcome":"updated","oldVersion":"1.0.0","newVersion":"2.0.0";
    • a no-op update returns "updateOutcome":"up_to_date";
    • unset options appear only in message: 2 userConfig options not yet set (1 required) — ....
  • bash plugins/harness-ops/skills/plugins/scripts/sync-run.test.sh: all tests pass.
  • Mutation checks:
    • With cli_json forced to return nothing, "json result: up_to_date for an id that moved is a
      moved-during-run row" fails.
    • With the stub's failed install carrying pluginId, "recorded shape: a failed install" fails.
  • scripts/check-affected.sh: 12 passed, 1 skipped.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 5 commits October 25, 2026 17:35
…run.sh

sync-run.sh now calls `claude plugin install` and `claude plugin update`
with --json and classifies each update from the result line's
updateOutcome and newVersion instead of its English sentence. Unset
userConfig options and a disabled-by-default install have no field of
their own (attended probe, Claude Code 2.1.310), so those two are still
matched in the result's message. Output with no result line, from a CLI
older than the flag, is still read as text.

The test stub prints the captured result-line shapes, and new cases
reword the message so only the fields can decide.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tub to them

fixtures/cli-json-results.jsonl keeps the install and update result lines
an attended probe captured from Claude Code 2.1.310. A new check holds
each stub result line to its recording's keys and updateOutcome.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-10-26T21:17:59.514620Z 09d34f1 PR opened
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 6f46caa59a2c85f908c03d6a5b307ebf04e012cf: 0 finding(s), 0 as inline comments.

Security review: PR #10363, no findings.

I read the whole diff and the PR context. This is a script parsing change plus its tests, fixture and docs. None of the changed files match a trusted path. The PR touches no trust control: no trusted-actor list, token scope, kill switch, merge hold or CODEOWNERS entry. It has no plugin manifest change and deletes no standing instruction.

I checked these points:

  • Retry without --json: run_cli re-runs a failed call once, and only when the output contains both "unknown option" and "--json". The retry removes --json, so it cannot recurse a second time. A CLI that rejects an unknown option has not executed the command, so the retry does not repeat a mutation. Nothing outside the CLI's own output reaches the check. The arguments are passed as an array, not through eval or string interpolation.
  • Result-line parsing: cli_json takes the last output line that is a JSON object with a command key, validated with jq -e. Values reach the script only through jq -r into printf -v and case branches. Nothing is evaluated or used as a command or path. Stderr is merged into the capture, so a line printed by a marketplace-declared command could in theory pose as the result. The worst it can do is set updateOutcome to up_to_date, updated or something else, and finalize_moves still checks that against the before and after snapshots. It cannot widen any grant or skip a gate, so I did not count it as a finding.
  • Classifier scope: unset_user_config_of and install_disabled_notice now read only the result's message when a result line exists. This only narrows what can set those flags.
  • Test stub and fixture: the fixture holds recorded CLI output with placeholder plugin names and no secrets. The stub is test-only.

Spend: none. The change adds no billed resource or paid setting.

critical-findings: 0

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 6f46caa59a2c85f908c03d6a5b307ebf04e012cf: 0 finding(s), 0 as inline comments.

No findings. I read the full diff, the PR context and the surrounding sync-run.sh code (run_cli, jq_to, the downgrade branch). I did not run the test suite. The pass results in the PR body are author-claimed and unverified by me.

What I checked

  • run_cli retry: it re-runs once without --json only when CLI_RC is non-zero and the output matches unknown option ... --json. The retry call carries no --json, so it cannot recurse. The ${label/ --json/} strip also works for the downgrade label.
  • Variable names: the __var / __json / __text locals in cli_json and cli_message do not collide with the callers' variable names under bash dynamic scoping.
  • Fallbacks:
    • cli_move_result returns other and cli_reported_version returns empty when a result line has an unrecognised or missing updateOutcome, so the post-sweep re-read decides.
    • cli_outcome_line skips {-prefixed lines in its failure match and then falls back to the first line of message.
    • install_one still classifies from the untruncated CLI_OUT.
  • Closing issue feat(harness-ops): read claude plugin --json output in plugins sync-run.sh instead of scraping text #6757, criterion 1 (real output captured in a fixture): met. fixtures/cli-json-results.jsonl holds the recorded lines.
  • Criterion 2 (classify from --json fields, name the remaining scrape): met. cli_json and sync.md name the two message-text facts and justify them.
  • Criterion 3 (existing sync tests pass): author-claimed, not verified by me.
  • Manifest items: the diff changes no plugin.json or marketplace.json. The changelog fragment's bump: patch fits an internal parsing change with no new capability or interface.

Not a finding: the real result lines are never parsed. The contract check compares only the stub's key sets and updateOutcome against the recordings, plus two assert_contains checks on sentences. The recorded message strings, with their real em dash, never go through unset_user_config_of or install_disabled_notice. The stub copies the sentences with a hyphen. The classifiers key on the words before the dash, so I found no failure. Running those two classifiers over the fixture's messages would still close this gap.

Spend: no billing or paid-plan change.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09d34f1a22

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kyle-sexton and others added 2 commits October 26, 2026 23:22
…ence

The sync spoke restated the plugin CLI's JSON result fields, its result
sentences and a version-specific absence of fields, which the skill-body
rule forbids. Keep the decision (sync-run.sh classifies both install facts
from the result message) and replace the restatement with a pointer
record naming the probe fixture and the script's basis comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on b73a77c16b7de1064dfb1f5425135bf076809b88; the summary is in this lane's pull request comment.

claude-lane: claude-review

kyle-sexton and others added 2 commits October 27, 2026 10:02
…ects it

A CLI older than --json fails the call with an unknown-option error, so
every install and update landed in the failure branch and the text
fallback never ran. run_cli now repeats such a call once without
--json. The test stub's text mode rejects --json the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 4437c69 Oct 27, 2026
39 checks passed
@kyle-sexton
kyle-sexton deleted the feat/harness-ops-sync-run-json branch October 27, 2026 15:15
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.

feat(harness-ops): read claude plugin --json output in plugins sync-run.sh instead of scraping text

1 participant