feat(a4,c3b): complete A-4 Phase 2 agent knowledge migration & Option B isolation removal

- Option B / C-3b: Deprecate isolation.root and remove its 4 legacy consumers in lib.sh, workspace_uuid.py, verify_session.py, and stop_session.sh.
- M2~M7 Migration: Implement artifact_path, verify_artifact, purge_artifacts, spawn_spec, resume_spec, auth_ok, discover, ready_tokens, exit_key, and delegate_agent_key across BaseAgentAdapter and all 4 adapters (Claude, Agy, Hermes, Cline).
- Migrate shell duplications in lib.sh, create_session.sh, resume_session.sh, stop_session.sh, and reconcile.sh to python -m lib_py.agents facts.
- Hardening & Corrections: Fix Cline resume_spec flag to '-i --id', apply shlex.quote across all facts variables with MAM_ prefix, add safe fallback in wait_for_tui_ready.
- Add comprehensive contract tests in tests/test_a4_adapter_contract.py and sync IMPROVEMENTS.md / LOG.md.
- Verified: 100% PASS across unit, component, contract, and integration tests.
This commit is contained in:
2026-08-16 23:15:24 +09:00
parent 971f14ad3f
commit b4821fafa8
21 changed files with 904 additions and 531 deletions
-38
View File
@@ -342,44 +342,6 @@ def test_t10_resume_workspace_paths(mam_sandbox, mock_herdr, mock_agents):
assert f"would spawn:" in res.stdout
def test_t11_legacy_isolation_row(mam_sandbox, mock_herdr, mock_agents):
"""T-11: legacy isolation row resolved from isolation.root"""
iso_root = str(mam_sandbox / "iso_root")
ws = str(mam_sandbox / "iso_ws")
os.makedirs(ws, exist_ok=True)
ws_key = os.path.realpath(ws).replace("/", "-").replace("_", "-")
proj_dir = os.path.join(iso_root, "projects", ws_key)
os.makedirs(proj_dir, exist_ok=True)
u_val = str(uuid.uuid4())
with open(os.path.join(proj_dir, f"{u_val}.jsonl"), "w") as f:
f.write(json.dumps({"type": "queue-operation", "sessionId": u_val}) + "\n")
f.write(json.dumps({"type": "user", "sessionId": u_val, "cwd": ws}) + "\n")
mutation = f"""
entry = {{
'name': 'iso-session',
'status': 'stopped',
'role': 'creator',
'claude_session_id_own': '{u_val}',
'isolation': {{'root': '{iso_root}', 'uuid': 'iso-uuid-1'}},
'pane': {{'cwd': '{ws}'}}
}}
d.setdefault('herdr_sessions', []).append(entry)
"""
res_m = run_mutation(mam_sandbox, mutation)
assert res_m.returncode == 0, f"mutation failed: {res_m.stderr}"
resolve_script = mam_sandbox / ".agents" / "skills" / "multi-agent-mux-resume" / "scripts" / "resolve_session_id.sh"
cmd = [
"bash", str(resolve_script),
"--workspace", ws,
"--agent", "claude",
"--session", "iso-session"
]
res = subprocess.run(cmd, capture_output=True, text=True, cwd=str(mam_sandbox))
assert res.returncode == 0
assert res.stdout.strip() == u_val
def test_t12_other_workspace_assigned_row_revalidate_fails(mam_sandbox):