Skip to content

feat: detect AI disclosure in branch names#51

Open
sreedhards wants to merge 1 commit into
chaoss:mainfrom
sreedhards:feat/50-detect-ai-branch-names
Open

feat: detect AI disclosure in branch names#51
sreedhards wants to merge 1 commit into
chaoss:mainfrom
sreedhards:feat/50-detect-ai-branch-names

Conversation

@sreedhards

Copy link
Copy Markdown

Summary

  • Adds a branchname detector that flags codex/* branch prefixes as medium-confidence OpenAI Codex signals (case-insensitive)
  • Introduces disclosure branch [branch-name] CLI subcommand and scan.ScanBranch helper
  • Updates the GitHub Action to scan PR head refs and include branch findings in the combined report

Fixes #50

Motivation

chaoss/CollectOSS#397 was opened from a codex/* branch. This extends disclosure detection to branch naming patterns that indicate AI involvement.

Test plan

  • go test ./...
  • disclosure branch codex/fix-metrics --format=json returns an OpenAI Codex finding
  • disclosure branch main --format=json returns no findings

Made with Cursor

Add a branchname detector for codex/* branch prefixes and wire it into
the CLI, GitHub Action, and scan package. The action now scans PR head
refs alongside commits and PR bodies.

Fixes chaoss#50

Signed-off-by: sreedhards <8810551+sreedhards@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the disclosure detection system to scan git branch names (e.g., PR head refs) for AI-related naming patterns, specifically flagging codex/* branches as an OpenAI Codex signal. It also adds a new CLI subcommand and updates the GitHub Action to incorporate branch-scan results into the combined report.

Changes:

  • Add a branchname detector that flags codex/ branch prefixes (case-insensitive) with medium confidence.
  • Introduce scan.ScanBranch and a disclosure branch <branch-name> CLI subcommand.
  • Update the GitHub Action to scan PR head branch refs and include branch findings in the combined JSON report.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scan/scan.go Adds ScanBranch helper to run detectors against a branch name input.
scan/scan_test.go Adds coverage for branch scanning via ScanBranch.
detection/detection.go Extends detection.Input with a BranchName field.
detection/branchname/branchname.go Implements branch-prefix detection for codex/ → OpenAI Codex.
detection/branchname/branchname_test.go Adds unit tests for branch-name detection behavior.
cmd/cmd.go Registers branch subcommand and adds detector to CLI detector set.
action/action.yml Scans PR head ref and adds branch section to combined report JSON.
README.md Documents new branch scanning behavior and CLI usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread action/action.yml
Comment on lines +79 to +83
BRANCH_REPORT='{"findings":[]}'
if [ -n "${PR_HEAD_REF}" ]; then
BRANCH_REPORT=$(${{ runner.temp }}/ai-detection branch "${PR_HEAD_REF}" \
--format=json \
--min-confidence="${MIN_CONFIDENCE}") || BRANCH_EXIT=$?
Comment thread cmd/cmd.go
var minConfFlag string

cmd := &cobra.Command{
Use: "branch [branch-name]",
Comment thread README.md
Comment on lines 29 to 33
```
disclosure scan [--range=BASE..HEAD] [--format=json|text] [--min-confidence=low|medium|high] [repo-path]
disclosure text [--format=json|text] [--input=FILE|-]
disclosure branch [branch-name] [--format=json|text] [--min-confidence=low|medium|high]
disclosure version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Detect AI disclosure in branch name

2 participants