You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pull-request monitor's poll script cannot be armed in auto mode: its rm -f trap is denied #16201
In a Claude Code session in auto mode (2.1.325, source-control plugin 11.10.0), run /source-control:pull-request monitor <n> -R <owner/repo>.
Follow reference/monitor.md §3.0.1 and arm the Monitor tool with the poll script from reference/providers/github/pull-request/monitor.md "Poll checks over REST", passed inline in command with the placeholders filled in.
Expected behavior
The watch arms and reports check completions, comments and review-thread changes.
Actual behavior
The Monitor call is denied before it runs:
Permission for this command was denied by a built-in Claude Code safety check, not by the user. The check stops removals that can delete far more than intended [...] What was flagged: This command passes a shell -c script that runs rm, and Claude Code could not check the script for dangerous removals.
The script's only removal is its temp-file cleanup:
err=$(mktemp)# stderr of every later gh call, checked for a rate limit each polltrap'rm -f "$err"' EXIT # every exit removes it
The denial text says not to reshape or re-issue the removal, so the session cannot arm the documented script at all. In the session that found this, the agent wrote a smaller watch with no temp file (stderr discarded, no rate-limit read from stderr, no review-thread count) for each of five pull requests. That loses the script's snapshot re-arm, its review-thread read and its stderr rate-limit stop.
Severity
medium
Severity justification
Every auto-mode session that monitors a pull request through this skill either cannot arm the watch or hand-writes a weaker one.
Suggested fix location
plugins/source-control/reference/providers/github/pull-request/monitor.md, "Poll checks over REST": keep the gh stderr in a shell variable instead of a temp file, so the script has no rm.
Environment
Claude Code 2.1.325, WSL2 Linux, zsh, auto mode. UNVERIFIED whether the same denial occurs when the script is saved as a bundled file and run by path instead of passed inline.
Size: Small
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
I understand the "Poll checks over REST" script in the pull-request monitor reference creates a temp file and removes it in an EXIT trap. Auto mode's removal safety check denies the script, so the watch cannot be armed as documented. The suggested fix is to hold gh stderr in a shell variable so the script has no rm. The refinement comment above already lists the acceptance criteria. It also covers the poll test script, which asserts on the temp file today.
I found no open duplicate and no merged pull request that already fixes this. Related merged work to preserve is the rate-limit stop, the baseline kept on a failed read, and the snapshot re-arm.
Still unverified, as you noted: whether the denial also applies to a script saved as a file and run by path. That does not block the change.
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).
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: The "Poll checks over REST" script in monitor.md holds gh stderr in a shell variable instead of a mktemp file, so it contains no rm and still reads rate limits, snapshots and review threads.
Acceptance criteria
The fenced bash block under '## Poll checks over REST' in plugins/source-control/reference/providers/github/pull-request/monitor.md contains no rm, mktemp or trap ... rm (grep for \brm\b and mktemp in that block prints nothing).
The block keeps a signal trap (trap 'exit 143' INT TERM HUP) or drops it only if nothing else needs it, and still exits 0 on a merged or closed PR and 2 on a rate limit.
gh stderr from every poll call (workflow runs, check-runs, status, issue comments, inline comments, reviews, review-threads script) is accumulated in a shell variable, and the per-poll rate-limit check (rate limit|HTTP 429) reads that variable and prints RATE-LIMITED — watch stopped: ... then exits 2.
The stderr variable is reset after each poll, replacing the : >"$err" truncation, so a past rate-limit line is not matched on later polls.
The check-baseline, snapshot (SNAPSHOT_FILE/BASELINE_FILE) and failed-read-keeps-baseline behaviors are unchanged, and the REVIEW-THREADS unresolved= emission every 4th poll still works.
The prose after the block (monitor.md around line 197) that says the CI block runs standalone with err set is updated to describe the new stderr variable instead of a file.
plugins/source-control/scripts/monitor-poll.test.sh is updated: temp-file assertions (POLL_TMP empty, 'its temp file exists while it runs', 'its temp file is removed', 'leaves no temp file behind') are replaced by a check that the extracted script contains no rm or mktemp, and bash plugins/source-control/scripts/monitor-poll.test.sh passes, including the rate-limit and transient-failure cases.
No other file in plugins/source-control tells a session to arm a poll script that contains rm (grep of reference/ and skills/ for rm -f "$err" prints nothing).
plugins/source-control/reference/providers/github/pull-request/monitor.md:75: err=$\(mktemp\) and trap 'rm -f "$err"' EXIT are the script's only removal, as the issue says
plugins/source-control/reference/providers/github/pull-request/monitor.md:108: stderr of gh calls goes to the file with 2>>"$err" at lines 108, 113, 115, 155, 159, 167 and 177
plugins/source-control/reference/providers/github/pull-request/monitor.md:185: the rate-limit check greps the file, and line 189 truncates it with : >"$err"
plugins/source-control/reference/providers/github/pull-request/monitor.md:197: the standalone use of the CI block says err must be set
plugins/source-control/scripts/monitor-poll.test.sh:40: the test extracts the doc's block and runs it against a stub gh, so it covers the change
plugins/source-control/scripts/monitor-poll.test.sh:166: temp-file cleanup assertions at lines 166-199 must change with the script
Automated refinement by the lanes App. Intake triages the issue again with it.
Activity
github-actions commentedon Nov 14, 2026
Size: Small
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
I understand the "Poll checks over REST" script in the pull-request monitor reference creates a temp file and removes it in an EXIT trap. Auto mode's removal safety check denies the script, so the watch cannot be armed as documented. The suggested fix is to hold gh stderr in a shell variable so the script has no
rm. The refinement comment above already lists the acceptance criteria. It also covers the poll test script, which asserts on the temp file today.I found no open duplicate and no merged pull request that already fixes this. Related merged work to preserve is the rate-limit stop, the baseline kept on a failed read, and the snapshot re-arm.
Still unverified, as you noted: whether the denial also applies to a script saved as a file and run by path. That does not block the change.
Automated triage. A maintainer reviews it.
melodic-automation-lanes commentedon Nov 14, 2026
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed
- [ ]criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).melodic-automation-lanes commentedon Nov 14, 2026
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: The "Poll checks over REST" script in monitor.md holds gh stderr in a shell variable instead of a mktemp file, so it contains no rm and still reads rate limits, snapshots and review threads.
Acceptance criteria
rm,mktemportrap ... rm(grep for\brm\bandmktempin that block prints nothing).trap 'exit 143' INT TERM HUP) or drops it only if nothing else needs it, and still exits 0 on a merged or closed PR and 2 on a rate limit.rate limit|HTTP 429) reads that variable and printsRATE-LIMITED — watch stopped: ...then exits 2.: >"$err"truncation, so a past rate-limit line is not matched on later polls.errset is updated to describe the new stderr variable instead of a file.rmormktemp, andbash plugins/source-control/scripts/monitor-poll.test.shpasses, including the rate-limit and transient-failure cases.rm(grep of reference/ and skills/ forrm -f "$err"prints nothing).External state: none
Related work
Sources read
err=$\(mktemp\)andtrap 'rm -f "$err"' EXITare the script's only removal, as the issue says2>>"$err"at lines 108, 113, 115, 155, 159, 167 and 177: >"$err"errmust be setAutomated refinement by the lanes App. Intake triages the issue again with it.
melodic-automation-lanes commentedon Nov 14, 2026
{"v":1,"actor_id":337595936,"title_sha256":"01a1af507083cc82cb00c3219a142a8c55c4e44bd33f20cb6ae7903b72190038","body_sha256":"638165843200958b01effd476299ebea432078eef778319b3f07f1c78922ba3f"}
github-actions commentedon Nov 14, 2026