* Offer an AI diagnosis when a process crashes systemd-coredump journals every core dump under a known MESSAGE_ID with the crashing program, pid, and signal as structured fields. omarchy-crash-watch follows that stream and raises a "Process crashed: <program>" toast; clicking it opens omarchy-agent-crash, which briefs the default agent on the crash. The toast goes through omarchy-notification-send --exec rather than a libnotify action, because the shell runs clicks from its own omarchy-exec hint and never emits ActionInvoked. It keeps the default "omarchy-action" app name too, the only one shouldBypassDnd() lets through -- a crash being the last notification worth swallowing. It stays quiet until an agent is configured, since a diagnosis is all it offers. The method lives in a diagnose-crash skill rather than the prompt, so it is edited in one place and works with whichever agent is default. It covers investigating the core, and reporting a confirmed Omarchy bug upstream: scoped to bugs Omarchy controls, searched for duplicates first, only with the user's agreement, and signed with the model and harness that produced it. A migration reaches existing installs, whose skill symlinks and unit enablement would otherwise sit behind one-time setup paths. * Let the diagnosis clean up the core it extracted "Do not modify or delete anything" contradicted the symbolization step right above it, which writes a core to a temp file and deletes it on exit. Read literally, the core survives -- and the same section warns it holds passwords and tokens. The prohibition is about the system, not about your own scratch. * Do not spend a crash toast on a dead notification server The shell owns org.freedesktop.Notifications, so its own crash takes the notification server down with it -- and a shell crash is exactly what you want told about. The toast was sent once into that gap and the dedupe window was recorded regardless, so the rest of the crash loop went quiet for a minute and `journalctl -n 0` never replays what was missed. It now waits for the restarted shell to reclaim the bus name, as omarchy-migrate-notify already does, and only a delivered toast starts the dedupe window.
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Diagnose a crashed process with the default coding agent
|
|
# omarchy:args=<pid> [comm] [exe] [signal]
|
|
# omarchy:examples=omarchy agent crash 1516893
|
|
|
|
# Clicked from a "Process crashed:" notification, or run by hand against any PID
|
|
# in `coredumpctl list`. The method lives in the diagnose-crash skill so it is
|
|
# edited in one place and works with whichever agent is default; this only
|
|
# gathers the facts and points at it.
|
|
|
|
set -euo pipefail
|
|
|
|
pid=${1:?usage: omarchy-agent-crash <pid> [comm] [exe] [signal]}
|
|
|
|
if [[ ! $pid =~ ^[0-9]+$ ]]; then
|
|
echo "Not a PID: $pid" >&2
|
|
echo "Usage: omarchy agent crash <pid> (see: coredumpctl list)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
comm=${2:-unknown}
|
|
exe=${3:-unknown}
|
|
signal=${4:-unknown}
|
|
|
|
skill="$OMARCHY_PATH/default/agents/skills/diagnose-crash/SKILL.md"
|
|
|
|
# Looked up live so a hand-run PID still gets a timestamp. A rotated-away core
|
|
# only costs the timestamp, so failure is tolerated.
|
|
when=$(coredumpctl list "$pid" --no-pager --no-legend 2>/dev/null | tail -1 | cut -d' ' -f1-4) || true
|
|
when=${when:-unknown}
|
|
|
|
prompt=$(
|
|
cat <<PROMPT
|
|
A process crashed on this Omarchy machine and I want to know why.
|
|
|
|
What systemd-coredump recorded:
|
|
process: $comm
|
|
PID: $pid
|
|
binary: $exe
|
|
signal: $signal
|
|
time: $when
|
|
|
|
Use the diagnose-crash skill: it covers how to investigate, what to report, and
|
|
when a crash is worth reporting upstream to Omarchy. If your harness has no skill
|
|
mechanism, read the skill files directly and follow them instead:
|
|
|
|
$skill
|
|
PROMPT
|
|
)
|
|
|
|
exec omarchy-agent --prompt "$prompt"
|