Skip to content

Commit 31d33fd

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#23)
Layer-1 propagation of **hyperpolymath/hypatia#252**. This repo carries its own copy of `.github/workflows/hypatia-scan.yml`. The **"Submit findings to gitbot-fleet (Phase 2)"** step hard-failed the job (exit 127) for any commit with ≥1 finding — it clones `gitbot-fleet` and execs `scripts/submit-finding.sh`, which no longer exists on gitbot-fleet's default branch. That is the estate-wide "Hypatia Neurosymbolic Analysis fails regardless of content" symptom. Phase 2 is the collaborative **learning** side-channel, not the security gate (the gate is the separate baseline-aware critical/high step, which is untouched). Fix mirrors the canonical workflow: - `continue-on-error: true` on the Phase-2 step. - Self-healing body: non-fatal clone, probe known submit-script paths, skip with `::warning::` if absent or non-zero. Surgical: only the Phase-2 step changed; every other step preserved. Security enforcement is unchanged. Refs hyperpolymath/hypatia#252 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent facca85 commit 31d33fd

1 file changed

Lines changed: 55 additions & 7 deletions

File tree

.github/workflows/hypatia-scan.yml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,73 @@ jobs:
8686

8787
- name: Submit findings to gitbot-fleet (Phase 2)
8888
if: steps.scan.outputs.findings_count > 0
89+
# Phase 2 is the collaborative LEARNING side-channel ("bots share
90+
# findings via gitbot-fleet"), not the security gate. The gate is
91+
# the baseline-aware "Check for critical or high-severity issues"
92+
# step below. A fleet-side regression (e.g. the submit script being
93+
# moved/removed) must NEVER hard-fail every consuming repo's scan.
94+
# Same reasoning as the "Comment on PR with findings" step.
95+
# See hyperpolymath/hypatia#213 (gate decoupling) and the exit-127
96+
# estate-wide breakage when gitbot-fleet/scripts/submit-finding.sh
97+
# no longer existed on the default branch.
98+
continue-on-error: true
8999
env:
100+
# All GitHub context values surface as env vars so the run
101+
# block never interpolates `${{ … }}` inline (closes the
102+
# workflow_audit/unsafe_curl_payload + actions_expression_injection
103+
# findings).
90104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
FLEET_PUSH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
106+
FLEET_DISPATCH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
91107
GITHUB_REPOSITORY: ${{ github.repository }}
92108
GITHUB_SHA: ${{ github.sha }}
109+
FINDINGS_COUNT: ${{ steps.scan.outputs.findings_count }}
93110
run: |
94-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
111+
echo "📤 Submitting $FINDINGS_COUNT findings to gitbot-fleet..."
95112
96-
# Clone gitbot-fleet to temp directory
113+
# Clone gitbot-fleet to temp directory. A clone failure (network,
114+
# repo gone) is non-fatal: learning submission is best-effort.
97115
FLEET_DIR="/tmp/gitbot-fleet-$$"
98-
git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
116+
if ! git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"; then
117+
echo "::warning::Could not clone gitbot-fleet — skipping Phase 2 learning submission (non-fatal)."
118+
exit 0
119+
fi
99120
100-
# Run submission script
101-
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json
121+
# The submission script's location in gitbot-fleet has drifted
122+
# before (it was absent from the default branch, which exit-127'd
123+
# every consuming repo's scan). Probe known locations rather than
124+
# hard-coding one path, and skip gracefully if none is present.
125+
SUBMIT_SCRIPT=""
126+
for cand in \
127+
"$FLEET_DIR/scripts/submit-finding.sh" \
128+
"$FLEET_DIR/scripts/submit_finding.sh" \
129+
"$FLEET_DIR/bin/submit-finding.sh" \
130+
"$FLEET_DIR/submit-finding.sh"; do
131+
if [ -f "$cand" ]; then
132+
SUBMIT_SCRIPT="$cand"
133+
break
134+
fi
135+
done
136+
137+
if [ -z "$SUBMIT_SCRIPT" ]; then
138+
echo "::warning::gitbot-fleet submit-finding script not found at any known path — skipping Phase 2 learning submission (non-fatal). Findings are still uploaded as an artifact and gated below."
139+
rm -rf "$FLEET_DIR"
140+
exit 0
141+
fi
142+
143+
# Run submission script. Pass the findings path as ABSOLUTE —
144+
# the script cd's into its own working dir before reading the
145+
# file, so a relative path would resolve to the wrong place.
146+
# A submission-script failure is logged but non-fatal.
147+
if bash "$SUBMIT_SCRIPT" "$GITHUB_WORKSPACE/hypatia-findings.json"; then
148+
echo "✅ Finding submission complete"
149+
else
150+
echo "::warning::gitbot-fleet submission script exited non-zero — Phase 2 learning submission skipped (non-fatal)."
151+
fi
102152
103153
# Cleanup
104154
rm -rf "$FLEET_DIR"
105155
106-
echo "✅ Finding submission complete"
107-
108156
- name: Check for critical issues
109157
if: steps.scan.outputs.critical > 0
110158
run: |

0 commit comments

Comments
 (0)