Skip to content

Commit daabb10

Browse files
Fix/panicbot ponsbot review followups (#730)
- fix(ponsbot): kill the whole process group on timeout and bound pipe joins - fix(panicbot): process group kill, absolute binary, honest text mode, one preflight deadline - fix(report-back): reject a --pons commit that differs from the ponsbot pin - fix(panicbot): adjudicate exit 1 is a valid fail; exit 2 and verdict error are errors - fix(panicbot,ponsbot): kill process group via rustix, drop unsafe killpg - fix(panicbot,ponsbot): build the group pid with Pid::from_child - fix(panicbot,ponsbot): both pipe reads share one deadline - fix(report-back): a refused or failed install leaves no stale binary
1 parent 724961c commit daabb10

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎scripts/fleet-report-back-build.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ for c in $crates; do
102102
done
103103

104104
if [ -n "$pa_sha" ]; then
105+
# A reused --bin-dir may hold a panic-attack from an earlier run. Only this
106+
# run's install or cache restore may put one there.
107+
rm -f "$bindir/panic-attack"
105108
root="$HOME/.panic-attack"; bin="$root/bin/panic-attack"
106109
group "panic-attack at $pa_sha"
107110
if [ -x "$bin" ] && grep -qF "#$pa_sha" "$root/.crates.toml" 2>/dev/null; then
@@ -118,6 +121,10 @@ if [ -n "$pa_sha" ]; then
118121
fi
119122

120123
if [[ -n "$pons_sha" ]]; then
124+
# A reused --bin-dir may hold a pons from an earlier run, which ponsbot would
125+
# find on PATH. Remove it before deciding, so a refused, failed or skipped
126+
# install leaves no pons at all and ponsbot reads not_run.
127+
rm -f "$bindir/pons"
121128
if ! [[ "$pons_sha" =~ ^[0-9a-f]{40}$ ]]; then
122129
warn "pons not installed" "$(printf '%q' "$pons_sha") is not a 40-hex commit; ponsbot will read not_run"
123130
elif pin_commit=$(sed -n 's/^commit[[:space:]]*=[[:space:]]*"\([0-9a-f]\{40\}\)"[[:space:]]*$/\1/p' "$fleet/bots/ponsbot/canon/pin.toml" 2>/dev/null | head -n 1 || true); [[ -z "$pin_commit" ]]; then

‎tests/fleet-report-back-build-test.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ check "pons: an unreadable pin installs nothing and says so" "0 yes" \
275275
run_pons_build pons-budget --pons "$PSHA" --build-budget 0
276276
check "pons: a spent build budget skips the install with a warning" "0 yes" \
277277
"$(grep -c . "$FLEET_PONS_CALLS" || true) $(grep -q 'spent before its turn' "$TMP/pons-budget.log" && echo yes || echo no)"
278+
# A reused --bin-dir: a pons left by an earlier run must not survive a refusal.
279+
mkdir -p "$TMP/pons-stale"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pons-stale/pons"; chmod +x "$TMP/pons-stale/pons"
280+
run_pons_build pons-stale --pons 0123456789abcdef0123456789abcdef01234567
281+
check "pons: a refused pin removes a stale pons from a reused bin dir" "" "$(files "$TMP/pons-stale")"
282+
mkdir -p "$TMP/pons-stale-ok"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pons-stale-ok/pons"; chmod +x "$TMP/pons-stale-ok/pons"
283+
run_pons_build pons-stale-ok --pons "$PSHA"
284+
check "pons: ...and an accepted pin replaces it with this run's build" pons "$("$TMP/pons-stale-ok/pons")"
285+
mkdir -p "$TMP/pa-stale"; printf "#!/usr/bin/env bash\necho stale\n" > "$TMP/pa-stale/panic-attack"; chmod +x "$TMP/pa-stale/panic-attack"
286+
run_build pa-stale --crates "" --panic-attack 0123456789abcdef0123456789abcdef01234567 --build-budget 0
287+
check "panic-attack: a skipped install removes a stale binary from a reused bin dir" "" "$(files "$TMP/pa-stale")"
278288
echo
279289
echo "fleet-report-back-build-test: $pass passed, $fail failed"
280290
[ "$fail" -eq 0 ]

0 commit comments

Comments
 (0)