Skip to content

fix(skill): add pre-commit and duplicate-PR checks to running-in-ci - #1443

Merged
max-sixty merged 3 commits into
mainfrom
hourly/review-22949401504
Mar 11, 2026
Merged

max-sixty merged 3 commits into
mainfrom
hourly/review-22949401504

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Add "Before creating a PR" guidance: check for existing PRs and fix branches before creating duplicates
  • Add "Before committing code changes" guidance: run cargo fmt (minimum) or full pre-merge before committing

Evidence

In run 22946109451 (claude-mention on issue #1415), the bot:

  1. Created a duplicate PR. PR fix: exclude remote-only branches from switch tab completions #1416 (created 2026-03-10) already addressed the same issue — excluding remote branches from switch completions. The bot created fix(completion): exclude remote branches when total exceeds 100 #1442 with a different approach without checking for existing work. Both PRs are authored by worktrunk-bot. The session log shows the bot went directly from reading the issue to editing code — no gh pr list or branch check.

  2. Skipped cargo fmt before committing. The bot ran cargo check to verify compilation but not cargo fmt. CI failed on the pre-commit hook's format check, requiring a second "style: rustfmt" commit and another full CI polling cycle (~11 minutes of additional sleep 60 polls).

Session log: tool call sequence (run 22946109451)
Skill: running-in-ci
Bash: gh issue view 1415 ...
Read: src/completion.rs
Edit: src/completion.rs          ← code change
Grep: complete_branches          ← searched for tests, found none
Bash: cargo check                ← compilation only, no fmt
Bash: git checkout -b ...
Bash: git add && git commit      ← committed unformatted code
Bash: git push && gh pr create   ← created PR #1442 (duplicate of #1416)
... 11 CI poll cycles ...
Bash: gh run view --log-failed   ← discovered fmt failure
Bash: cargo fmt                  ← fixed formatting
Bash: git add && git commit      ← second commit
... 11 more CI poll cycles ...

Root cause

The running-in-ci skill (loaded by all CI workflows) had no guidance on either checking for existing PRs or formatting code before committing. The triage-issue skill already had both — Step 3 ("Check for duplicates") and Step 6.3 (cargo run -- hook pre-merge --yes) — but this guidance didn't extend to the claude-mention workflow.

Test plan

  • Verify the skill file renders correctly
  • Observe future claude-mention runs for improved behavior (check for existing PRs, run cargo fmt)

🤖 Generated with Claude Code

The claude-mention bot created a duplicate PR (#1442) when #1416 already
addressed the same issue, and shipped code without running cargo fmt —
causing a CI failure and requiring a second commit. Both gaps exist because
running-in-ci (loaded by all CI workflows) had no guidance on checking for
existing PRs or formatting code before committing. The triage-issue skill
had these checks but running-in-ci did not.

Add two subsections under "PR Creation":
- "Before creating a PR" — check open PRs and fix branches first
- "Before committing code changes" — run cargo fmt at minimum

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@worktrunk-bot worktrunk-bot added the claude-behavior Issues with Claude CI bot behavior label Mar 11, 2026
Comment thread .claude/skills/running-in-ci/SKILL.md Outdated

### Before committing code changes

Always run `cargo fmt` before committing Rust code changes. Ideally run the full

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

let's remove this part, and instead have this as guidance to run pre-commit in CLAUDE.md

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done — removed the section from the skill file and added pre-commit run --all-files guidance to CLAUDE.md under Quick Start instead.

Remove the "Before committing code changes" section from
running-in-ci skill and add pre-commit guidance to CLAUDE.md
instead, per review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread CLAUDE.md Outdated

For Claude Code web environments, run `task setup-web` first. See [Testing](#testing) for more commands.

**Before committing code changes**, always run `pre-commit run --all-files` to catch formatting and lint issues locally. This prevents CI failures that waste a round trip.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this is too high up. let's remove and see if it's a persistent problem

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed — let's see if it recurs.

Per review feedback — remove the pre-commit line from Quick Start
and see if formatting issues recur before adding targeted guidance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@max-sixty
max-sixty enabled auto-merge (squash) March 11, 2026 18:20
@max-sixty
max-sixty merged commit bb9c304 into main Mar 11, 2026
25 checks passed
@max-sixty
max-sixty deleted the hourly/review-22949401504 branch March 11, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Issues with Claude CI bot behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants