Skip to content

fix(alpha): scan agent PR drafts by target repo visibility - #341

Open
tbhb-agent wants to merge 1 commit into
mainfrom
agent/tools-draft-visibility
Open

tbhb-agent wants to merge 1 commit into
mainfrom
agent/tools-draft-visibility

Conversation

@tbhb-agent

Copy link
Copy Markdown
Collaborator

Why

The driver's draft scan refused drafts that tbhbdev alpha pr check accepted, which ended runs with status 5 and sent owners to open pull requests by hand. For a private repository, pr check skips the host-name rules and the driver applied them.

Behavior change

Before the driver scans the draft, it reads the visibility of the repository the PR opens in, using the run's push token. A PRIVATE answer skips the name rules, as pr check does. Any other answer applies them, including an unreadable repository, a failed request, a non-JSON reply, and an unexpected value. A failed read scans as a public repository. Secret rules apply in every case.

Risk

The driver makes one extra GitHub read per pull request. If the token can't read the repository, the scan runs as for a public repository, which matches the previous behavior.

Verification

tests/test_alpha_agent_open_pr.py passes 54 tests with 100% line and branch coverage for open_pr.py, and ruff passes. The tests cover private, public, and internal answers, a non-string value, a non-object body, a 404, a connection failure, and invalid JSON. The failing run's draft was unreadable. Scanning the body of github-metrics#94 with both visibility values passed, so the reproduction didn't settle the cause, and the difference in rule configuration and the shim-refusing binary lookup remain unchecked. The scan's refusal message now names the cause of the next failure.

Opened-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli

Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli
@tbhb-agent
tbhb-agent requested a review from tbhb as a code owner November 23, 2026 15:06

This branch has not been deployed

No deployments
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.

1 participant