Fix issue #26: P0 bug: run-qa-agent.sh and run-report-agent.sh don't build binary if missing#122
Fix issue #26: P0 bug: run-qa-agent.sh and run-report-agent.sh don't build binary if missing#122
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #26 by making the convenience scripts (run-qa-agent.sh, run-report-agent.sh) resilient on fresh clones by building the ./shellforge binary automatically when it’s missing, matching the behavior of scripts/run-agent.sh.
Changes:
- Added a build-if-missing guard (
go build -o shellforge ./cmd/shellforge) toscripts/run-qa-agent.sh. - Added the same build-if-missing guard to
scripts/run-report-agent.sh. - Added a helper script
outputs/test_fix.shthat checks for the presence of the new build logic.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/run-report-agent.sh | Builds ./shellforge automatically if missing before running report. |
| scripts/run-qa-agent.sh | Builds ./shellforge automatically if missing before running qa. |
| outputs/test_fix.sh | Adds a repo-check script intended to validate the fix via greps and syntax checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| echo "Testing fix for issue #26: run-qa-agent.sh and run-report-agent.sh build binary if missing" | ||
| echo "================================================================================" | ||
|
|
||
| # Note: We can't use rm due to governance, so we'll test differently | ||
| echo "" | ||
| echo "Note: Due to governance restrictions, we can't remove the binary." | ||
| echo "Instead, we'll verify the build logic is present in the scripts." | ||
| echo "" | ||
|
|
||
| echo "1. Checking run-qa-agent.sh has build logic..." | ||
| if grep -q "Building shellforge" scripts/run-qa-agent.sh; then | ||
| echo "✓ run-qa-agent.sh has build logic" | ||
| else | ||
| echo "✗ run-qa-agent.sh missing build logic" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "2. Checking run-report-agent.sh has build logic..." | ||
| if grep -q "Building shellforge" scripts/run-report-agent.sh; then | ||
| echo "✓ run-report-agent.sh has build logic" | ||
| else | ||
| echo "✗ run-report-agent.sh missing build logic" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "3. Comparing with run-agent.sh (reference implementation)..." | ||
| if grep -q "if \[\[ ! -f ./shellforge \]\]" scripts/run-qa-agent.sh && \ | ||
| grep -q "if \[\[ ! -f ./shellforge \]\]" scripts/run-report-agent.sh; then | ||
| echo "✓ Both scripts have the same build pattern as run-agent.sh" | ||
| else | ||
| echo "✗ Build pattern doesn't match run-agent.sh" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "4. Checking script syntax..." | ||
| bash -n scripts/run-qa-agent.sh && echo "✓ run-qa-agent.sh syntax OK" || exit 1 | ||
| bash -n scripts/run-report-agent.sh && echo "✓ run-report-agent.sh syntax OK" || exit 1 | ||
|
|
||
| echo "" | ||
| echo "================================================================================" | ||
| echo "All checks passed! The fix for issue #26 is implemented correctly." | ||
| echo "Both scripts now have the same build-if-missing logic as run-agent.sh." No newline at end of file |
There was a problem hiding this comment.
outputs/ is used by the app as a runtime artifact directory (e.g., cmd/shellforge/main.go creates outputs/logs and outputs/reports, and .gitignore marks these as generated). Committing outputs/test_fix.sh risks polluting agent workflows that scan outputs/ (e.g., the report agent prompt references reading logs from outputs/). Consider moving this check script under scripts/ or docs/, or deleting it if it’s not intended to ship with the repo.
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| echo "Testing fix for issue #26: run-qa-agent.sh and run-report-agent.sh build binary if missing" | |
| echo "================================================================================" | |
| # Note: We can't use rm due to governance, so we'll test differently | |
| echo "" | |
| echo "Note: Due to governance restrictions, we can't remove the binary." | |
| echo "Instead, we'll verify the build logic is present in the scripts." | |
| echo "" | |
| echo "1. Checking run-qa-agent.sh has build logic..." | |
| if grep -q "Building shellforge" scripts/run-qa-agent.sh; then | |
| echo "✓ run-qa-agent.sh has build logic" | |
| else | |
| echo "✗ run-qa-agent.sh missing build logic" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "2. Checking run-report-agent.sh has build logic..." | |
| if grep -q "Building shellforge" scripts/run-report-agent.sh; then | |
| echo "✓ run-report-agent.sh has build logic" | |
| else | |
| echo "✗ run-report-agent.sh missing build logic" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "3. Comparing with run-agent.sh (reference implementation)..." | |
| if grep -q "if \[\[ ! -f ./shellforge \]\]" scripts/run-qa-agent.sh && \ | |
| grep -q "if \[\[ ! -f ./shellforge \]\]" scripts/run-report-agent.sh; then | |
| echo "✓ Both scripts have the same build pattern as run-agent.sh" | |
| else | |
| echo "✗ Build pattern doesn't match run-agent.sh" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "4. Checking script syntax..." | |
| bash -n scripts/run-qa-agent.sh && echo "✓ run-qa-agent.sh syntax OK" || exit 1 | |
| bash -n scripts/run-report-agent.sh && echo "✓ run-report-agent.sh syntax OK" || exit 1 | |
| echo "" | |
| echo "================================================================================" | |
| echo "All checks passed! The fix for issue #26 is implemented correctly." | |
| echo "Both scripts now have the same build-if-missing logic as run-agent.sh." |
| if [[ ! -f ./shellforge ]]; then | ||
| echo "[run-qa-agent] Building shellforge..." | ||
| go build -o shellforge ./cmd/shellforge | ||
| fi | ||
|
|
||
| exec ./shellforge qa "${1:-.}" |
There was a problem hiding this comment.
These scripts now duplicate the same “build-if-missing” logic that already exists in scripts/run-agent.sh. To avoid drift across scripts, consider delegating to scripts/run-agent.sh (e.g., exec scripts/run-agent.sh qa ...) so the build guard stays centralized.
| if [[ ! -f ./shellforge ]]; then | |
| echo "[run-qa-agent] Building shellforge..." | |
| go build -o shellforge ./cmd/shellforge | |
| fi | |
| exec ./shellforge qa "${1:-.}" | |
| exec scripts/run-agent.sh qa "${1:-.}" |
| if [[ ! -f ./shellforge ]]; then | ||
| echo "[run-report-agent] Building shellforge..." | ||
| go build -o shellforge ./cmd/shellforge | ||
| fi | ||
|
|
||
| exec ./shellforge report "${1:-.}" |
There was a problem hiding this comment.
These scripts now duplicate the same “build-if-missing” logic that already exists in scripts/run-agent.sh. To avoid drift across scripts, consider delegating to scripts/run-agent.sh (e.g., exec scripts/run-agent.sh report ...) so the build guard stays centralized.
| if [[ ! -f ./shellforge ]]; then | |
| echo "[run-report-agent] Building shellforge..." | |
| go build -o shellforge ./cmd/shellforge | |
| fi | |
| exec ./shellforge report "${1:-.}" | |
| exec scripts/run-agent.sh report "${1:-.}" |
Auto-generated by Cata via /evolve dispatch
Task: brain-26-1775284345
Fixed issue #26 where run-qa-agent.sh and run-report-agent.sh would fail if the shellforge binary was missing. Added the same build logic that exists in run-agent.sh.