fix(deploy): resolve SQL timeouts, YAML drift, and orphaned tmux sessions

- lib.sh: update atomic_dump_yaml to sync with YAML on any active session status change; set reader timeouts to 60.0s
- create_session.sh: add exit trap cleanup_tmux_on_error to rollback spawned tmux sessions on initialization failures
- reconcile.sh, update_yaml_resumed.sh, status.sh, stop_session.sh: align SQLite connection timeout values to 60.0s
This commit is contained in:
2026-07-10 09:21:07 +09:00
parent 6408f4a5ec
commit 3a9964c0e2
6 changed files with 27 additions and 13 deletions
@@ -145,6 +145,16 @@ fi
spawn
# Trap for rolling back/cleaning up tmux session if script exits due to error
cleanup_tmux_on_error() {
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "⚠️ Error occurred during initialization. Rolling back and killing tmux session '$SESSION_NAME'..." >&2
_tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
fi
}
trap cleanup_tmux_on_error EXIT
# TUI 준비 대기
wait_for_tui_ready "$SESSION_NAME" "$AGENT"
@@ -333,6 +343,8 @@ Task: $SUBMIT_JOB_PROMPT"
WD_PID=$(start_watchdog "$DELEGATE_JOB_ID" "$WORKSPACE")
echo "watchdog PID: $WD_PID"
fi
# Clear cleanup trap as registration was fully successful
trap - EXIT
echo "agent-sessions.yaml updated"
echo
if [ -n "${TMUX_SERVER_NAME:-}" ] && [ "$TMUX_SERVER_NAME" != "default" ]; then