Skip to content

refactor(harness-ops): simplify reset-refresh.sh error and refusal paths - #15035

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14584-42781355617-1
Nov 10, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14584-42781355617-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14584

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified plugins/harness-ops/skills/plugins/scripts/reset-refresh.sh without changing its behavior. It now has die and refuse helpers that print the same ERROR:/REFUSED: lines and exit 2, replacing about a dozen copied echo-and-exit blocks. An entry_count helper replaces three find|wc|tr pipelines in preview. The running-claude refusal is now one check after both the Windows and Unix process lookups instead of two copies. The journal-root case statement is now a single [[ ]] test. Every message, exit code, check order, flag and written file stays the same.

Not verified

  • reset-refresh.test.sh was not executed: this lane runs only the named wrappers, so the PR's CI runs the suite
  • tidy: passes 1-3 (simplify, comments, generated-code residue) ran with no edits; passes 4-5 (docs-hygiene, ai-slop) were skipped because the only markdown is the changelog fragment, whose text the issue requires verbatim
  • shellcheck/shfmt and a separate build step were not run directly; check-affected covered the changed files, and the CI-only lints run on the PR

Fix

  • plugins/harness-ops/skills/plugins/scripts/reset-refresh.sh: added die/refuse helpers and an entry_count helper; collapsed the echo+exit blocks, the state-file validation loop, the duplicated running-claude refusal and the journal-root case into shorter equivalent forms (509 -> 477 lines)
  • .changes/harness-ops/work-resolve-issue-issue-14584-42781355617-1-009b2297.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against e682e72:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 5 fragments valid (run before and after tidy)
  • check-changed-skills: CHECK-SKILL plugins PASS, 0 errors, 4 warnings that predate this change (SKILL.md size, description length, converge.md TOC)
  • check-affected: 13 passed, 6 skipped, over the 2 changed files (run before and after tidy)
  • fresh-context review subagent compared old and new behavior line by line: no difference that real tools or the test stubs can trigger. One theoretical divergence: the Unix branch now refuses on non-empty pgrep output rather than on exit 0. The two differ only if pgrep -x exits 0 with no output or…
  • Grep of reset-refresh.test.sh for the asserted strings (REFUSED: CLAUDE_CODE_REMOTE, REFUSED: an earlier backup exists, pid 5150, Cache: 2 entries, 1 temp_git_*, clean also discards data/: 1 entries): every asserted text is printed unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42781355617

Left out: the items under Not verified.

Related

#14584

Merge-Risk: max=MEDIUM demote=false head=e682e7211834b19f699532ae291322f38a7befc6 rubric=8.3.3 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read both changed files in full: the harness-ops changelog fragment and plugins/harness-ops/skills/plugins/scripts/reset-refresh.sh. Then I compared the old and new versions of each changed block, under the script's set -uo pipefail (it does not use -e).

Behavior is the same. For every input that can actually occur, each rewritten path prints the same message and returns the same exit code as before:

  • die / refuse helpers: they print ERROR: … and REFUSED: … to stderr and exit 2, like the blocks they replace. The text of every message is unchanged, including --journal-root requires a directory.
  • State-file loop: the new if [[ ! -f ]]; then … continue; die; fi and then an unconditional jq empty check gives the same results as the old two guards. The user's settings file may still be missing, any other missing file still dies with not found:, and an existing file that isn't valid JSON still dies with not valid JSON:.
  • Running-claude check: both platform branches still set pids, so the single shared check after esac is safe under set -u. ((pgrep_rc > 1)) matches the old rc != 0 && rc != 1 refusal. The new code refuses when pids is non-empty, where the old code refused when pgrep exited 0. The two differ only if pgrep -x exits 0 with no output, which real pgrep doesn't do and the test stub (reset-refresh.test.sh:99-106) can't produce. The PR body already names this difference.
  • Journal-root test: [[ "$probe_real/" != "$plugins_real"/* ]] matches the same unquoted-glob pattern the old case arm did.
  • entry_count: called with no extra arguments, "${@:2}" expands to nothing, so the find | wc -l | tr pipelines are unchanged.
  • Backup-loop && forms: these are safe because the script doesn't use set -e.

Closing issue #14584, acceptance criteria:

  • Behavior unchanged: met, as above. reset-refresh.test.sh already asserts the refusal and preview text that changed, so a regression there would fail it.
  • The diff edits only the listed script and a changelog fragment: met.
  • Within 400 changed lines and 15 files: met.
  • harness-ops fragment with bump: patch, ### Changed and "Internal simplification, no behavior change.": met.
  • ci-status green: I can't check this from here. I didn't run the test suite, shellcheck or shfmt; the PR body says they weren't run either, and leaves them to the PR's CI.

No plugin manifest changed, there are no prior findings or settled threads to account for, and the PR context has no embedded instructions to report.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15035, simplify reset-refresh.sh error and refusal paths

No security issues found.

critical-findings: 0

Scope

I read every hunk of both changed files: plugins/harness-ops/skills/plugins/scripts/reset-refresh.sh and the changelog fragment .changes/harness-ops/work-resolve-issue-issue-14584-42781355617-1-009b2297.md. I also read the head script through line 240 to check set options and helper definitions. Neither file matches a trusted-path glob. The PR changes no trust control, no merge hold, no workflow, no plugin manifest and no instruction surface.

Do the refusal guards still behave the same?

This script runs locally, started by the operator, and moves ~/.claude/plugins content aside. Its safety guards are the refusals that run before anything moves. I checked each rewritten guard against its base form:

  • Shell options. The script uses set -uo pipefail with no -e (reset-refresh.sh:66). The new cond && refuse … and cond || die … lines therefore behave the same as the old if/exit 2 blocks. die and refuse exit 2 from the main shell, never from a subshell.
  • CLAUDE_CODE_REMOTE, clean's tty check, earlier backup. Each still refuses under the same condition with exit 2 (reset-refresh.sh:185-191).
  • Running-claude check. Both lookups now set pids, and a single check after the case refuses when it is non-empty (reset-refresh.sh:212). The tool-missing and tool-failed refusals still fail closed (reset-refresh.sh:197-209). With pgrep -x, exit 0 means a match was printed and exit 1 means no output, so the behavior is unchanged. pids is set on both paths, so set -u cannot trip.
  • Journal root inside plugins/. An unquoted right-hand side of != inside [[ ]] is matched as a glob, the same as the old case (reset-refresh.sh:220-221).
  • State-file validation. A missing user settings.json is still skipped. Any other missing or invalid file still exits 2 (reset-refresh.sh:127-134).
  • entry_count. It is called only with literal find tests. No outside input reaches it.

The PR description and the issue context contained no embedded instructions.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head e682e7211834b19f699532ae291322f38a7befc6. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head e682e7211834b19f699532ae291322f38a7befc6, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for e682e72

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15035-e682e7211834b19f699532ae291322f38a7befc6, expires on 2026-12-10.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit b009735 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14584-42781355617-1 branch November 10, 2026 09:32
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.

Simplify the reset-refresh.sh harness-ops plugin code

0 participants