From e1c4198c08e5f662726f49fa4776c516cffa42b5 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Wed, 10 Jun 2026 04:54:40 +0000 Subject: [PATCH] =?UTF-8?q?fix(ci):=20recipe-ci=20wrapper=20=E2=80=94=20ca?= =?UTF-8?q?pture=20harness=20rc,=20clear=20traps=20before=20exit=20(green?= =?UTF-8?q?=20runs=20no=20longer=20exit=201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The drone exec runner's step shell is set -e. On a NORMAL harness exit the EXIT trap still fired and its kill of the already-exited process group failed with ESRCH, poisoning the script's exit status: build 269 (plausible#3) ran fully GREEN (all tiers pass, level=4) but the step exited 1. Reproduced minimally with sh -e and bash -e on the host; the fixed wrapper verified for all three paths: green rc=0, red rc=7 (propagated), TERM-to-shell -> child gets TERM and wrapper exits 143. Cancel forwarding semantics unchanged. --- .drone.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index cc709f3..ae174c8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -75,9 +75,15 @@ steps: # forward a drone cancel (TERM to this step shell) to the WHOLE group, so the harness's # SIGTERM handler runs its teardown funnel instead of being leaked (the exec runner kills # only the step shell, not the tree). PDEATHSIG inside the harness backstops the case where - # this shell dies without the trap firing. `wait` propagates the harness exit code. + # this shell dies without the trap firing. The harness exit code is captured explicitly and + # the traps cleared before exiting: the runner shell is `set -e`, and an EXIT-trap kill of + # the already-gone process group returns ESRCH, which otherwise poisons a GREEN run's exit + # status to 1 (observed live, build 269: all tiers pass, step exit 1). - | setsid cc-ci-run runner/run_recipe_ci.py & PID=$! - trap 'kill -TERM -- "-$PID" 2>/dev/null' TERM EXIT - wait "$PID" + trap 'kill -TERM -- "-$PID" 2>/dev/null || true' TERM EXIT + rc=0 + wait "$PID" || rc=$? + trap - TERM EXIT + exit "$rc"