feat(resume): resume ensures the monitor daemon (Issue #72, decision 2)
Only create started the per-workspace monitor, and only on its job path, so the stop -> update -> resume flow the update skill requires left no monitor. resume now calls start_watchdog with the control root as workdir (as create does since #21 A8, also for a worktree session) after the row is written, on both the already-running and the spawn path. MAM_NO_SUBSCRIBER_DAEMON=1 starts none; a failure warns and does not fail the resume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec378e82c9
commit
179473e5d5
3 files changed
+202
-5
No files matched your search
@@ -154,6 +154,18 @@ if [ -z "$UUID" ]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Issue #72: a resumed session gets the monitor daemon create starts - the
|
||||
# control root's (Issue #21 A8), also for a worktree --workspace. Called after
|
||||
# the row is written; MAM_NO_SUBSCRIBER_DAEMON=1 starts none. Never fails the resume.
|
||||
_ensure_monitor_daemon() {
|
||||
local wd_pid
|
||||
if wd_pid=$(start_watchdog "resume" "$WORKSPACE_ROOT"); then
|
||||
echo "watchdog PID: $wd_pid"
|
||||
else
|
||||
echo "WARNING: could not start the monitor daemon of '$WORKSPACE_ROOT'; the session itself was resumed" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
# 2. If herdr is alive, print warning or attach.
|
||||
if [ "$HERDR_ALIVE" = "1" ]; then
|
||||
if [ "${DRY_RUN:-0}" = "1" ]; then
|
||||
@@ -166,6 +178,7 @@ if [ "$HERDR_ALIVE" = "1" ]; then
|
||||
--session "$SESSION_NAME" --uuid "$UUID" --agent "$AGENT" --workspace "$WORKSPACE" \
|
||||
--herdr-session "$HERDR_SESSION_NAME" --already-running \
|
||||
${HERDR_WORKSPACE_OPT:+--herdr-workspace "$HERDR_WORKSPACE_OPT"}
|
||||
_ensure_monitor_daemon
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -274,5 +287,6 @@ CONTROL_PLANE_JSON="$CP_JSON" bash "$(dirname "${BASH_SOURCE[0]}")/update_yaml_r
|
||||
--herdr-session "$HERDR_SESSION_NAME" --cmd-full "$CMD_FULL" \
|
||||
${DROP_FLAG:+$DROP_FLAG} \
|
||||
${HERDR_WORKSPACE_OPT:+--herdr-workspace "$HERDR_WORKSPACE_OPT"}
|
||||
_ensure_monitor_daemon
|
||||
|
||||
echo "Successfully resumed $SESSION_NAME ($AGENT)"
|
||||
Reference in new issue
Block a user