refactor: standardize --agent option usage, improve YAML registry fallback, and fix layout falsy-zero trap (J-1)
- In stop_session.sh and update_yaml_resumed.sh: standardize explicit --agent option and use resolve_agent_type_from_registry to read agent type from YAML/DB state rather than brittle suffix-only regex inference. - Update multi-agent-mux-stop/SKILL.md, multi-agent-mux-resume/SKILL.md, multi-agent-mux-create/SKILL.md, and deploy/INSTALL.md to standardize passing --agent explicitly. - Fix J-1 in layout.py: refactor _env_int(*names, default=None) to take an explicit default parameter, eliminating the falsy-zero trap so MAM_MIN_PANE_COLS=0 is respected. - Add regression and contract tests: test_j1_env_zero_min_cols_matches_flag_zero, test_j1_env_zero_min_rows_matches_flag_zero, test_comp_stop_agent_fallback_*, test_comp_docs_stop_examples_pass_agent. - Verified 100% UNANIMOUS PASS from Planner claude and Reviewers claude and cline.
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
# 옵션:
|
||||
# --session <name> — 대상 세션 (필수)
|
||||
# --agent <type> — claude | agy | hermes | cline
|
||||
# (미지정 시 세션명 접미사로 추론; 추론 실패 시 exit 2)
|
||||
# (권장: 항상 명시. 미지정 시 레지스트리 기록으로
|
||||
# 해석 — agent 필드 → 세션명 접미사 → pane.cmd;
|
||||
# 셋 다 실패하면 exit 2)
|
||||
# --reason <reason> — 상태 전이 사유 (stop_reason). 기본값 manual_stop
|
||||
# --purge-conversation — 디스크의 conversation artifact 까지 삭제.
|
||||
# status=terminated, resumable=false 로 전이하며
|
||||
@@ -32,7 +34,7 @@ set -euo pipefail
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_lib_sh="$(cd "$_script_dir/../.." 2>/dev/null || pwd)/lib.sh"
|
||||
_lib_sh="$(cd "$_script_dir/../.." && pwd)/lib.sh"
|
||||
[ -f "$_lib_sh" ] || _lib_sh="${WORKSPACE_ROOT:-$PWD}/.agents/skills/lib.sh"
|
||||
source "$_lib_sh"
|
||||
|
||||
@@ -43,8 +45,9 @@ Usage: $0 --session <name> [--agent claude|agy|hermes|cline] [--reason <reason>]
|
||||
|
||||
Arguments:
|
||||
--session <name> — target session name (required)
|
||||
--agent <type> — claude | agy | hermes | cline
|
||||
(inferred from the session-name suffix when omitted)
|
||||
--agent <type> — claude | agy | hermes | cline (recommended: always pass it)
|
||||
(falls back to the registry record: agent field ->
|
||||
session-name suffix -> pane.cmd)
|
||||
--reason <reason> — stop_reason field (default: manual_stop)
|
||||
--purge-conversation — also delete on-disk conversation artifacts;
|
||||
status becomes terminated and resume is impossible
|
||||
@@ -97,15 +100,15 @@ fi
|
||||
HERDR_SESSION_NAME="$(resolve_herdr_workspace "$SESSION_NAME" "${WORKSPACE:-$WORKSPACE_ROOT}")"
|
||||
export HERDR_SESSION_NAME
|
||||
|
||||
# --agent 미지정 시 이름 suffix 로 fallback (P1-F)
|
||||
# --agent 미지정 시 레지스트리 기록으로 해석 (B-21).
|
||||
# ① row['agent'] → ② 세션명 접미사 → ③ pane.cmd 순. 셋 다 실패하면
|
||||
# 종전과 동일하게 exit 2 (헤더 :27-30 의 종료 코드 계약 유지).
|
||||
if [ -z "$AGENT" ]; then
|
||||
case "$SESSION_NAME" in
|
||||
*-creator-claude|*-planner-claude|*-reviewer-claude) AGENT=claude ;;
|
||||
*-creator-agy|*-planner-agy|*-reviewer-agy) AGENT=agy ;;
|
||||
*-creator-hermes|*-planner-hermes|*-reviewer-hermes) AGENT=hermes ;;
|
||||
*-creator-cline|*-planner-cline|*-reviewer-cline) AGENT=cline ;;
|
||||
*) echo "ERROR: cannot infer agent from '$SESSION_NAME'; pass --agent" >&2; exit 2 ;;
|
||||
esac
|
||||
AGENT="$(resolve_agent_type_from_registry "$SESSION_NAME")" || AGENT=""
|
||||
[ -n "$AGENT" ] || {
|
||||
echo "ERROR: cannot infer agent from '$SESSION_NAME'; pass --agent" >&2
|
||||
exit 2
|
||||
}
|
||||
fi
|
||||
|
||||
# 세션이 YAML 에 있는지 + 해당 row 의 워크스페이스 cwd 및 delegate_job_id 추출.
|
||||
|
||||
Reference in New Issue
Block a user