feat(loop): complete Issue #5 Phase 4 immutable runtime and freeze removal
- Implement eager module loading (lib_py.loop.eager) to preload all framework dependencies into sys.modules and enforce PYTHONDONTWRITEBYTECODE=1. - Synchronize runtime protocol version with MAM_VERSION constant (4.3.0). - Bypass /tmp/mam-loop-freeze.XXXXXX copy overhead by default in Python mode while preserving legacy rollback fallback (MAM_LOOP_PY=0 / MAM_LOOP_FREEZE=1). - Add tests/test_issue5_phase4_runtime.py verifying eager import completeness, mid-flight code modification immunity (B-13), and freeze bypass. - Pass full test suite (749 tests, 0 failures).
This commit is contained in:
1 parent
8cd256cc7a
commit
f413f6ada6
6 files changed
+390
-11
No files matched your search
@@ -8,6 +8,7 @@ while using fence-aware strict verdict parsing and atomic checkpointing.
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import atexit
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
@@ -21,7 +22,7 @@ import time
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from lib_py.loop import checkpoint, parser
|
||||
from lib_py.loop import checkpoint, eager, parser
|
||||
|
||||
# ANSI colors matching run_loop.sh
|
||||
_COLOR_INFO = "\033[1;34m[*]\033[0m"
|
||||
@@ -50,6 +51,9 @@ class LoopRunner:
|
||||
"""Orchestrates planning, code implementation, and multi-agent peer reviews."""
|
||||
|
||||
def __init__(self, argv: Optional[List[str]] = None):
|
||||
# Eagerly load all required framework modules to ensure immutable runtime (Phase 4)
|
||||
eager.eager_load()
|
||||
|
||||
self.raw_argv = list(argv) if argv is not None else sys.argv[1:]
|
||||
self.workspace_root = Path(os.environ.get("MAM_REAL_ROOT") or os.environ.get("WORKSPACE_ROOT") or Path.cwd()).resolve()
|
||||
self.mam_dir = self.workspace_root / ".mam"
|
||||
@@ -372,7 +376,6 @@ class LoopRunner:
|
||||
def run(self) -> int:
|
||||
self.parse_args()
|
||||
|
||||
import atexit
|
||||
atexit.register(self.release_guard)
|
||||
|
||||
# Signal handling
|
||||
|
||||
Reference in new issue
Block a user