feat(@projects/@magic-civilization): add godot process tracking

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-16 23:16:39 -07:00
parent 60838c293f
commit 91eeca0aaa

View file

@ -292,14 +292,21 @@ if [[ "${MODE}" == "status" ]]; then
exit 0
fi
IFS='|' read -r IS_ACTIVE MARKER_COUNT STATS_COUNT SEEDS_TOTAL <<<"${PROBE_OUT}"
IFS='|' read -r IS_ACTIVE MARKER_COUNT STATS_COUNT SEEDS_TOTAL GODOT_PROCS <<<"${PROBE_OUT}"
MARKER_COUNT="${MARKER_COUNT:-0}"
STATS_COUNT="${STATS_COUNT:-0}"
SEEDS_TOTAL="${SEEDS_TOTAL:-0}"
GODOT_PROCS="${GODOT_PROCS:-0}"
if [[ "${MARKER_COUNT}" -gt 0 ]]; then
if [[ "${MARKER_COUNT}" -gt 0 && "${GODOT_PROCS}" -eq 0 ]]; then
STATE="complete"
MARKER_BOOL="true"
elif [[ "${MARKER_COUNT}" -gt 0 && "${GODOT_PROCS}" -gt 0 ]]; then
# Batch script returned (touched completion.marker) but flatpak-
# detached godot processes are still playing games. Status remains
# `running` so `fetch` won't pull mid-run turn_stats snapshots.
STATE="running"
MARKER_BOOL="true"
elif [[ "${IS_ACTIVE}" == "active" || "${IS_ACTIVE}" == "activating" ]]; then
STATE="running"
MARKER_BOOL="false"
@ -308,8 +315,8 @@ if [[ "${MODE}" == "status" ]]; then
MARKER_BOOL="false"
fi
printf '{"stamp":"%s","state":"%s","seeds_done":%s,"seeds_total":%s,"completion_marker":%s}\n' \
"${QUERY_STAMP}" "${STATE}" "${STATS_COUNT}" "${SEEDS_TOTAL}" "${MARKER_BOOL}"
printf '{"stamp":"%s","state":"%s","seeds_done":%s,"seeds_total":%s,"completion_marker":%s,"godot_procs":%s}\n' \
"${QUERY_STAMP}" "${STATE}" "${STATS_COUNT}" "${SEEDS_TOTAL}" "${MARKER_BOOL}" "${GODOT_PROCS}"
exit 0
fi