Skip to content

fix(harness): auto-assign new bot PRs to the repo owner (closes #33) - #34

Merged
robercano-ghbot merged 1 commit into
mainfrom
feat/issue-33-auto-assign-pr-owner
Jul 3, 2026
Merged

fix(harness): auto-assign new bot PRs to the repo owner (closes #33)#34
robercano-ghbot merged 1 commit into
mainfrom
feat/issue-33-auto-assign-pr-owner

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

What & why

Bot-authored PRs created via .claude/scripts/bot-gh.sh pr create arrived with no assignee, so the repo owner got no GitHub notification that a PR was waiting for review — the autonomous loop then stalled on "no-owner-review" until the owner happened to look. This folds in a fix already applied downstream in robercano/reDeploy.

Change

.claude/scripts/bot-gh.sh now auto-assigns every newly created PR to the repo owner:

  • Fires only for the pr create subcommand, and only when the caller didn't already pass an assignee (handles --assignee, --assignee=, and the short -a form).
  • Owner is resolved dynamically (never hardcoded) with this precedence: $OWNER_LOGIN env override → the --repo/-R target owner (so cross-repo pr create assigns the right account) → the local origin remote (offline, git@/https forms) → gh repo view as a last resort.
  • Fail-soft: if the owner can't be resolved, the PR is still created (just unassigned) rather than erroring.
  • Preserves existing behavior: the --repo collaborator preflight, set -euo pipefail, and the bot-token exec. The empty-arg edge case is guarded (${args[@]+"${args[@]}"}) so it stays safe on bash 3.2+.

docs/USAGE.md documents the behavior and the OWNER_LOGIN override in "The PR feedback loop" step 3.

Validation

bash -n clean. Reviewed adversarially across four lenses (correctness, tests, security, performance) — all approve. Owner-parse and subcommand-detection exercised via a dry-run matrix (pr create auto-assigns; -a/--assignee/--assignee= respected; --repo/-R owner precedence; OWNER_LOGIN override; other subcommands and zero-arg invocations pass through untouched).

Known low-severity limitations (outside the documented owner/repo path, non-blocking): gh's non-OWNER/REPO --repo forms (HOST/OWNER/REPO, full URLs) and attached short-flag syntax (-Rvalue, -avalue) are not specially parsed.

Closes #33

🤖 Generated with Claude Code

https://claude.ai/code/session_01BLTWAXsWFRtN6c1u8aKnP2

Detects -a as well as --assignee/--assignee=* so callers passing a
short-form assignee aren't overridden. Guards the exec against an
unbound-variable error on bash < 4.4 when no args remain. Resolves the
owner from the --repo/-R target (when given) ahead of the local origin
remote, so cross-repo `pr create --repo other/acct` assigns the other
repo's owner instead of the local repo's.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BLTWAXsWFRtN6c1u8aKnP2
@robercano-ghbot
robercano-ghbot merged commit 19e245a into main Jul 3, 2026
6 checks passed
@robercano-ghbot
robercano-ghbot deleted the feat/issue-33-auto-assign-pr-owner branch July 3, 2026 08:28
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.

bot-gh.sh: auto-assign new PRs to the repo owner so they get review notifications

2 participants