Skip to content

fix(source-control): arm the PR monitor poll script in auto mode by dropping its rm - #16206

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-16201-43624455138-1
Nov 14, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #16201

Summary

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

The pull-request monitor's poll script (monitor.md, "Poll checks over REST") no longer uses a mktemp stderr file and its trap 'rm -f "$err"' EXIT, the removal auto mode's safety check denied. A small read_into function now runs each read, leaves its stdout in out and appends its stderr to an errs shell variable. The per-poll rate-limit check reads that variable (still printing RATE-LIMITED — watch stopped: ... and exiting 2), and the variable is reset after each poll. The script now holds no rm, mktemp or trap. I dropped the signal trap because it existed only to run the EXIT trap under zsh, and with no trap both bash and zsh die on TERM. Design choice and basis: the capture puts the command's stderr first and then a \037 marker, the status and stdout in one command substitution. This keeps stdout and stderr apart without a temp file, using only parameter expansions that behave the same in bash and zsh. Merging the two streams with 2>&1 would have let stray stderr corrupt the check and threads reads. Baseline, snapshot, failed-read and REVIEW-THREADS behavior is unchanged.

Not verified

  • bash plugins/source-control/scripts/monitor-poll.test.sh and plugins/source-control/skills/pull-request/scripts/monitor-poll.test.sh were not executed: this lane's Bash runs only the named wrappers, so both suites are left to the PR's CI. That includes the new zsh cases, which run only where zsh is…
  • Not checked live: whether the new inline script now arms in an auto-mode Claude Code session. The fix removes the only rm the denial named, but no auto-mode Monitor call was made from this lane.
  • tidy: passes 1-4 ran, with one wording edit each in monitor.md and in the changelog fragment and no code-comment deletions. Pass 5 (/ai-slop:audit fix) was skipped because its detect.sh and digest-guard.sh scripts are not runnable under this lane's Bash allowlist. A manual read of the changed prose…
  • Untracked files present in the checkout that this run did not create or touch: .bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc (they look like sandbox mount points). They are not part of this change and should be kept out of the patch.

Fix

  • plugins/source-control/reference/providers/github/pull-request/monitor.md: the poll script replaces the mktemp file, rm trap and signal trap with errs plus a read_into helper used by every gh read and the review-threads read. The rate-limit check greps errs and then resets it. The prose after…
  • plugins/source-control/scripts/monitor-poll.test.sh: the temp-file assertions are replaced. New cases: a rate limit on a comment read (proves stderr from every read reaches errs); FX1 and the comment rate-limit case run again under zsh -f when zsh is installed; grep checks that the raw…
  • .changes/source-control/work-resolve-issue-issue-16201-43624455138-1-6d49052e.md: patch changelog fragment (Fixed) for source-control.

Verification

The runner ran each check from the base copy against 9ca0ddb:

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

The run reports:

  • check-changelog-fragments: all 7 fragments under .changes/ valid
  • check-changed-skills: no changed skills under plugins/*/skills/, nothing to gate
  • check-affected: 15 passed, 6 skipped (ruff: no .py; typos: not installed; three validate-plugins sub-checks that run code from the checked tree; changed-skills: no skill file) over 3 changed files
  • cant-fail-scan --file plugins/source-control/scripts/monitor-poll.test.sh --check: PASS, no gating findings, 1 test file fully read
  • Fresh-context review subagent over the whole diff: no correctness bug in read_into or its call sites under bash or zsh. Its four test findings were fixed: a duplicate case dropped, zsh runs added, the sleep race replaced with a marker file, the rm grep moved to the unsubstituted block.
  • Grep of plugins/source-control for rm -f "$err" and the old $err file: only the changelog history mentions it now; no reference or skill file tells a session to arm a script with that rm
  • Read plugins/source-control/skills/pull-request/scripts/monitor-poll.test.sh, which extracts the same block: it does not depend on the removed temp file or traps
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43624455138

Left out: the items under Not verified.

Related

#16201

Lane-Activity: work-resolve-issue/resolve-issue
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 9ca0ddb80d2031d120173de4f486ad8009163c0d. 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)

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #16206 (head 9ca0ddb)

I found no security issues in this pull request.

I read every hunk of all 3 changed files: the changelog fragment, plugins/source-control/reference/providers/github/pull-request/monitor.md and plugins/source-control/scripts/monitor-poll.test.sh. None of them is under a trusted path. None is a plugin manifest, a trust control or a merge hold.

What I checked:

  • The new read_into helper (monitor.md). It runs its arguments as "$@", with no eval and no unquoted interpolation, so it adds no command-injection surface. It splits the output on the first \037 byte. Stderr is captured ahead of that byte, so attacker text can reach the split only through stdout: GitHub comment, review and inline bodies the poll prints. Because stdout comes after the first marker, a \037 inside a comment body cannot move the split point or forge the status. The parts the script uses (the status, out and errs) are only compared, grepped or printed. None of them is executed.
  • The rate-limit stop. It now runs grep over errs, which every read appends to, so it still fails closed. The new test case covers a rate limit on a comment read.
  • Dropping rm, mktemp and the traps. The script now writes no temp file. It makes the script pass auto mode's safety check by deleting the step that check objected to, not by hiding it. It does not weaken a guard.
  • Untrusted text. Comment and review bodies still reach the Monitor's output cut to 80 characters, as they did before. This pull request does not widen that.
  • Instruction surface. The prose change in monitor.md only describes the new helper. It removes no standing rule.

Spend: none. This is a docs and test change, so it bills nothing.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 9ca0ddb80d2031d120173de4f486ad8009163c0d: read 3 of 3 changed file(s); 1 finding(s), 0 as inline comments.

Code review: PR #16206

Scope. I read all three changed files in full: the changelog fragment, the provider monitor.md poll script and scripts/monitor-poll.test.sh. I also read the whole poll script at head, the test file at head, the sibling suite skills/pull-request/scripts/monitor-poll.test.sh (it doesn't depend on the removed temp file or traps) and the skill's reference/monitor.md pointer to this block. This is a first review, not blocking-only. There are no settled threads and no prior findings.

Correctness of read_into.

  • all=$( { out=$("$@"); printf '\037%s:%s' "$?" "$out"; } 2>&1 ) keeps the command's stdout inside the inner substitution. Its stderr goes to the outer capture before the marker, and $? is the status of the assignment's command substitution. Bash and zsh both behave this way.
  • The split works correctly:
    • ${all%%$'\037'*} (stderr) and ${all#*$'\037'} cut at the first marker.
    • ${rest#*:} and ${rest%%:*} cut at the first colon after the numeric status, so a colon in stdout is safe.
  • Trailing-newline stripping is the same as the old out=$(…) reads.
  • Every former 2>>"$err" call site now goes through read_into, and no $err reference is left in the block.
  • errs is reset at the same point where the old code truncated the file.
  • The state check's own 2>&1 rate-limit path is unchanged.

Closing issue #16201.

  • Met: the issue asks to "keep the gh stderr in a shell variable instead of a temp file, so the script has no rm". The block now has no rm, mktemp or trap, and the new raw-block grep asserts both.
  • Met: the stderr rate-limit stop still works. FX4 (the check read) and the new FX6 (a comment read) cover it, and FX6 also runs under zsh.
  • Unchanged: the snapshot re-arm and the review-thread read (read_into on the threads script).
  • Not verifiable by any test: whether an auto-mode Monitor call now arms. The PR lists this as not verified.

Tests. The PR says both suites were left to CI, and I couldn't run them either (no shell). I checked their logic by reading only:

  • The FX6 and zsh reruns reset the poll counters correctly.
  • The "poll 1 ran clean" check on the slow-watch run is expected to pass: poll 0 prints no REVIEW-THREADS line ([ "$poll" -gt 0 ]), and the first good checks read only records the baseline.

Finding (advisory, in summary only):

  • Pre-existing (advisory): plugins/source-control/skills/pull-request/reference/monitor.md#L288-L290 says the poll script's state check and CI block "run standalone with OWNER, REPO, and PR_NUMBER set". After this PR, the CI block calls read_into. The PR updates the matching sentence in the provider doc (reference/providers/github/pull-request/monitor.md#L210-L211) to require read_into defined, but not this one. Anyone who follows the skill's sentence alone gets read_into: command not found. That leaves checks_ok=0 on every read, with no visible error. This predates the change: on base, the same sentence left out err, and 2>>"" failed the reads the same way. Suggested fix: add "and read_into defined" to that sentence.

Manifests. None changed. The changelog fragment's bump: patch fits a bug fix.

Embedded text. The PR body has no instructions aimed at this review.

Verifier dropped 0 of 1 candidates.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9ca0ddb

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-16206-9ca0ddb80d2031d120173de4f486ad8009163c0d, expires on 2026-12-14.

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=9ca0ddb80d2031d120173de4f486ad8009163c0d rubric=9.1.0 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 403a4e9 Nov 14, 2026
51 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-16201-43624455138-1 branch November 14, 2026 18:38
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.

pull-request monitor's poll script cannot be armed in auto mode: its rm -f trap is denied

0 participants