worktree_prepare.sh 가 creator 를 기본으로 onboarding, create --no-onboard 가 ID 후발견 에이전트에 경고 (Issue #68) #79
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
# __main__.py — CLI bridge for lib_py.agents facts and resolution (N4)
|
# __main__.py — CLI bridge for lib_py.agents facts and resolution (N4)
|
||||||
|
|
||||||
import os, sys, json, shlex, time
|
import os, sys, json, shlex, time
|
||||||
|
from lib_py.agents.base import POST_DISCOVERED
|
||||||
from lib_py.agents.registry import get_adapter, own_key, agent_of_row
|
from lib_py.agents.registry import get_adapter, own_key, agent_of_row
|
||||||
|
|
||||||
# `purge auto` probes adapters in this order; opencode last because its
|
# `purge auto` probes adapters in this order; opencode last because its
|
||||||
@@ -71,6 +72,7 @@ def main():
|
|||||||
print(f"MAM_AGENT_STATUS_RELIABLE={1 if adapter.agent_status_reliable else 0}")
|
print(f"MAM_AGENT_STATUS_RELIABLE={1 if adapter.agent_status_reliable else 0}")
|
||||||
print(f"MAM_EXIT_KEY={q(adapter.exit_key)}")
|
print(f"MAM_EXIT_KEY={q(adapter.exit_key)}")
|
||||||
print(f"MAM_DELEGATE_AGENT_KEY={q(adapter.delegate_agent_key)}")
|
print(f"MAM_DELEGATE_AGENT_KEY={q(adapter.delegate_agent_key)}")
|
||||||
|
print(f"MAM_ID_POST_DISCOVERED={1 if adapter.id_lifecycle == POST_DISCOVERED else 0}")
|
||||||
|
|
||||||
elif cmd == 'resolve':
|
elif cmd == 'resolve':
|
||||||
name = sys.argv[2] if len(sys.argv) > 2 else ''
|
name = sys.argv[2] if len(sys.argv) > 2 else ''
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
"""Issue #68: worktree_prepare.sh onboards by default (--no-onboard skips), and
|
||||||
|
create_session.sh --no-onboard warns for post-discovered-id agents (adapter
|
||||||
|
id_lifecycle == POST_DISCOVERED).
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
SKILLS = REPO_ROOT / ".agents" / "skills"
|
||||||
|
if str(SKILLS) not in sys.path:
|
||||||
|
sys.path.insert(0, str(SKILLS))
|
||||||
|
|
||||||
|
from lib_py.agents.base import POST_DISCOVERED # noqa: E402
|
||||||
|
from lib_py.agents.registry import get_adapter # noqa: E402
|
||||||
|
|
||||||
|
ALL_AGENTS = ("claude", "agy", "hermes", "grok", "opencode", "codex")
|
||||||
|
EXPECTED_POST_DISCOVERED = {
|
||||||
|
"agy": 1,
|
||||||
|
"codex": 1,
|
||||||
|
"hermes": 1,
|
||||||
|
"opencode": 1,
|
||||||
|
"claude": 0,
|
||||||
|
"grok": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("agent", ALL_AGENTS)
|
||||||
|
def test_facts_expose_post_discovered(agent):
|
||||||
|
env = dict(os.environ, PYTHONPATH=f"{SKILLS}:{os.environ.get('PYTHONPATH', '')}")
|
||||||
|
res = subprocess.run(
|
||||||
|
[sys.executable, "-m", "lib_py.agents", "facts", agent],
|
||||||
|
capture_output=True, text=True, check=True, env=env,
|
||||||
|
)
|
||||||
|
eval_res = subprocess.run(
|
||||||
|
["bash", "-c", f"set -euo pipefail; eval {shlex.quote(res.stdout)}; echo \"$MAM_ID_POST_DISCOVERED\""],
|
||||||
|
capture_output=True, text=True, check=True,
|
||||||
|
)
|
||||||
|
val = int(eval_res.stdout.strip())
|
||||||
|
adapter = get_adapter(agent)
|
||||||
|
assert val == (1 if adapter.id_lifecycle == POST_DISCOVERED else 0)
|
||||||
|
assert val == EXPECTED_POST_DISCOVERED[agent]
|
||||||
Reference in new issue
Block a user