Skip to content

fix(alerts): report a failed session-ops-alert without the venv - #83

Closed
Bilb wants to merge 1 commit into
mainfrom
fix/alert-without-venv
Closed

Bilb wants to merge 1 commit into
mainfrom
fix/alert-without-venv

Conversation

@Bilb

@Bilb Bilb commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

On angus, the Debian upgrade moved /usr/bin/python3 to 3.13, under a venv built for the old Python. From the Oct 30 reboot until install.sh was re-run on Nov 1, every job failed with ModuleNotFoundError: No module named 'session_ops'. session-ops-alert and session-ops-silence run from the same venv, so they failed too, and Discord heard nothing for two days.

session-ops-alert@ now has its own OnFailure=: session-ops-alert-fallback@.service runs deploy/session-ops-alert-fallback.sh, which uses only shell, journalctl and curl. It posts the failed alert unit, its last journal line and the fix (re-run install.sh) to ALERT_DISCORD_WEBHOOK_URL. A broken venv fails every run of every job, so it posts at most once per 6 hours. The time of the last post is kept in the unit's StateDirectory.

install.sh already installs every deploy/*.service, and the script runs from the root-owned clone, so deploying is a pull and install.sh.

Verified: python -m unittest discover -s tests -t . passes (912 tests, 1 skipped), and ruff check passes. The new tests run the script against stub curl, journalctl and hostname: the payload is valid JSON with quotes and backslashes escaped, a second post inside the window is skipped, a failed post exits 1 and is retried, and an empty webhook exits 0. Not yet run on angus.

The jobs, session-ops-alert and the silence checker all run from
/opt/session-ops/.venv. When a Python upgrade breaks it, every job fails
and every alert fails with it, so nothing reaches Discord.

session-ops-alert@ now has its own OnFailure=: a shell and curl script
that posts the failed alert, its last journal line and the install.sh
fix to ALERT_DISCORD_WEBHOOK_URL, at most once per 6 hours.
@Bilb Bilb closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant