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:
@@ -979,6 +979,34 @@ print(json.dumps(d, ensure_ascii=False))
|
||||
PYEOF
|
||||
}
|
||||
|
||||
# resolve_agent_type_from_registry <session_name>
|
||||
#
|
||||
# 레지스트리(YAML/DB)에 기록된 사실로 에이전트 종류를 해석한다. 우선순위는
|
||||
# lib_py.agents.registry.agent_of_row 의 계약을 그대로 따른다:
|
||||
# ① row['agent'] 명시 필드
|
||||
# ② 세션명 접미사 (*-{creator,planner,reviewer}-<agent> 및 *-<agent>)
|
||||
# ③ pane.cmd (정확히 일치하거나 .../<agent> 바이너리 경로)
|
||||
# 성공하면 에이전트명을 stdout 에 출력하고 0 을, 셋 다 실패하면 아무것도
|
||||
# 출력하지 않고 1 을 반환한다. 오류 메시지는 호출자가 소유한다 — 각 스크립트가
|
||||
# 문서화한 종료 코드를 그대로 유지하기 위해서다.
|
||||
#
|
||||
# NOTE: agent_of_row 의 match_cmd=True 는 "비-입양 조회" 계약이다. reconcile.sh
|
||||
# 입양 루프는 이 헬퍼를 쓰면 안 된다 (3aee63cf §1.2 실측 반증).
|
||||
resolve_agent_type_from_registry() {
|
||||
local name="$1"
|
||||
MAM_STATE_JSON="$(load_state_json)" SESSION_NAME="$name" python3 -c "
|
||||
import os, json, sys
|
||||
from lib_py.agents.registry import agent_of_row
|
||||
name = os.environ['SESSION_NAME']
|
||||
d = json.loads(os.environ.get('MAM_STATE_JSON', '{}'))
|
||||
row = next((s for s in d.get('herdr_sessions', []) if s.get('name') == name), {})
|
||||
resolved = agent_of_row(row, session_name=name)
|
||||
if not resolved:
|
||||
sys.exit(1)
|
||||
print(resolved)
|
||||
"
|
||||
}
|
||||
|
||||
# Despite the name (kept for caller compatibility — resume/stop/update_yaml_resumed
|
||||
# all do `HERDR_SESSION_NAME="$(resolve_herdr_workspace "$SESSION_NAME")"`), this
|
||||
# returns the isolated herdr *session* name to use for this MAM session row, not
|
||||
|
||||
Reference in New Issue
Block a user