From 4d1fff53e98c43e84cc2815f9f647b41f07650bc Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Sat, 6 Jun 2026 15:07:57 +0200 Subject: [PATCH] fix(statusline): al parar, salir del estado activo de inmediato El Stop hook ahora pone en_pausa de forma sincrona si la fase estaba en un estado activo (investigando/haciendo/testeando/puliendo), antes de lanzar el worker haiku en background. Evita que el statusline se quede mostrando el ultimo estado activo (p.ej. 'investigando' por un 'git log' final) durante los ~2s que tarda la clasificacion de reposo. El provisional no toca el historial; el worker escribe el reposo final (hecho/pendiente_revision/bloqueado/en_pausa) + history. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/hooks/goal_phase_eval.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.claude/hooks/goal_phase_eval.sh b/.claude/hooks/goal_phase_eval.sh index 8c7df41..8469459 100755 --- a/.claude/hooks/goal_phase_eval.sh +++ b/.claude/hooks/goal_phase_eval.sh @@ -18,9 +18,20 @@ F="$HOME/.claude/goals/${SID}.json" GOAL=$(jq -r '.goal // ""' "$F" 2>/dev/null) [ -z "$GOAL" ] && exit 0 +# Salir del estado ACTIVO de inmediato (sincrono, instantaneo): al parar no debe +# quedarse mostrando investigando/haciendo/testeando mientras el worker (haiku, +# background) afina el reposo a hecho/pendiente_revision/bloqueado/en_pausa. +CUR=$(jq -r '.phase // ""' "$F" 2>/dev/null) +case "$CUR" in + investigando|planificando|haciendo|testeando|puliendo) + TMP="${F}.prov.$$" + if jq '.phase="en_pausa"' "$F" > "$TMP" 2>/dev/null; then mv "$TMP" "$F"; else rm -f "$TMP"; fi + ;; +esac + [ -z "$TRANSCRIPT" ] && exit 0 [ -f "$TRANSCRIPT" ] || exit 0 -# Lanzar clasificacion en background; el hook retorna de inmediato. +# Afinar el reposo en background; el hook retorna de inmediato. nohup bash "$HOME/.claude/hooks/goal_phase_worker.sh" "$SID" "$TRANSCRIPT" "$F" >/dev/null 2>&1 & exit 0