Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/frc-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ on:
required: false
type: string
default: 'qwen2.5-coder:1.5b'
bot-app-id:
description: 'GitHub App ID to author PR comments as a custom bot identity'
required: false
type: string
default: ''
secrets:
SLACK_WEBHOOK_URL:
description: 'Slack incoming webhook URL for build status notifications'
required: false
COMMENT_TOKEN:
description: 'Custom token (e.g., GitHub App installation token or bot PAT) to author PR comments instead of github-actions[bot]. Defaults to GITHUB_TOKEN.'
description: 'Custom token (e.g. PAT) to author PR comments. Defaults to GITHUB_TOKEN if bot credentials are not provided.'
required: false
BOT_APP_PRIVATE_KEY:
description: 'GitHub App private key (PEM format) to author PR comments as the custom bot identity'
required: false

jobs:
Expand Down Expand Up @@ -295,10 +303,19 @@ jobs:

echo "has_review=true" >> "$GITHUB_OUTPUT"

- name: Generate Custom Bot Token
if: ${{ secrets.BOT_APP_PRIVATE_KEY != '' && inputs.bot-app-id != '' }}
id: bot-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ inputs.bot-app-id }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Post or Update Sticky PR Comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.COMMENT_TOKEN || secrets.GITHUB_TOKEN }}
github-token: ${{ steps.bot-token.outputs.token || secrets.COMMENT_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const prTitle = context.payload.pull_request ? context.payload.pull_request.title : "Pull Request";
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/test-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test Bot PR Comment

on:
pull_request:
branches: [ main ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
frc-ci:
name: Run FRC CI
uses: ./.github/workflows/frc-ci.yml
permissions:
contents: read
checks: write
pull-requests: write
issues: write
with:
fallback-year: "2026"
enable-ai-review: true
bot-app-id: "5648265"
secrets:
BOT_APP_PRIVATE_KEY: ${{ secrets.BOT_APP_PRIVATE_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gradle
Binary file added .gradle/9.2.0/checksums/checksums.lock
Binary file not shown.
Binary file added .gradle/9.2.0/checksums/sha1-checksums.bin
Binary file not shown.
Binary file added .gradle/9.2.0/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/9.2.0/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added .gradle/9.2.0/fileHashes/fileHashes.lock
Binary file not shown.
Empty file added .gradle/9.2.0/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Fri Nov 06 19:15:06 PST 2026
gradle.version=9.2.0
Empty file added .gradle/vcs-1/gc.properties
Empty file.
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
}

test {
useJUnitPlatform()
ignoreFailures = true
}

19 changes: 19 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package frc.robot.subsystems;

/**
* Robot Shooter and Climber controller with simulated robotics logic bugs
* for testing automated AI code review.
*/
public class ShooterSubsystem {
private double motorOutput = 0.0;
private double currentAmps = 0.0;
private boolean limitSwitchPressed = false;

// BUG 1: Inverted overcurrent protection (critical motor burnout risk)
public void updateCurrentLimit(double reportedAmps) {
this.currentAmps = reportedAmps;
if (this.currentAmps < 80.0) { // BUG: Shuts down motor on low current instead of high current!
System.err.println("CRITICAL: Exceeded 80A! Disabling shooter motor.");
this.motorOutput = 0.0;
}
}

// BUG 2: Infinite loop blocking main robot loop thread (watchdog timeout)
public void spinUpToTargetRPM(double targetRpm, double currentRpm) {
while (currentRpm < targetRpm) {
// BUG: Busy-wait loop on main thread freezes WPILib TimedRobot loop
motorOutput = 1.0;
}
}

// BUG 3: Ignoring physical limit switch during arm extension (chassis damage)
public void setArmPosition(double desiredPosition) {
// BUG: Inverted limit switch check allows driving motor past physical hardstop
if (limitSwitchPressed) {
motorOutput = 1.0; // Keeps applying full forward voltage even when hardstop switch hit!
}
}
}