Skip to content

fix(harness-ops): read plugin install's unsetOptionCount before the message sentence - #18169

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/17894-unset-option-count
Nov 22, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/17894-unset-option-count

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #17894

Summary

claude plugin install --json now prints an unsetOptionCount field when an install leaves userConfig options unset. sync-run.sh read the count only from the sentence in message, so an install whose message lacked the sentence would drop out of "Action needed". It now reads the field first and still takes the "(M required)" count from the sentence, since no field carries it.

Fix

  • plugins/harness-ops/skills/plugins/scripts/sync-run.sh: unset_user_config_of takes options_unset from unsetOptionCount when it is a positive number, otherwise from the sentence. It falls back to the sentence alone on a CLI that prints no result line. The cli_json and unset_user_config_of Claim, Basis, As-of and Recheck lines state what the 2.1.330 probe showed, and Basis links the JSON result format.
  • plugins/harness-ops/skills/plugins/scripts/fixtures/cli-json-results.jsonl: two recorded 2.1.330 result rows, install-unset-count and install-config-partial.
  • plugins/harness-ops/skills/plugins/scripts/sync-run.test.sh: the stub can emit unsetOptionCount, a recorded-shape assert covers the new row, and two cases cover the field without the sentence and with it (the required count kept).
  • plugins/harness-ops/skills/plugins/context/sync.md: the install-facts paragraph names the field.
  • .changes/harness-ops/: patch fragment.

Verification

  • Probe on Claude Code 2.1.330 with a scratch CLAUDE_CONFIG_DIR: an install with two unset options (one required) printed "unsetOptionCount":2, one with a --config partial printed "configApplied":true,"unsetOptionCount":1, and a fully configured install printed neither field. The recorded rows are in the fixture file above.
  • sync-run.test.sh: 703 PASS, All tests passed, including all 8 recorded shape asserts.
  • scripts/selection-audit.sh trace --strict on sync-run.test.sh: "No gap: every file a traced suite read selects that suite."
  • shellcheck, markdownlint-cli2 and scripts/check-changelog-fragments.sh --check pass.
  • The other suites in the same scripts folder: cache-content-check (30 cases, 0 failed), converge-plan and normalize-enabled-plugins pass. fleet-state (97 cases, 10 failed, all projectPathIsHome) and reset-refresh (3 assertions failed, HOME-tree checks) fail the same way on unmodified main in this environment, so they predate this change. Neither script is touched here.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAoAtV6H7kcRVG5xeX1rtT

…essage sentence

A probe of `claude plugin install --json` on Claude Code 2.1.330 (scratch
CLAUDE_CONFIG_DIR) shows the result carries `unsetOptionCount` when an
option is unset, and `configApplied` when --config is passed. No field gives
the required count or a disabled-by-default install.

unset_user_config_of now takes the count from the field and still reads
the "(M required)" count from the message, falling back to the sentence on
a CLI with no field. The cli_json and unset_user_config_of claims, their
Basis and As-of lines, and sync.md state what the probe showed. Two
2.1.330 result rows join the recorded fixtures, and the stub and tests
cover the field with and without the sentence.

Closes #17894

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtV6H7kcRVG5xeX1rtT
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T16:03:57.317448Z c46fe85 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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed c46fe8502b1c30ac4eb9bcb6bd074c5cb54a06cf: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read the whole diff for all 5 changed files. None of them matches a trusted-path glob, and the PR touches no plugin manifest, workflow, token request, merge hold or trust control.

What changed: In plugins/harness-ops/skills/plugins/scripts/sync-run.sh, unset_user_config_of now reads the count of unset userConfig options from the unsetOptionCount field in the claude plugin install --json result first. It still reads the required count from the message sentence. The other four files are a test stub and two new test cases, two recorded fixture rows, a doc paragraph in context/sync.md, and a changelog fragment.

Why it is safe:

  • No injection path. The field reaches jq only through a type check (type == "number" and . > 0) and comes back out through tostring. The script passes the count and the required count to jq as --arg values and converts them with tonumber. It never puts them into a shell command or an eval.
  • The split is safe. The script joins the count and message with a \u001f byte, then splits on the first one it finds. The count is either digits or empty, so it can never contain that byte, and a \u001f inside message can only end up in the text part.
  • The input is local. The value comes from the local claude CLI's own output, not from a pull request, issue or comment author. The result only decides whether an install is listed under "Action needed" in the sync report.
  • The test change stays in tests. The new CLAUDE_STUB_INSTALL_UNSET_COUNT variable is built into JSON only inside the test stub in sync-run.test.sh.

The PR description holds no embedded instructions aimed at this review. There were no earlier reviews of this PR to account for (this was not a blocking-only review).

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed c46fe8502b1c30ac4eb9bcb6bd074c5cb54a06cf: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

No findings. The change makes unset_user_config_of in sync-run.sh read the new unsetOptionCount field from claude plugin install --json first. It still takes the "(M required)" count from the message sentence, because no field carries that number.

Checked logic:

  • When the CLI prints a result line, one jq call reads the field, keeping it only if it is a positive number, together with .message, split on a 0x1F separator.
  • The sentence regex then runs on that message, or on the whole output when there is no result line.
  • The field's count wins over the sentence's count. If neither gives a count, the function returns null, so the old behaviour holds whenever the field is missing.

Checked tests:

  • The stub only adds the unsetOptionCount key when CLAUDE_STUB_INSTALL_UNSET_COUNT is set. Otherwise it passes {} as before, so existing install shapes don't change.
  • A new recorded-shape assert ties the stub to the install-unset-count row recorded from 2.1.330.
  • Two new cases cover the field without the sentence (required: null) and the field with the sentence (required count kept). The existing case for the sentence without the field still passes through the old path.

Closing issue #17894, Done-when items:

  1. Probe confirms the field, and the claim/Basis/As-of lines state what it showed: met. The probe itself is the author's claim and I could not re-run it; the two recorded fixture rows are in the diff.
  2. Read the field before falling back to the sentence, with test coverage of both shapes: met. The new cases and the recorded-shape assert would fail if this broke.
  3. sync.md states what the probe showed, and the disabled-by-default notice is still read from the message: met.

Path-scoped rules:

  • .claude/rules/skill-bodies-state-current-rules.md and .claude/rules/cost-claims.md match the changed files. Neither is broken: sync.md describes what the probe showed and points to the script and its probe rows, as the closing issue requires, and the PR makes no cost claims.

Loosened checks:

  • No loosening found. The PR only adds tests and asserts.
  • Loosened checks would be marked: fail (bundled default; the prompt had no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0.
  • The citation requirement was not checked, because the prompt had no loosened_check_decision_record: line.

Other:

  • No plugin manifest is changed. The changelog fragment's bump: patch matches a bug fix.
  • I didn't find a paved-paths standards row to apply.
  • This is the first review of this PR; prior findings had no entries and blocking only was no.
  • No hold applies: there is no billing, cost or critical-security change.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit c043f49 Nov 22, 2026
46 checks passed
@kyle-sexton
kyle-sexton deleted the fix/17894-unset-option-count branch November 22, 2026 16:09
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-ops/skills/plugins/scripts/sync-run.sh 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/harness-ops/skills/plugins/scripts/sync-run.sh:844 ROR productive input-gap
plugins/harness-ops/skills/plugins/scripts/sync-run.sh:847 SBR productive input-gap

The run's summary has the full report.

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

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

harness-ops: plugins sync reads 2.1.323's unsetOptionCount from plugin install --json

1 participant