Compare commits

..

4 Commits

20 changed files with 175 additions and 87 deletions

View File

@@ -1,4 +1,4 @@
from __future__ import annotations
from __future__ import annotations
import requests
import json
import time
@@ -60,7 +60,7 @@ class ApiHookClient:
"""Checks the health of the hook server."""
url = f"{self.base_url}/status"
try:
response = requests.get(url, timeout=0.2)
response = requests.get(url, timeout=5.0)
response.raise_for_status()
return response.json()
except Exception:
@@ -242,3 +242,4 @@ class ApiHookClient:
data={'type': 'tool_approval', 'tool': tool_name, 'args': args},
timeout=60.0)
return res.get('response')

View File

@@ -1,4 +1,4 @@
from __future__ import annotations
from __future__ import annotations
import json
import threading
import uuid
@@ -9,14 +9,12 @@ import session_logger
class HookServerInstance(ThreadingHTTPServer):
"""Custom HTTPServer that carries a reference to the main App instance."""
def __init__(self, server_address: tuple[str, int], RequestHandlerClass: type, app: Any) -> None:
def __init__(self, server_address: tuple[str, int], RequestHandlerClass: type, app: Any) -> None:
super().__init__(server_address, RequestHandlerClass)
self.app = app
class HookHandler(BaseHTTPRequestHandler):
"""Handles incoming HTTP requests for the API hooks."""
def do_GET(self) -> None:
app = self.server.app
session_logger.log_api_hook("GET", self.path, "")
@@ -84,7 +82,7 @@ class HookHandler(BaseHTTPRequestHandler):
"action": "custom_callback",
"callback": get_val
})
if event.wait(timeout=2):
if event.wait(timeout=60):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
@@ -110,7 +108,7 @@ class HookHandler(BaseHTTPRequestHandler):
"action": "custom_callback",
"callback": get_val
})
if event.wait(timeout=2):
if event.wait(timeout=60):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
@@ -137,7 +135,7 @@ class HookHandler(BaseHTTPRequestHandler):
"action": "custom_callback",
"callback": get_mma
})
if event.wait(timeout=2):
if event.wait(timeout=60):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
@@ -164,7 +162,7 @@ class HookHandler(BaseHTTPRequestHandler):
"action": "custom_callback",
"callback": check_all
})
if event.wait(timeout=2):
if event.wait(timeout=60):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
@@ -318,3 +316,5 @@ class HookServer:
if self.thread:
self.thread.join()
logging.info("Hook server stopped")

View File

@@ -9,6 +9,7 @@ This file tracks all major tracks for the project. Each track has its own detail
---
- [~] **Track: AI-Optimized Python Style Refactor**
- [x] **Track: AI-Optimized Python Style Refactor**
*Link: [./tracks/python_style_refactor_20260227/](./tracks/python_style_refactor_20260227/)*

View File

@@ -40,16 +40,18 @@
- [x] Task: Conductor - User Manual Verification 'Phase 5: Ultra-Compact Indentation Refactor'
## Phase 6: Test Suite Stabilization (High-Signal Reporting)
## Phase 6: Test Suite Stabilization (High-Signal Reporting) [checkpoint: 3b96b67]
- [x] Task: Conductor - Resolve API/Method name drift (e.g., `run_linear` -> `run` in ConductorEngine).
- **Requirement:** Implement "Before vs After" state tables in `logs/test/unique_signature/<script_name>.txt`.
- [x] Task: Conductor - Fix `ai_style_formatter.py` test expectations for ultra-compact style.
- **Requirement:** Log table-based comparison of code states in `logs/test/unique_signature/test_ai_style_formatter.txt`.
- [x] Task: Conductor - Align `tier4_interceptor.py` tests with current PowerShell output formatting.
- **Requirement:** Log expected vs actual PowerShell output mappings in `logs/test/unique_signature/test_tier4_interceptor.txt`.
- [ ] Task: Conductor - Investigate and stabilize `live_gui` test environment collection/startup.
- [x] Task: Conductor - Investigate and stabilize `live_gui` test environment collection/startup. 173ea96
- **Requirement:** Log comprehensive environment telemetry (Before/After/Delta) in `logs/test/unique_signature/live_gui_diag.txt`.
- [ ] Task: Conductor - User Manual Verification 'Phase 6: Test Suite Stabilization'
- [x] Task: Conductor - User Manual Verification 'Phase 6: Test Suite Stabilization'

View File

@@ -22,7 +22,7 @@ paths = [
"C:\\projects\\manual_slop\\tests\\temp_livetoolssim.toml",
"C:\\projects\\manual_slop\\tests\\temp_liveexecutionsim.toml",
]
active = "C:\\projects\\manual_slop\\tests\\temp_liveexecutionsim.toml"
active = "C:\\projects\\manual_slop\\tests\\temp_project.toml"
[gui.show_windows]
"Context Hub" = true

1
hello.ps1 Normal file
View File

@@ -0,0 +1 @@
Write-Host "Simulation Test"

View File

@@ -79,7 +79,7 @@ DockId=0x0000000F,2
[Window][Theme]
Pos=0,17
Size=393,824
Size=632,824
Collapsed=0
DockId=0x00000005,1
@@ -89,14 +89,14 @@ Size=900,700
Collapsed=0
[Window][Diagnostics]
Pos=395,17
Size=734,545
Pos=634,17
Size=911,643
Collapsed=0
DockId=0x00000010,0
[Window][Context Hub]
Pos=0,17
Size=393,824
Size=632,824
Collapsed=0
DockId=0x00000005,0
@@ -107,26 +107,26 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=1131,17
Size=549,1183
Pos=1547,17
Size=879,1395
Collapsed=0
DockId=0x00000004,0
[Window][Operations Hub]
Pos=395,17
Size=734,545
Pos=634,17
Size=911,643
Collapsed=0
DockId=0x00000010,1
[Window][Files & Media]
Pos=0,843
Size=393,357
Size=632,569
Collapsed=0
DockId=0x00000006,1
[Window][AI Settings]
Pos=0,843
Size=393,357
Size=632,569
Collapsed=0
DockId=0x00000006,0
@@ -136,14 +136,14 @@ Size=416,325
Collapsed=0
[Window][MMA Dashboard]
Pos=395,564
Size=734,636
Pos=634,662
Size=911,750
Collapsed=0
DockId=0x00000011,0
[Window][Log Management]
Pos=1131,17
Size=549,1183
Pos=1547,17
Size=879,1395
Collapsed=0
DockId=0x00000004,1
@@ -163,24 +163,30 @@ Column 4 Weight=0.6084
Column 5 Weight=0.4425
Column 6 Weight=1.0079
[Table][0x5D780033,4]
Column 0 Weight=1.0000
Column 1 Weight=1.0000
Column 2 Weight=1.0000
Column 3 Weight=1.0000
[Docking][Data]
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,17 Size=1680,1183 Split=Y
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,17 Size=2426,1395 Split=Y
DockNode ID=0x0000000C Parent=0xAFC85805 SizeRef=1362,1041 Split=X Selected=0x5D11106F
DockNode ID=0x00000003 Parent=0x0000000C SizeRef=1129,1183 Split=X
DockNode ID=0x00000003 Parent=0x0000000C SizeRef=1545,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=Y Selected=0xF4139CA2
DockNode ID=0x00000002 Parent=0x0000000B SizeRef=1029,1119 Split=X Selected=0xF4139CA2
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=393,858 Split=Y Selected=0x8CA2375C
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=632,858 Split=Y Selected=0x8CA2375C
DockNode ID=0x00000005 Parent=0x00000007 SizeRef=295,824 Selected=0xF4139CA2
DockNode ID=0x00000006 Parent=0x00000007 SizeRef=295,724 CentralNode=1 Selected=0x7BD57D6A
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=734,858 Split=Y Selected=0x418C7449
DockNode ID=0x00000010 Parent=0x0000000E SizeRef=868,545 Selected=0xB4CBF21A
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=911,858 Split=Y Selected=0x418C7449
DockNode ID=0x00000010 Parent=0x0000000E SizeRef=868,545 Selected=0x418C7449
DockNode ID=0x00000011 Parent=0x0000000E SizeRef=868,636 Selected=0x3AEC3498
DockNode ID=0x00000001 Parent=0x0000000B SizeRef=1029,775 Selected=0x8B4EBFA6
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6
DockNode ID=0x00000004 Parent=0x0000000C SizeRef=549,1183 Selected=0x6F2B5B04
DockNode ID=0x00000004 Parent=0x0000000C SizeRef=879,1183 Selected=0x6F2B5B04
DockNode ID=0x0000000F Parent=0xAFC85805 SizeRef=1362,451 Selected=0xDD6419BC
;;;<<<Layout_655921752_Default>>>;;;

View File

@@ -8,5 +8,5 @@ active = "main"
[discussions.main]
git_commit = ""
last_updated = "2026-02-28T19:35:01"
last_updated = "2026-02-28T20:41:51"
history = []

View File

@@ -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__":

View File

@@ -5,6 +5,8 @@ import requests
import os
import signal
import sys
import datetime
from pathlib import Path
from typing import Generator, Any
# Ensure project root is in path
@@ -20,15 +22,45 @@ def reset_ai_client() -> Generator[None, None, None]:
ai_client.set_provider("gemini", "gemini-2.5-flash-lite")
yield
class VisualLogger:
def log_state(self, label: str, before: Any, after: Any) -> None:
print(f"[STATE] {label}: {before} -> {after}")
def finalize(self, title: str, status: str, result: str) -> None:
print(f"[FINAL] {title}: {status} - {result}")
class VerificationLogger:
"""High-signal reporting for automated tests, inspired by Unreal Engine's diagnostic style."""
def __init__(self, test_name: str, script_name: str):
self.test_name = test_name
self.script_name = script_name
self.logs_dir = Path(f"logs/test/{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}")
self.logs_dir.mkdir(parents=True, exist_ok=True)
self.log_file = self.logs_dir / f"{script_name}.txt"
self.entries = []
def log_state(self, field: str, before: Any, after: Any, delta: Any = None):
self.entries.append({
"Field": field,
"Before": str(before),
"After": str(after),
"Delta": str(delta) if delta is not None else ""
})
# Also print to stdout for real-time visibility in CI
print(f"[STATE] {field}: {before} -> {after}")
def finalize(self, description: str, status: str, result_msg: str):
with open(self.log_file, "a", encoding="utf-8") as f:
f.write(f"[ Test: {self.test_name} ]\n")
f.write(f"({description})\n\n")
f.write(f"{self.test_name}: before vs after\n")
f.write(f"{'Field':<25} {'Before':<20} {'After':<20} {'Delta':<15}\n")
f.write("-" * 80 + "\n")
for e in self.entries:
f.write(f"{e['Field']:<25} {e['Before']:<20} {e['After']:<20} {e['Delta']:<15}\n")
f.write("-" * 80 + "\n")
f.write(f"{status} {self.test_name} ({result_msg})\n\n")
print(f"[FINAL] {self.test_name}: {status} - {result_msg}")
@pytest.fixture
def vlogger() -> VisualLogger:
return VisualLogger()
def vlogger(request) -> VerificationLogger:
"""Fixture to provide a VerificationLogger instance to a test."""
test_name = request.node.name
script_name = Path(request.node.fspath).stem
return VerificationLogger(test_name, script_name)
def kill_process_tree(pid: int | None) -> None:
"""Robustly kills a process and all its children."""
@@ -53,8 +85,19 @@ def kill_process_tree(pid: int | None) -> None:
def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
"""
Session-scoped fixture that starts gui_2.py with --enable-test-hooks.
Includes high-signal environment telemetry.
"""
gui_script = "gui_2.py"
diag = VerificationLogger("live_gui_startup", "live_gui_diag")
diag.log_state("GUI Script", "N/A", gui_script)
# Check if already running (shouldn't be)
try:
resp = requests.get("http://127.0.0.1:8999/status", timeout=0.1)
already_up = resp.status_code == 200
except: already_up = False
diag.log_state("Hook Server Port 8999", "Down", "UP" if already_up else "Down")
print(f"\n[Fixture] Starting {gui_script} --enable-test-hooks...")
os.makedirs("logs", exist_ok=True)
log_file = open(f"logs/{gui_script.replace('.', '_')}_test.log", "w", encoding="utf-8")
@@ -65,7 +108,10 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
text=True,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if os.name == 'nt' else 0
)
max_retries = 15 # Slightly more time for gui_2
diag.log_state("GUI Process PID", "N/A", process.pid)
max_retries = 15
ready = False
print(f"[Fixture] Waiting up to {max_retries}s for Hook Server on port 8999...")
start_time = time.time()
@@ -81,10 +127,18 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
print(f"[Fixture] {gui_script} process died unexpectedly during startup.")
break
time.sleep(0.5)
diag.log_state("Startup Success", "N/A", str(ready))
diag.log_state("Startup Time", "N/A", f"{round(time.time() - start_time, 2)}s")
if not ready:
diag.finalize("Live GUI Startup Telemetry", "FAIL", "Hook server failed to respond.")
print(f"[Fixture] TIMEOUT/FAILURE: Hook server for {gui_script} failed to respond.")
kill_process_tree(process.pid)
pytest.fail(f"Failed to start {gui_script} with test hooks.")
diag.finalize("Live GUI Startup Telemetry", "PASS", "Hook server successfully initialized.")
try:
yield process, gui_script
finally:

View File

@@ -4,11 +4,12 @@ if '"role": "tool"' in prompt:
print(json.dumps({"type": "message", "role": "assistant", "content": "Tool worked!"}), flush=True)
print(json.dumps({"type": "result", "stats": {"total_tokens": 20}}), flush=True)
else:
# We must call the bridge to trigger the GUI approval!
# We must call the bridge to trigger the GUI approval!
tool_call = {"name": "list_directory", "input": {"dir_path": "."}}
bridge_cmd = [sys.executable, "C:/projects/manual_slop/scripts/cli_tool_bridge.py"]
proc = subprocess.Popen(bridge_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
stdout, _ = proc.communicate(input=json.dumps(tool_call))
# Even if bridge says allow, we emit the tool_use to the adapter
print(json.dumps({"type": "message", "role": "assistant", "content": "I will list the directory."}), flush=True)
print(json.dumps({

View File

@@ -10,5 +10,5 @@ auto_add = true
[discussions.main]
git_commit = ""
last_updated = "2026-02-28T07:35:03"
last_updated = "2026-02-28T20:39:12"
history = []

View File

@@ -6,10 +6,10 @@ roles = [
"Reasoning",
]
history = []
active = "TestDisc_1772282083"
active = "TestDisc_1772329132"
auto_add = true
[discussions.TestDisc_1772282083]
[discussions.TestDisc_1772329132]
git_commit = ""
last_updated = "2026-02-28T07:34:56"
last_updated = "2026-02-28T20:39:05"
history = []

View File

@@ -10,5 +10,5 @@ auto_add = true
[discussions.main]
git_commit = ""
last_updated = "2026-02-28T19:35:01"
last_updated = "2026-02-28T20:41:54"
history = []

View File

@@ -10,5 +10,5 @@ auto_add = true
[discussions.main]
git_commit = ""
last_updated = "2026-02-28T07:35:20"
last_updated = "2026-02-28T20:39:30"
history = []

View File

@@ -15,6 +15,8 @@ output_dir = "./md_gen"
base_dir = "."
paths = []
[files.tier_assignments]
[screenshots]
base_dir = "."
paths = []

View File

@@ -5,18 +5,10 @@ roles = [
"System",
"Reasoning",
]
active = "AutoDisc"
active = "main"
auto_add = true
[discussions.main]
git_commit = ""
last_updated = "2026-02-27T18:58:03"
history = [
"@2026-02-27T18:57:55\nUser:\nHello! This is an automated test. Just say 'Acknowledged'.",
"@2026-02-27T18:58:02\nAI:\nAcknowledged",
]
[discussions.AutoDisc]
git_commit = ""
last_updated = "2026-02-28T07:34:41"
last_updated = "2026-02-28T20:41:57"
history = []

View File

@@ -1,4 +1,4 @@
import pytest
import pytest
import time
import os
import sys
@@ -86,7 +86,7 @@ else:
client.set_value("ai_input", "Test parameter aliases")
client.click("btn_gen_send")
# Handle approval
timeout = 15
timeout = 60
start_time = time.time()
approved = False
while time.time() - start_time < timeout:
@@ -124,7 +124,7 @@ def test_gemini_cli_loop_termination(live_gui: Any) -> None:
client.set_value("ai_input", "Perform multi-round tool test")
client.click("btn_gen_send")
# Handle approvals (mock does one tool call)
timeout = 20
timeout = 60
start_time = time.time()
approved = False
while time.time() - start_time < timeout:
@@ -148,3 +148,4 @@ def test_gemini_cli_loop_termination(live_gui: Any) -> None:
if found_final: break
time.sleep(1)
assert found_final, "Final message after multi-round tool loop not found"

View File

@@ -1,4 +1,4 @@
from typing import Any
from typing import Any
import pytest
import time
import os
@@ -36,7 +36,7 @@ def test_gemini_cli_full_integration(live_gui: Any) -> None:
client.click("btn_gen_send")
# 3. Monitor for approval events
print("[TEST] Waiting for approval events...")
timeout = 45
timeout = 90
start_time = time.time()
approved_count = 0
while time.time() - start_time < timeout:
@@ -89,7 +89,7 @@ def test_gemini_cli_rejection_and_history(live_gui: Any) -> None:
client.set_value("ai_input", "Deny me")
client.click("btn_gen_send")
# 3. Wait for event and reject
timeout = 20
timeout = 60
start_time = time.time()
denied = False
while time.time() - start_time < timeout:
@@ -120,3 +120,4 @@ def test_gemini_cli_rejection_and_history(live_gui: Any) -> None:
if rejection_found: break
time.sleep(1.0)
assert rejection_found, "Rejection message not found in history"

View File

@@ -0,0 +1,5 @@
import pytest
def test_vlogger_available(vlogger):
vlogger.log_state("Test", "Before", "After")
vlogger.finalize("Test Title", "PASS", "Test Result")