Skip to content

Commit 7cae43a

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#36)
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 afc3f07 commit 7cae43a

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
@@ -87,25 +87,73 @@ jobs:
8787

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

0 commit comments

Comments
 (0)