feat(mma): Implement logging/auditing for role hand-offs

This commit is contained in:
2026-02-25 20:16:56 -05:00
parent 25b904b404
commit 678fa89747
2 changed files with 34 additions and 0 deletions

View File

@@ -96,3 +96,22 @@ def test_get_dependencies(tmp_path):
filepath.write_text(content)
dependencies = get_dependencies(filepath)
assert dependencies == ['os', 'sys', 'file_cache', 'mcp_client']
import re
def test_execute_agent_logging(tmp_path):
log_file = tmp_path / "mma_delegation.log"
with patch("scripts.mma_exec.LOG_FILE", str(log_file)), \
patch("subprocess.run") as mock_run:
mock_process = MagicMock()
mock_process.stdout = ""
mock_process.returncode = 0
mock_run.return_value = mock_process
test_role = "tier1"
test_prompt = "Plan the next phase"
execute_agent(test_role, test_prompt, [])
assert log_file.exists()
log_content = log_file.read_text()
assert test_role in log_content
assert test_prompt in log_content
assert re.search(r"\d{4}-\d{2}-\d{2}", log_content)