Repository navigation
bot-pr-sweep: schedule the sweep in step 7, and reach repositories from the web - #52
Conversation
…om the web Step 7 agreed a cadence and then handed the user an invocation, so a sweep could look scheduled when nothing was: the report even printed the agreed cadence. Step 7 now asks where the schedule runs, creates the scheduled task on the user's yes where the host can, and otherwise ends by saying nothing runs until the user adds it; --schedule goes on a report only when the run came from a schedule. A run in Claude Code on the web met three more gaps: it reaches only the repositories attached to the session, and writes only where the Claude GitHub App is installed (assignments and merges came back 403); `gh repo list` needs GraphQL, which is refused there, so listing falls back to REST search; and with no repository named, it now offers the owners the account commits to, one question per owner. Questions go through the host's interactive question tool where it has one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw2MdKwYybyNY9rYwTk
yarikoptic-gitmate
left a comment
There was a problem hiding this comment.
Thanks @CodyCBakerPhD. Reviewed at c565f4b (a draft, so take this as early feedback). The direction is right: a step 7 that leaves nothing scheduled while the report prints a cadence is worth fixing, and the new "never" bullet and the narrowed --schedule rule do that. CI is green, ci/validate_skills.py reports no errors and the skill's 128 unit tests pass.
Inline, most important first:
- Cut the
search/commitsdiscovery. It stops silently at 1000 results, cannot seetotal_count, and part of it has no command behind it. Offering the attached repositories covers the case and drops anallowed-toolsentry. - Step 7's yes. One question bundles seven things, so consent to create the task is not distinct. The task should also outlast the session, have the skill, and not duplicate an existing one.
- Step 0 wording on
add_repoand the GitHub App. - Three smaller cuts and nits (the step 7 reach paragraph, the question-tool paragraph,
fork:false).
Outside the diff or too small for a thread:
- "Unattended" is never defined, and the new "never" bullet, step 6 and step 7 now depend on it (line 102 says "scheduled or headless", line 451 "already scheduled"). One sentence near line 151 would do: "A run is unattended when its invocation states a cadence or there is no user to ask."
scripts/pr_gate.py:930: the--schedulehelp still reads "the agreed cadence to state in the report", which is the behaviour this PR removes. Something like "the cadence of the schedule this run came from".- Line 15: "step 7 agrees the cadence with the user" could say that it also schedules it.
- Line 423: "never for a cadence step 7 has yet to put on a schedule" restates the "only when the invocation that started this run states one" just before it.
Fine as they are: the two search/repositories and gh repo list globs match the commands as written; the 0.6.0 → 0.7.0 bump is the right size (#51 moves that line, as the description says); the step cross-references are right; the README row needs no change. The file grows from 488 to 526 lines; the suggestions here take back roughly a dozen.
Not checked: creating a scheduled task for real, and the 403 on a repository without the App.
This review went through two independent reviewer passes (GitHub API and merge-automation safety; skill authoring and Claude Code host features), and both agreed with the points above.
Generated by Claude Code
Drop the search/commits discovery, which stops at 1000 results and cannot see its own total; offer the attached repositories instead. Search with fork:true, as `gh repo list` lists forks. Step 0 no longer reads as push access that is read-only, names an App installation limited to selected repositories, and attaches only in an attended run. Step 7 states the proposal and asks one question whose answers are schedule it, change something, or no schedule; it creates only a task that outlasts the session, has the skill, and is not a duplicate. Define an unattended run, trim the reach paragraph and the repeated --schedule clause, and update the --schedule help text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw2MdKwYybyNY9rYwTk
|
Thanks for the review. The four points from its summary are in 36cd52a:
The six inline suggestions are applied and their threads resolved; the PR description no longer mentions the commit-search discovery. Generated by Claude Code |
yarikoptic-gitmate
left a comment
There was a problem hiding this comment.
Re-reviewed 36cd52a. The six inline suggestions and the four summary points from the first round are applied as written, and CI is green.
One thing to fix before merge, and it came from my first review: the definition of "unattended" I proposed also catches an interactive run where the user states a cadence. That run would skip step 7 and still print a Schedule: line. Three small suggestions inline (lines 148, 421 and 451) correct it. It is a correctness problem, not a safety one: nothing merges or approves more than before.
Optional, take or leave:
- Lines 174-176: "attach each listed repository first in an attended run; the user approves it" can be misread. Clearer: "in an attended run, attach each listed repository before checking it (the host asks the user to approve)".
- Lines 493-494: when a task for this sweep already exists and differs from what was just agreed, the user may think the change was applied. "(name that one and say it was left unchanged)" covers it.
- Line 99: "(a scheduled or headless run)" can go now that the term is defined once.
What was checked this round, by two independent reviewer passes (GitHub API and merge-automation safety; skill authoring and Claude Code host features), which agreed on the above:
allowed-tools: everyghcommand in the text matches a glob and every glob is used; nothing ofsearch/commitsis left.fork:true, run fororg:con archived:false: 77 by default and withfork:false, 2 withfork:only, 79 withfork:true. So it returns forks and non-forks, asgh repo listdoes.- Scope of unattended runs: creating a schedule still needs the user's choice, is barred from unattended runs, and has no pre-approved tool, so the host prompts for it.
- Version and tests: 0.6.0 → 0.7.0 is still the right size;
ci/validate_skills.pyreports no errors and the skill's 128 unit tests pass.
Not checked: creating a scheduled task for real, and the 403 on a repository without the App.
Leaving this as a comment, not an approval; merging is for a maintainer to decide.
Generated by Claude Code
The definition added in the last round also caught a present user who asks for a cadence: that run skipped step 7 and printed a Schedule line, the false claim this change removes. A run is now unattended when a schedule started it or there is no user to ask; a cadence stated by a present user is a request for step 7. --schedule goes on a report only in an unattended run whose invocation carries it, and step 7's skip sentence no longer claims every unattended run was scheduled. Also from the second review: step 0 says the host asks the user to approve an attach, step 7 says an existing task was left unchanged, and the Inputs drop the "(a scheduled or headless run)" aside now that the term is defined. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw2MdKwYybyNY9rYwTk
|
The three corrections for "unattended" are in da286ea, and so are the three optional ones:
Generated by Claude Code |
yarikoptic-gitmate
left a comment
There was a problem hiding this comment.
Re-reviewed da286ea. The three corrections for "unattended" and the three optional points are applied as written, and CI is green. Nothing blocking.
Two small things worth fixing are inline, each with a suggestion:
- "Unattended" and "no user to ask" are two terms for one state, and the file does not say so (line 148).
- An existing scheduled task is left unchanged even after the user agrees a different cadence (lines 474 and 490).
Optional, take or leave:
- Live or dry. Line 147 ends a dry attended run with step 7 too, and the proposal at lines 461-464 does not say whether the scheduled runs are live. Adding "whether the runs are live or dry," to that list covers it. Only one of the two reviewer passes raised this.
- Two cuts. Lines 487-488 ("To approve unattended, add…") repeat lines 104-105 and 466. Lines 470-472 ("An unattended run cannot ask, so…") repeat lines 99-100 and 103.
What was checked this round, by two independent reviewer passes (skill authoring and merge-automation safety; GitHub API and Claude Code host features):
- Five scenarios walked through the text: a present user with and without a stated cadence, a scheduled run with and without
--schedulein its prompt, and a headless one-off run. In none does the report claim a schedule that does not exist, and nothing is merged, approved or scheduled without the user's choice. pr_gate.py: the--schedulehelp and the report's Schedule line agree with step 6.allowed-tools: no contradiction; the attach, question and scheduling tools are not listed, so the host prompts for each.- Tests:
ci/validate_skills.pyreports 0 errors for 25 skills, and the skill's 128 unit tests pass.
Not checked: creating a scheduled task for real, and the 403 on a repository without the App.
Leaving this as a comment, not an approval; merging is for a maintainer to decide.
Generated by Claude Code
… to "no user to ask" Step 7 left an existing task unchanged after the user agreed a new cadence, so agreeing "hourly" could keep a daily task. It now names the existing task before the question and changes that one on the user's choice. "Unattended" and "no user to ask" are now one state, so a scheduled run does not wait on a question tool for `major` or approvals. Also from the third review: the proposal says whether the runs are live or dry, two sentences that repeated the Inputs are cut, and the last line of step 7 is rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw2MdKwYybyNY9rYwTk
|
The three inline suggestions are in e8ab833, and so are the optional points:
Generated by Claude Code |
yarikoptic-gitmate
left a comment
There was a problem hiding this comment.
Re-reviewed e8ab833. The three inline suggestions and the optional points are applied as written, and CI is green. Nothing blocking.
One small thing worth fixing, inline with a suggestion: when a scheduled task already exists and the user declines, the text does not say that the task stays as it is (lines 492-493).
Optional, take or leave; only one of the two reviewer passes raised it:
- Lines 422-423: "whose invocation carries it" can be read as "carries a cadence". A headless
claude -p "run bot-pr-sweep on acme/widgets daily"is unattended and skips step 7, so an agent that passes--schedule "daily"toreportprints aSchedule:line for a schedule that does not exist. "whose invocation carries the--scheduleflag itself" closes that reading. This wording predates the commit.
What was checked this round, by two independent reviewer passes (skill authoring and merge-automation safety; GitHub API and Claude Code host features):
- The two cuts are true duplicates: the
majorand approval behaviour of an unattended run is still at lines 99-100, 103 and 359-361, and--approve-mode autoat lines 104-105 and 466-469. - Changing an existing task happens only after the user's choice in step 7: line 452 skips the step in an unattended run, lines 46-47 forbid creating or changing a schedule without a yes, and
allowed-toolslists no scheduling tool, so the host prompts. - Live or dry: the skill's
--dry-runwording gives the written invocation a way to say it. --schedule: step 6, thepr_gate.pyhelp and the report's Schedule line agree with the reworded definition.- No stale text: nothing still says an existing task is left unchanged.
- Tests:
ci/validate_skills.pyreports 0 errors for 25 skills, and the skill's 128 unit tests pass. 0.7.0 is still the right version.
Not checked: creating or changing a scheduled task for real, and the 403 on a repository without the App.
Leaving this as a comment, not an approval; merging is for a maintainer to decide.
Generated by Claude Code
With an existing task, step 7's question is whether to change it, so a "no schedule" answer now ends by saying that task stays as it is rather than suggesting nothing is scheduled. Step 6 also makes plain that --schedule goes on a report only when the invocation carries that flag, not merely a cadence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw2MdKwYybyNY9rYwTk
|
The inline suggestion is in 961498a. So is the optional point on lines 422-423: step 6 now reads "only in an unattended run whose invocation carries the
Generated by Claude Code |
yarikoptic-gitmate
left a comment
There was a problem hiding this comment.
Re-reviewed 961498a. Both changes are applied as suggested, CI is green, and all threads are resolved. Nothing further from this review.
What was checked this round, by two independent reviewer passes (skill authoring and merge-automation safety; GitHub API and Claude Code host features), which both came back with nothing to fix:
- Step 6 and step 7 agree. The invocation step 7 writes (lines 481-483) ends with
Report with --schedule "…", so a scheduled run carries the flag itself and prints the Schedule line, while a headless run that only names a cadence does not. - Five scenarios walked through the text: a present user with and without a stated cadence, a scheduled run from step 7's invocation, a headless one-off run naming a cadence, and a present user who declines while a task exists. In none does the report claim a schedule that does not exist, and nothing is created, changed or left running contrary to what the user is told.
pr_gate.pyprints- Schedule:only when--scheduleis non-empty, and its help text matches step 6.- Nothing stale, and no line past 79 characters from step 6 on.
- Tests:
ci/validate_skills.pyreports 0 errors for 25 skills, and the skill's 128 unit tests pass.
Not checked: creating or changing a scheduled task for real, and the 403 on a repository without the App.
Leaving this as a comment, not an approval; merging is for a maintainer to decide.
Generated by Claude Code
|
This is a relatively minimal 'fix' for a silly case where it asks for the desired schedule was documented but not put into effect - so I will just merge Increasingly I do think maybe 'AI' is not the right 'UI' for this operation, and con/spectus would be the better deterministic/configurable implementation Fun to experiment though |
Resolve bot-pr-sweep's version conflict: #52 bumped it to 0.7.0 in the SKILL.md frontmatter; here the version lives only in apm.yml, so it moves there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw79etX6u2VyPivrDeu
Fixes what a live run of the skill in Claude Code on the web got wrong.
--schedulegoes on a report only when the run came from a schedule. "Never says a sweep is scheduled when no schedule exists" joins the list of things the sweep never does.Resource not accessible by integration. Step 0 now says to attach each repository and to warn up front when writes will be refused; step 7 checks that the place a schedule runs can reach and write to every listed repository.gh repo listneeds GraphQL, which web sessions refuse; listing now falls back to REST search. With no repository named, the sweep asks, offering the repositories attached to the session.AskUserQuestion) where it has one.Version 0.6.0 → 0.7.0 (changed steps).
tox -e validate,apm,security-static,security-depspasses; the scanner's findings for this skill matchmaster's. #51 moves theversionfield intoapm.yml, so whichever merges second resolves that one line.Generated by Claude Code