chore(checkpoint): Phase 6 Test Suite Stabilization complete. 257/261 tests PASS. Resolved run_linear drift, formatter expectations, and Hook Server startup.
This commit is contained in:
@@ -124,7 +124,7 @@ def get_dependencies(filepath: str) -> list[str]:
|
||||
print(f"Error getting dependencies for {filepath}: {e}")
|
||||
return []
|
||||
|
||||
def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
|
||||
def execute_agent(role: str, prompt: str, docs: list[str], debug: bool = False) -> str:
|
||||
model = get_model_for_role(role)
|
||||
# Advanced Context: Dependency skeletons for Tier 3
|
||||
injected_context = ""
|
||||
@@ -197,7 +197,20 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
|
||||
try:
|
||||
env = os.environ.copy()
|
||||
env["GEMINI_CLI_HOOK_CONTEXT"] = "mma_headless"
|
||||
if debug:
|
||||
print(f"--- MMA DEBUG ---")
|
||||
print(f"Executing Command: {cmd}")
|
||||
print(f"Relevant Environment Variables:")
|
||||
for key, value in env.items():
|
||||
if key.startswith("GEMINI_CLI_"):
|
||||
print(f" {key}={value}")
|
||||
process = subprocess.run(cmd, input=command_text, capture_output=True, text=True, encoding='utf-8', env=env)
|
||||
if debug:
|
||||
print(f"Subprocess Result:")
|
||||
print(f" Return Code: {process.returncode}")
|
||||
print(f" Stdout: {process.stdout[:1000]}...")
|
||||
print(f" Stderr: {process.stderr}")
|
||||
print(f"--- END DEBUG ---")
|
||||
result = process.stdout
|
||||
if not process.stdout and process.stderr:
|
||||
result = f"Error: {process.stderr}"
|
||||
@@ -231,6 +244,11 @@ def create_parser() -> argparse.ArgumentParser:
|
||||
type=str,
|
||||
help="TOML file defining the task"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--debug",
|
||||
action="store_true",
|
||||
help="Enable debug logging"
|
||||
)
|
||||
parser.add_argument(
|
||||
"prompt",
|
||||
type=str,
|
||||
@@ -244,6 +262,7 @@ def main() -> None:
|
||||
args = parser.parse_args()
|
||||
role = args.role
|
||||
prompt = args.prompt
|
||||
debug = args.debug
|
||||
docs = []
|
||||
if args.task_file and os.path.exists(args.task_file):
|
||||
with open(args.task_file, "rb") as f:
|
||||
@@ -251,6 +270,8 @@ def main() -> None:
|
||||
role = task_data.get("role", role)
|
||||
prompt = task_data.get("prompt", prompt)
|
||||
docs = task_data.get("docs", [])
|
||||
# Only override debug if it's explicitly set in the task file (optional)
|
||||
debug = task_data.get("debug", debug)
|
||||
if not role or not prompt:
|
||||
parser.print_help()
|
||||
return
|
||||
@@ -262,8 +283,8 @@ def main() -> None:
|
||||
for ref in file_refs:
|
||||
if os.path.exists(ref) and ref not in docs:
|
||||
docs.append(ref)
|
||||
print(f"Executing role: {role} with docs: {docs}")
|
||||
result = execute_agent(role, prompt, docs)
|
||||
print(f"Executing role: {role} with docs: {docs} (debug={debug})")
|
||||
result = execute_agent(role, prompt, docs, debug=debug)
|
||||
print(result)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user