fix(herdr-workspace): synchronize herdr runtime workspace label on spawn and resume

This commit is contained in:
2026-08-24 13:17:34 +09:00
parent d2cdc3f8cd
commit fc8ca88107
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -463,7 +463,7 @@ except Exception:
fi fi
if [ -z "$existing_ws" ] || [ -z "$target_pane" ]; then if [ -z "$existing_ws" ] || [ -z "$target_pane" ]; then
ws_json=$(_real_herdr workspace create --cwd "${ws:-.}" $env_flags --no-focus 2>/dev/null || echo "") ws_json=$(_real_herdr workspace create --cwd "${ws:-.}" ${MAM_WS_LABEL:+--label "$MAM_WS_LABEL"} $env_flags --no-focus 2>/dev/null || echo "")
target_pane=$(echo "$ws_json" | python3 -c " target_pane=$(echo "$ws_json" | python3 -c "
import sys, json import sys, json
try: try:
@@ -474,6 +474,10 @@ try:
except Exception: except Exception:
pass pass
" 2>/dev/null || echo "") " 2>/dev/null || echo "")
else
if [ -n "$MAM_WS_LABEL" ]; then
_real_herdr workspace rename "$existing_ws" "$MAM_WS_LABEL" >/dev/null 2>&1 || true
fi
fi fi
if [ -z "$target_pane" ]; then if [ -z "$target_pane" ]; then
@@ -63,6 +63,12 @@ else
export HERDR_SESSION_NAME export HERDR_SESSION_NAME
fi fi
if [ -n "$HERDR_WORKSPACE_OPT" ]; then
export MAM_WS_LABEL="$HERDR_WORKSPACE_OPT"
else
export MAM_WS_LABEL="$(resolve_herdr_workspace "$SESSION_NAME" "$WORKSPACE")"
fi
# 2. If herdr is alive, print warning or attach. # 2. If herdr is alive, print warning or attach.
if herdr has-session -t "$SESSION_NAME" 2>/dev/null; then if herdr has-session -t "$SESSION_NAME" 2>/dev/null; then
if [ "${DRY_RUN:-0}" = "1" ]; then if [ "${DRY_RUN:-0}" = "1" ]; then