Skip to content

bot-pr-sweep: schedule the sweep in step 7, and reach repositories from the web - #52

Merged
CodyCBakerPhD merged 5 commits into
masterfrom
claude/fervent-hopper-xaoxk7
Nov 20, 2026
Merged

CodyCBakerPhD merged 5 commits into
masterfrom
claude/fervent-hopper-xaoxk7

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes what a live run of the skill in Claude Code on the web got wrong.

  • Step 7 left nothing scheduled. It agreed a cadence, handed over an invocation, and ended; the user reasonably took the sweep as scheduled, and the report even printed the agreed cadence. Step 7 now states the whole proposal, including where the schedule runs, and asks one question (schedule it, change something, or no schedule). On "schedule it" it creates a scheduled task that outlasts the session, has the skill and reaches the repositories, unless one already exists; otherwise it ends by saying plainly that nothing runs until the user adds it. --schedule goes 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.
  • Reach from a web session. A session reaches only the repositories attached to it, and writes only where the Claude GitHub App is installed: assignments and merges on an attached repository without the App came back 403 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.
  • Listing repositories. gh repo list needs 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.
  • Questions go through the host's interactive question tool (AskUserQuestion) where it has one.

Version 0.6.0 → 0.7.0 (changed steps). tox -e validate,apm,security-static,security-deps passes; the scanner's findings for this skill match master's. #51 moves the version field into apm.yml, so whichever merges second resolves that one line.


Generated by Claude Code

…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 yarikoptic-gitmate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/commits discovery. It stops silently at 1000 results, cannot see total_count, and part of it has no command behind it. Offering the attached repositories covers the case and drops an allowed-tools entry.
  • 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_repo and 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 --schedule help 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

Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
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

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The four points from its summary are in 36cd52a:

  • "Unattended" is defined once, at the end of the Procedure intro: a run is unattended when its invocation states a cadence or there is no user to ask.
  • pr_gate.py's --schedule help now reads "the cadence of the schedule this run came from".
  • Line 15 says step 7 also schedules the sweep.
  • Step 6 drops the clause that repeated "only when the invocation that started this run states one".

The six inline suggestions are applied and their threads resolved; the PR description no longer mentions the commit-search discovery. tox -e validate,security-static passes, and the scanner's findings for this skill still match master's.


Generated by Claude Code

@CodyCBakerPhD CodyCBakerPhD self-assigned this Nov 20, 2026
@CodyCBakerPhD
CodyCBakerPhD marked this pull request as ready for review November 20, 2026 03:53

@yarikoptic-gitmate yarikoptic-gitmate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: every gh command in the text matches a glob and every glob is used; nothing of search/commits is left.
  • fork:true, run for org:con archived:false: 77 by default and with fork:false, 2 with fork:only, 79 with fork:true. So it returns forks and non-forks, as gh repo list does.
  • 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.py reports 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

Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
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

Copy link
Copy Markdown
Contributor Author

The three corrections for "unattended" are in da286ea, and so are the three optional ones:

  • Step 0 now reads "in an attended run, attach each listed repository before checking it (the host asks the user to approve)".
  • Step 7 says "(name that one and say it was left unchanged)" when a task for this sweep already exists.
  • The Inputs drop "(a scheduled or headless run)".

tox -e validate,security-static passes, with all 128 unit tests.


Generated by Claude Code

@yarikoptic-gitmate yarikoptic-gitmate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --schedule in 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 --schedule help 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.py reports 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

Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
Comment thread skills/bot-pr-sweep/SKILL.md Resolved
… 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

Copy link
Copy Markdown
Contributor Author

The three inline suggestions are in e8ab833, and so are the optional points:

  • The proposal in step 7 now lists "whether the runs are live or dry".
  • Both cuts are taken: "To approve unattended, add …" and "An unattended run cannot ask, so …" are gone from step 7, since the Inputs already say both.

tox -e validate,security-static passes, with all 128 unit tests. SKILL.md is now 522 lines.


Generated by Claude Code

@yarikoptic-gitmate yarikoptic-gitmate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" to report prints a Schedule: line for a schedule that does not exist. "whose invocation carries the --schedule flag 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 major and approval behaviour of an unattended run is still at lines 99-100, 103 and 359-361, and --approve-mode auto at 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-tools lists no scheduling tool, so the host prompts.
  • Live or dry: the skill's --dry-run wording gives the written invocation a way to say it.
  • --schedule: step 6, the pr_gate.py help 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.py reports 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

Comment thread skills/bot-pr-sweep/SKILL.md Resolved
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

Copy link
Copy Markdown
Contributor Author

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 --schedule flag itself", so a headless run that only names a cadence prints no Schedule line.

tox -e validate,security-static passes, with all 128 unit tests.


Generated by Claude Code

@yarikoptic-gitmate yarikoptic-gitmate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py prints - Schedule: only when --schedule is 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.py reports 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

@CodyCBakerPhD

CodyCBakerPhD commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

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

@CodyCBakerPhD
CodyCBakerPhD merged commit 5f71c27 into master Nov 20, 2026
4 checks passed
CodyCBakerPhD pushed a commit that referenced this pull request Nov 20, 2026
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
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.

3 participants