feat(agents): expose MAM_ID_POST_DISCOVERED in facts bridge (Issue #68)
This commit is contained in:
1 parent
b9c828f092
commit
5305cf21f9
2 files changed
+54
No files matched your search
@@ -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