feat(agent): add full codex agent support (v4.2.0)
- Implement CodexAdapter in lib_py/agents/adapters/codex.py with safe flags and TUI readiness - Extend create_session, resume_session, stop_session, and reconcile for codex CLI - Support codex agent delegation and loop integration across all multi-agent skills - Add unit, component, and contract test suites for codex integration - Verify all 462 tests passing cleanly
This commit is contained in:
1 parent
de0a9c2e81
commit
76f10b2096
45 files changed
+2045
-276
No files matched your search
@@ -960,18 +960,18 @@ def test_grok_shell_and_scripts_integration(mam_sandbox):
|
||||
lib_path = mam_sandbox / "skills" / "lib.sh"
|
||||
lib_content = lib_path.read_text()
|
||||
assert '*-creator-grok|*-planner-grok|*-reviewer-grok) kind="grok"' in lib_content
|
||||
assert "'claude', 'agy', 'hermes', 'grok', 'opencode'" in lib_content
|
||||
assert "'claude', 'agy', 'hermes', 'grok', 'opencode', 'codex'" in lib_content
|
||||
assert '[[ "$sess" =~ "grok" ]]' in lib_content
|
||||
|
||||
# 2. create_session.sh validation
|
||||
create_path = mam_sandbox / "skills" / "multi-agent-mux-create" / "scripts" / "create_session.sh"
|
||||
create_content = create_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode)' in create_content
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in create_content
|
||||
|
||||
# 3. stop_session.sh validation & state capture
|
||||
stop_path = mam_sandbox / "skills" / "multi-agent-mux-stop" / "scripts" / "stop_session.sh"
|
||||
stop_content = stop_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode)' in stop_content
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in stop_content
|
||||
assert "target['grok_session_id_own'] = captured" in stop_content
|
||||
|
||||
# 4. workspace_uuid OWN_KEY
|
||||
@@ -986,12 +986,12 @@ def test_opencode_shell_and_scripts_integration(mam_sandbox):
|
||||
lib_path = mam_sandbox / "skills" / "lib.sh"
|
||||
lib_content = lib_path.read_text()
|
||||
assert '*-creator-opencode|*-planner-opencode|*-reviewer-opencode) kind="opencode"' in lib_content
|
||||
assert "'claude', 'agy', 'hermes', 'grok', 'opencode'" in lib_content
|
||||
assert "'claude', 'agy', 'hermes', 'grok', 'opencode', 'codex'" in lib_content
|
||||
|
||||
# 2. create_session.sh validation & OPENCODE_PERMISSION behavior (unset & preset)
|
||||
create_path = mam_sandbox / "skills" / "multi-agent-mux-create" / "scripts" / "create_session.sh"
|
||||
create_content = create_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode)' in create_content
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in create_content
|
||||
# Test unset path
|
||||
env_unset = {k: v for k, v in os.environ.items() if k != "OPENCODE_PERMISSION"}
|
||||
res_c_unset = subprocess.run(
|
||||
@@ -1030,7 +1030,7 @@ def test_opencode_shell_and_scripts_integration(mam_sandbox):
|
||||
# 4. stop_session.sh validation & state capture
|
||||
stop_path = mam_sandbox / "skills" / "multi-agent-mux-stop" / "scripts" / "stop_session.sh"
|
||||
stop_content = stop_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode)' in stop_content
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in stop_content
|
||||
assert "target['opencode_session_id_own'] = captured" in stop_content
|
||||
|
||||
# 5. workspace_uuid OWN_KEY
|
||||
@@ -1044,6 +1044,55 @@ def test_opencode_shell_and_scripts_integration(mam_sandbox):
|
||||
assert 'op_adapter = get_adapter(\'opencode\')' in recon_content
|
||||
|
||||
|
||||
def test_codex_shell_and_scripts_integration(mam_sandbox):
|
||||
"""Verify lib.sh, create_session.sh, stop_session.sh, and workspace_uuid contain codex."""
|
||||
# 1. lib.sh kind mapping & binaries
|
||||
lib_path = mam_sandbox / "skills" / "lib.sh"
|
||||
lib_content = lib_path.read_text()
|
||||
assert '*-creator-codex|*-planner-codex|*-reviewer-codex)' in lib_content
|
||||
assert "'claude', 'agy', 'hermes', 'grok', 'opencode', 'codex'" in lib_content
|
||||
|
||||
# 2. create_session.sh validation
|
||||
create_path = mam_sandbox / "skills" / "multi-agent-mux-create" / "scripts" / "create_session.sh"
|
||||
create_content = create_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in create_content
|
||||
|
||||
# 3. resume_session.sh validation
|
||||
resume_path = mam_sandbox / "skills" / "multi-agent-mux-resume" / "scripts" / "resume_session.sh"
|
||||
resume_content = resume_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in resume_content
|
||||
|
||||
# 4. stop_session.sh validation & state capture
|
||||
stop_path = mam_sandbox / "skills" / "multi-agent-mux-stop" / "scripts" / "stop_session.sh"
|
||||
stop_content = stop_path.read_text()
|
||||
assert 'claude|agy|hermes|grok|opencode|codex)' in stop_content
|
||||
assert "target['codex_session_id_own'] = captured" in stop_content
|
||||
|
||||
# 5. workspace_uuid OWN_KEY
|
||||
from lib_py.workspace_uuid import OWN_KEY
|
||||
assert OWN_KEY.get('codex') == 'codex_session_id_own'
|
||||
|
||||
# 6. reconcile.sh drift C block contains codex
|
||||
recon_path = mam_sandbox / "skills" / "multi-agent-mux-monitor" / "scripts" / "reconcile.sh"
|
||||
recon_content = recon_path.read_text()
|
||||
assert 'drift C (codex)' in recon_content
|
||||
|
||||
|
||||
def test_orc_onboard_codex_flag_tolerant_regex():
|
||||
"""Verify orc_onboard.sh flag-tolerant regex correctly extracts UUID from codex resume command."""
|
||||
import subprocess
|
||||
cmd_line = "codex resume --dangerously-bypass-approvals-and-sandbox 12345678-1234-1234-1234-123456789abc"
|
||||
sh_snippet = f'''
|
||||
cmd_line="{cmd_line}"
|
||||
detected_id=$(echo "$cmd_line" | grep -oE 'resume[[:space:]]+.*[0-9a-fA-F]{{8}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{12}}' | grep -oE '[0-9a-fA-F]{{8}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{12}}' | head -n 1 || true)
|
||||
echo "$detected_id"
|
||||
'''
|
||||
res = subprocess.run(["bash", "-c", sh_snippet], capture_output=True, text=True)
|
||||
assert res.returncode == 0
|
||||
assert res.stdout.strip() == "12345678-1234-1234-1234-123456789abc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user