fix(stale-claims): avoid SIGPIPE 141 — pass file path не pipe #612

Merged
lekss361 merged 1 commit from feat/stale-claims-sigpipe-fix into main 2026-05-27 22:06:46 +00:00
Owner

Root cause

Из diagnostic run #1520 (после merge PR #611):

[OK] 0 wip issues — nothing to do
+ rm -f /tmp/tmp.xRrhfBFSFe
exitcode '141': failure

Exit code 141 = SIGPIPE (signal 13).

Последовательность:

  1. cat $ISSUES_TMP | python3 <<EOF ... — pipe из bash в Python heredoc
  2. Python печатает [OK] 0 wip issues — nothing to do и вызывает sys.exit(0)
  3. Python закрыл stdin, но cat ещё писал → SIGPIPE
  4. set -o pipefail ловит SIGPIPE как failure → script exits 141
  5. Workflow step считает failure

Локально на VPS то же self-reproducing (просто не было pipefail или меньше bytes — поэтому при моих SSH тестах не fired).

Fix

Передача file path через env var вместо stdin pipe. Python читает файл напрямую — никакого pipe → нет SIGPIPE.

# Было:
cat "$ISSUES_TMP" | python3 <<'PYEOF'
... sys.stdin.read() ...
PYEOF

# Стало:
ISSUES_FILE="$ISSUES_TMP" python3 <<'PYEOF'
... open(os.environ['ISSUES_FILE']).read() ...
PYEOF

Verified

Locally на VPS с bot-qa token:

[2026-05-28T01:05:31+03:00] cleanup-stale-claims: scanning status/wip issues (stale threshold: 4h)
[OK] 0 wip issues — nothing to do
Exit code: 0  ← ✓

Also

Убраны diagnostic steps добавленные в PR #611 (env dump + bash -x) — теперь когда root cause найден, workflow возвращается к минимальному виду.

Test plan

  • После merge — trigger manual dispatch
  • Run #N+1 должен быть success (4-5 seconds, exit 0)
  • Cron */30 * * * * должен picking up каждые 30 мин и завершаться success при 0 wip issues

Refs

  • PR #610 (initial stale-claims)
  • PR #611 (diagnostic, merged → дал log с exit 141)
  • Forgejo log: /data/gitea/actions_log/lekss361/gendesign/f0/1520.log.zst
## Root cause Из diagnostic run #1520 (после merge PR #611): ``` [OK] 0 wip issues — nothing to do + rm -f /tmp/tmp.xRrhfBFSFe exitcode '141': failure ``` **Exit code 141 = SIGPIPE** (signal 13). Последовательность: 1. `cat $ISSUES_TMP | python3 <<EOF ...` — pipe из bash в Python heredoc 2. Python печатает `[OK] 0 wip issues — nothing to do` и вызывает `sys.exit(0)` 3. Python закрыл stdin, но `cat` ещё писал → SIGPIPE 4. `set -o pipefail` ловит SIGPIPE как failure → script exits 141 5. Workflow step считает failure Локально на VPS то же self-reproducing (просто не было `pipefail` или меньше bytes — поэтому при моих SSH тестах не fired). ## Fix Передача file path через **env var** вместо stdin pipe. Python читает файл напрямую — никакого pipe → нет SIGPIPE. ```bash # Было: cat "$ISSUES_TMP" | python3 <<'PYEOF' ... sys.stdin.read() ... PYEOF # Стало: ISSUES_FILE="$ISSUES_TMP" python3 <<'PYEOF' ... open(os.environ['ISSUES_FILE']).read() ... PYEOF ``` ## Verified Locally на VPS с bot-qa token: ``` [2026-05-28T01:05:31+03:00] cleanup-stale-claims: scanning status/wip issues (stale threshold: 4h) [OK] 0 wip issues — nothing to do Exit code: 0 ← ✓ ``` ## Also Убраны diagnostic steps добавленные в PR #611 (env dump + `bash -x`) — теперь когда root cause найден, workflow возвращается к минимальному виду. ## Test plan - [ ] После merge — trigger manual dispatch - [ ] Run #N+1 должен быть success (4-5 seconds, exit 0) - [ ] Cron `*/30 * * * *` должен picking up каждые 30 мин и завершаться success при 0 wip issues ## Refs - PR #610 (initial stale-claims) - PR #611 (diagnostic, merged → дал log с exit 141) - Forgejo log: /data/gitea/actions_log/lekss361/gendesign/f0/1520.log.zst
lekss361 added 1 commit 2026-05-27 22:06:24 +00:00
Root cause: `cat $ISSUES_TMP | python3 <<EOF ... sys.exit(0)` — Python exits
0 early, cat получает SIGPIPE, set -o pipefail → script exits 141 = failure.

Fix: передача file path через env var вместо stdin pipe. Python читает файл
напрямую. No pipe → no SIGPIPE.

Verified локально на VPS с bot-qa token: exit 0, '[OK] 0 wip issues —
nothing to do'.

Also remove diagnostic steps from workflow (added в PR #611, нужно для
поиска root cause, теперь убираем).

Refs: PR #611 (diagnostic), runs #1514-1520 failures.
lekss361 merged commit 3fcac6818a into main 2026-05-27 22:06:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#612
No description provided.