From 5ea14e728bc6c9d8cf8879f9bb91233a805a9df8 Mon Sep 17 00:00:00 2001 From: "V B (local edits)" Date: Fri, 6 Nov 2026 19:14:50 -0800 Subject: [PATCH 1/5] test: add test-bot caller workflow and buggy shooter subsystem for AI review test --- .github/workflows/test-bot.yml | 40 +++++++++++++++++++ build.gradle | 16 ++++++++ gradlew | 18 +++++++++ .../robot/subsystems/ShooterSubsystem.java | 36 +++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 .github/workflows/test-bot.yml create mode 100644 build.gradle create mode 100755 gradlew create mode 100644 src/main/java/frc/robot/subsystems/ShooterSubsystem.java diff --git a/.github/workflows/test-bot.yml b/.github/workflows/test-bot.yml new file mode 100644 index 0000000..c940dbb --- /dev/null +++ b/.github/workflows/test-bot.yml @@ -0,0 +1,40 @@ +name: Test Bot PR Comment + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + generate-token: + name: Generate GitHub App Token + runs-on: ubuntu-latest + outputs: + token: ${{ steps.app-token.outputs.token }} + steps: + - name: Generate Bot Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + frc-ci: + name: Run FRC CI + needs: [generate-token] + uses: ./.github/workflows/frc-ci.yml + permissions: + contents: read + checks: write + pull-requests: write + issues: write + with: + fallback-year: "2026" + enable-ai-review: true + secrets: + COMMENT_TOKEN: ${{ needs.generate-token.outputs.token }} diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..665b65b --- /dev/null +++ b/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' +} + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' +} + +test { + useJUnitPlatform() + ignoreFailures = true +} diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..6cb458e --- /dev/null +++ b/gradlew @@ -0,0 +1,18 @@ +#!/bin/sh +# Minimal gradlew simulator for CI testing +mkdir -p build/test-results/test +cat << 'EOF' > build/test-results/test/TEST-frc.robot.ShooterSubsystemTest.xml + + + + + + java.lang.AssertionError: Expected motor shutdown when exceeding 80A current limit, but current limit check was inverted in ShooterSubsystem.java:42 + at frc.robot.ShooterSubsystemTest.testOvercurrentProtectionTriggered(ShooterSubsystemTest.java:42) + + + +EOF + +echo "Simulated Gradle build: compileJava finished, tests executed." +exit 0 diff --git a/src/main/java/frc/robot/subsystems/ShooterSubsystem.java b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java new file mode 100644 index 0000000..1255e27 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java @@ -0,0 +1,36 @@ +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! + } + } +} From 6fd2c01e31a6c66eeb94a238885d9bb25bf6029f Mon Sep 17 00:00:00 2001 From: "V B (local edits)" Date: Fri, 6 Nov 2026 19:15:16 -0800 Subject: [PATCH 2/5] chore: update gradle wrapper and format workflow and source files --- .github/workflows/test-bot.yml | 1 + .gradle/9.2.0/checksums/checksums.lock | Bin 0 -> 39 bytes .gradle/9.2.0/checksums/sha1-checksums.bin | Bin 0 -> 18551 bytes .gradle/9.2.0/fileChanges/last-build.bin | Bin 0 -> 1 bytes .gradle/9.2.0/fileHashes/fileHashes.bin | Bin 0 -> 18597 bytes .gradle/9.2.0/fileHashes/fileHashes.lock | Bin 0 -> 39 bytes .gradle/9.2.0/gc.properties | 0 .../buildOutputCleanup/buildOutputCleanup.lock | Bin 0 -> 39 bytes .gradle/buildOutputCleanup/cache.properties | 2 ++ .gradle/vcs-1/gc.properties | 0 build.gradle | 1 + gradlew | 1 + .../frc/robot/subsystems/ShooterSubsystem.java | 1 + 13 files changed, 6 insertions(+) create mode 100644 .gradle/9.2.0/checksums/checksums.lock create mode 100644 .gradle/9.2.0/checksums/sha1-checksums.bin create mode 100644 .gradle/9.2.0/fileChanges/last-build.bin create mode 100644 .gradle/9.2.0/fileHashes/fileHashes.bin create mode 100644 .gradle/9.2.0/fileHashes/fileHashes.lock create mode 100644 .gradle/9.2.0/gc.properties create mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 .gradle/buildOutputCleanup/cache.properties create mode 100644 .gradle/vcs-1/gc.properties diff --git a/.github/workflows/test-bot.yml b/.github/workflows/test-bot.yml index c940dbb..28cb9ca 100644 --- a/.github/workflows/test-bot.yml +++ b/.github/workflows/test-bot.yml @@ -38,3 +38,4 @@ jobs: enable-ai-review: true secrets: COMMENT_TOKEN: ${{ needs.generate-token.outputs.token }} + diff --git a/.gradle/9.2.0/checksums/checksums.lock b/.gradle/9.2.0/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..e7051f47d1502ced085a0d753ada44eb0c60d1ae GIT binary patch literal 39 qcmZQRFRPNd)vNdl0|YQJGcbI6@LBtaj^%fQDh5__b4z1W1_l7$g9@4e literal 0 HcmV?d00001 diff --git a/.gradle/9.2.0/checksums/sha1-checksums.bin b/.gradle/9.2.0/checksums/sha1-checksums.bin new file mode 100644 index 0000000000000000000000000000000000000000..da9a06826401cfb43e1fdc6d58c95e5d39ee9093 GIT binary patch literal 18551 zcmeI(F^WPl5CG8ltyTmrcEQ%dLh!?~opb2M9yRVa^O=$yqm4F|6_l27;NK*fyF9pe)H3ovsizwd66v) literal 0 HcmV?d00001 diff --git a/.gradle/9.2.0/fileChanges/last-build.bin b/.gradle/9.2.0/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/.gradle/9.2.0/fileHashes/fileHashes.bin b/.gradle/9.2.0/fileHashes/fileHashes.bin new file mode 100644 index 0000000000000000000000000000000000000000..d45cfe185002e550e66da7cce30e3b9c8607aff5 GIT binary patch literal 18597 zcmeI(JxT*X6ae7afK3ogBLr-;un;7K1P>4tR4ha=N~$y}T8W4Vf|sxs#73Kd=n*Va zSXkQo0~WRxkvQvS30}ZLzJZy2yf=^C`PyX`LMWH|gAs;fd>D!d5FkK+009C72oNAZ zfB*pk1PBlyK!5;&|02+g2PtNUDbE(tVC*=A>SzoKSDo71Q|o#qD=#(j{|CL1ukPGt zcX^OM%=7s(<{MefN`L?X0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF{G~uWzHBDWsdScl=R3Qd?fH%BP5u4;Wb!kFY6+?PcQOrz0t*HxDY``!+;O literal 0 HcmV?d00001 diff --git a/.gradle/9.2.0/fileHashes/fileHashes.lock b/.gradle/9.2.0/fileHashes/fileHashes.lock new file mode 100644 index 0000000000000000000000000000000000000000..8a57da5af658c1c70db54009cbbe06bd6d73a6c6 GIT binary patch literal 39 rcmZQ(y?S@g`Zug@3=qJ|%)s#N!PbQIoUJP+K44%qH@7r4WncgR{o@P; literal 0 HcmV?d00001 diff --git a/.gradle/9.2.0/gc.properties b/.gradle/9.2.0/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000000000000000000000000000000000000..1617ede1f64c975c74af35e9f5317b8357e5b73b GIT binary patch literal 39 qcmZQ}vk<+Vr}6wQ0|YQKGcbI6;L$z1Jnc$YC Date: Fri, 6 Nov 2026 19:15:52 -0800 Subject: [PATCH 3/5] chore: add .gradle to gitignore and update build outputs --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a8da3b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.gradle \ No newline at end of file From d4fea6f6d38ab08c79c5d9e1de38fd0f961c8186 Mon Sep 17 00:00:00 2001 From: "V B (local edits)" Date: Fri, 6 Nov 2026 19:24:18 -0800 Subject: [PATCH 4/5] feat: generate GitHub App token in-situ inside pr-comment step --- .github/workflows/frc-ci.yml | 21 +++++++++++++++++++-- .github/workflows/test-bot.yml | 19 ++----------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/frc-ci.yml b/.github/workflows/frc-ci.yml index 28085fa..9da8863 100644 --- a/.github/workflows/frc-ci.yml +++ b/.github/workflows/frc-ci.yml @@ -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: @@ -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"; diff --git a/.github/workflows/test-bot.yml b/.github/workflows/test-bot.yml index 28cb9ca..cd10819 100644 --- a/.github/workflows/test-bot.yml +++ b/.github/workflows/test-bot.yml @@ -10,23 +10,8 @@ concurrency: cancel-in-progress: true jobs: - generate-token: - name: Generate GitHub App Token - runs-on: ubuntu-latest - outputs: - token: ${{ steps.app-token.outputs.token }} - steps: - - name: Generate Bot Token - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.BOT_APP_ID }} - private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - frc-ci: name: Run FRC CI - needs: [generate-token] uses: ./.github/workflows/frc-ci.yml permissions: contents: read @@ -36,6 +21,6 @@ jobs: with: fallback-year: "2026" enable-ai-review: true + bot-app-id: ${{ vars.BOT_APP_ID || '5648265' }} secrets: - COMMENT_TOKEN: ${{ needs.generate-token.outputs.token }} - + BOT_APP_PRIVATE_KEY: ${{ secrets.BOT_APP_PRIVATE_KEY }} From d51d889ed4908110420a8c43c4fa09e583aa4626 Mon Sep 17 00:00:00 2001 From: "V B (local edits)" Date: Fri, 6 Nov 2026 19:26:25 -0800 Subject: [PATCH 5/5] fix: pass literal bot-app-id string in caller workflow --- .github/workflows/test-bot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-bot.yml b/.github/workflows/test-bot.yml index cd10819..3329e43 100644 --- a/.github/workflows/test-bot.yml +++ b/.github/workflows/test-bot.yml @@ -21,6 +21,6 @@ jobs: with: fallback-year: "2026" enable-ai-review: true - bot-app-id: ${{ vars.BOT_APP_ID || '5648265' }} + bot-app-id: "5648265" secrets: BOT_APP_PRIVATE_KEY: ${{ secrets.BOT_APP_PRIVATE_KEY }}