Private
Public Access
0
0

artifacts

This commit is contained in:
2026-06-30 05:40:19 -04:00
parent f2054fbaf3
commit 670e255505
4 changed files with 359 additions and 0 deletions
@@ -0,0 +1,97 @@
"""Find the orphan by disabling each default-visible window in turn via API hook."""
import sys, time, subprocess, json, urllib.request, shutil
from pathlib import Path
PROJ = Path("C:/projects/manual_slop_tier2")
VISIBLE = [
"AI Settings",
"Diagnostics",
"Discussion Hub",
"Files & Media",
"Log Management",
"Operations Hub",
"Project Settings",
"Response",
"Theme",
]
def make_wrapper(visible):
return '''
import sys
sys.path.insert(0, "C:/projects/manual_slop_tier2")
sys.argv = ["sloppy.py", "--enable-test-hooks"]
from src.gui_2 import App as _App
_orig_init = _App.__init__
def _patched_init(self, *a, **kw):
_orig_init(self, *a, **kw)
for k in list(self.show_windows.keys()):
self.show_windows[k] = False
for k in %r:
if k in self.show_windows:
self.show_windows[k] = True
_App.__init__ = _patched_init
import argparse
from pathlib import Path
from src.paths import initialize_paths
initialize_paths(None)
from src.gui_2 import main as _sloppy_main
_sloppy_main()
''' % visible
def run_test(visible_subset, label, wait_after_health=6):
WORK = PROJ / "tests" / "artifacts" / f"diag4_{label}"
LOG = PROJ / "tests" / "artifacts" / f"diag4_{label}.log"
if WORK.exists():
shutil.rmtree(WORK)
WORK.mkdir(parents=True, exist_ok=True)
if LOG.exists():
LOG.unlink()
WRAP = PROJ / "tests" / "artifacts" / f"diag4_wrap_{label}.py"
WRAP.write_text(make_wrapper(visible_subset), encoding='utf-8')
proc = subprocess.Popen(
["uv", "run", "python", "-u", str(WRAP.absolute())],
stdout=open(LOG, "w"),
stderr=subprocess.STDOUT,
cwd=str(WORK),
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if sys.platform == "win32" else 0,
)
ready = False
for i in range(30):
time.sleep(0.5)
try:
urllib.request.urlopen("http://127.0.0.1:8999/status", timeout=1)
ready = True
break
except Exception:
pass
if not ready:
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
time.sleep(1)
return "NO_HOOK"
# Wait for first frame to render
time.sleep(wait_after_health)
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/gui_health", timeout=2)
body = json.loads(r.read().decode())
except Exception:
body = {"healthy": None}
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
time.sleep(1)
return "HEALTHY" if body.get("healthy") else f"DEGRADED: {body.get('degraded_reason', '')[:80]}"
print("BASELINE (all 9 visible):", flush=True)
print(f" -> {run_test(VISIBLE, 'all')}", flush=True)
for skip in VISIBLE:
visible_subset = [w for w in VISIBLE if w != skip]
print(f"DISABLE {skip}:", flush=True)
print(f" -> {run_test(visible_subset, f'skip_{skip.replace(chr(32), chr(95)).replace(chr(58), chr(95))}')}", flush=True)
@@ -0,0 +1,94 @@
"""Quick diagnostic: start sloppy.py as subprocess, hit /api/gui_health, print everything."""
import subprocess
import time
import json
import urllib.request
from pathlib import Path
PROJ = Path("C:/projects/manual_slop_tier2")
WORK = PROJ / "tests" / "artifacts" / "diag_workspace"
LOG = PROJ / "tests" / "artifacts" / "diag_sloppy.log"
# Clean workspace
import shutil
if WORK.exists():
shutil.rmtree(WORK)
WORK.mkdir(parents=True, exist_ok=True)
if LOG.exists():
LOG.unlink()
# Spawn
print(f"Starting sloppy.py in {WORK}...", flush=True)
proc = subprocess.Popen(
["uv", "run", "python", "-u", str(PROJ / "sloppy.py"), "--enable-test-hooks"],
stdout=open(LOG, "w"),
stderr=subprocess.STDOUT,
cwd=str(WORK),
)
print(f"PID: {proc.pid}", flush=True)
# Wait for hook server
ready = False
for i in range(30):
time.sleep(1.0)
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/status", timeout=2)
ready = True
print(f"Hook server ready after {i+1}s", flush=True)
print(f" /status: {r.read().decode()}", flush=True)
break
except Exception as e:
if i % 5 == 0:
print(f" waiting ({i+1}s)... {e.__class__.__name__}", flush=True)
if not ready:
print("Hook server never came up!", flush=True)
# Get health
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/gui_health", timeout=2)
body = r.read().decode()
print(f"\n/api/gui_health: {body}", flush=True)
data = json.loads(body)
print(f" healthy: {data.get('healthy')}", flush=True)
print(f" degraded_reason: {data.get('degraded_reason')!r}", flush=True)
print(f" last_assert: {data.get('last_assert')!r}", flush=True)
except Exception as e:
print(f"health check failed: {e}", flush=True)
# Get startup timeline
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/startup_timeline", timeout=2)
print(f"\n/api/startup_timeline: {r.read().decode()}", flush=True)
except Exception as e:
print(f"startup_timeline failed: {e}", flush=True)
# Get warmup status
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/warmup_status", timeout=2)
print(f"\n/api/warmup_status: {r.read().decode()}", flush=True)
except Exception as e:
print(f"warmup_status failed: {e}", flush=True)
# Give it another 5 seconds to render
print("\nWaiting 5s for first frame...", flush=True)
time.sleep(5)
# Re-check health
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/gui_health", timeout=2)
body = r.read().decode()
print(f"\n/api/gui_health (after 5s): {body}", flush=True)
except Exception as e:
print(f"re-check health failed: {e}", flush=True)
# Kill
print(f"\nKilling PID {proc.pid}...", flush=True)
try:
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], check=False)
except Exception as e:
print(f"taskkill failed: {e}", flush=True)
# Print log
print("\n=== STDOUT/STDERR LOG ===", flush=True)
print(LOG.read_text(encoding="utf-8", errors="replace"))
@@ -0,0 +1,101 @@
"""Diagnostic: disable each default-visible window one at a time, find which fixes the error."""
import sys, time, subprocess, json, urllib.request, shutil
from pathlib import Path
PROJ = Path("C:/projects/manual_slop_tier2")
# Default-visible windows per the diag log
VISIBLE = [
"AI Settings",
"Diagnostics",
"Discussion Hub",
"Files & Media",
"Log Management",
"Operations Hub",
"Project Settings",
"Response",
"Theme",
]
def make_wrapper(visible):
"""Build a wrapper that monkey-patches show_windows before App() is constructed."""
visible_set = set(visible)
return '''
import sys
sys.path.insert(0, "C:/projects/manual_slop_tier2")
sys.argv = ["sloppy.py", "--enable-test-hooks"]
from src.gui_2 import App as _App
_orig_init = _App.__init__
def _patched_init(self, *a, **kw):
_orig_init(self, *a, **kw)
for k in list(self.show_windows.keys()):
self.show_windows[k] = False
for k in %r:
if k in self.show_windows:
self.show_windows[k] = True
_App.__init__ = _patched_init
# Replicate sloppy.py main path
import argparse
from pathlib import Path
from src.paths import initialize_paths
initialize_paths(None)
from src.gui_2 import main as _sloppy_main
_sloppy_main()
''' % visible
def run_diag(visible_subset, label):
WORK = PROJ / "tests" / "artifacts" / f"diag3_{label}"
LOG = PROJ / "tests" / "artifacts" / f"diag3_{label}.log"
if WORK.exists():
shutil.rmtree(WORK)
WORK.mkdir(parents=True, exist_ok=True)
if LOG.exists():
LOG.unlink()
WRAP = PROJ / "tests" / "artifacts" / f"diag3_wrap_{label}.py"
WRAP.write_text(make_wrapper(visible_subset), encoding='utf-8')
proc = subprocess.Popen(
["uv", "run", "python", "-u", str(WRAP.absolute())],
stdout=open(LOG, "w"),
stderr=subprocess.STDOUT,
cwd=str(WORK),
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if sys.platform == "win32" else 0,
)
ready = False
for i in range(15):
time.sleep(0.5)
try:
urllib.request.urlopen("http://127.0.0.1:8999/status", timeout=1)
ready = True
break
except Exception:
pass
if not ready:
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
time.sleep(1)
return "NO_HOOK"
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/gui_health", timeout=2)
body = json.loads(r.read().decode())
except Exception:
body = {"healthy": None}
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
time.sleep(1)
return "HEALTHY" if body.get("healthy") else f"DEGRADED: {body.get('degraded_reason', '')[:60]}"
# Baseline: all 9 visible
print("BASELINE (all 9 visible):")
result = run_diag(VISIBLE, "all")
print(f" -> {result}")
# Disable each one
for skip in VISIBLE:
visible_subset = [w for w in VISIBLE if w != skip]
print(f"DISABLE {skip}:")
result = run_diag(visible_subset, f"skip_{skip.replace(' ', '_').replace(':', '')}")
print(f" -> {result}")
@@ -0,0 +1,67 @@
"""Find the exact unbalanced begin/end by monkey-patching imgui."""
import sys, json, time, subprocess, urllib.request, traceback
from pathlib import Path
PROJ = Path("C:/projects/manual_slop_tier2")
WORK = PROJ / "tests" / "artifacts" / "diag2_workspace"
LOG = PROJ / "tests" / "artifacts" / "diag2_sloppy.log"
import shutil
if WORK.exists():
shutil.rmtree(WORK)
WORK.mkdir(parents=True, exist_ok=True)
if LOG.exists():
LOG.unlink()
WRAPPER = PROJ / "tests" / "artifacts" / "diag2_wrapper.py"
# Wrapper content is pre-written; this script just runs it.
# Spawn the wrapper
print(f"Starting wrapper in {WORK}...", flush=True)
proc = subprocess.Popen(
["uv", "run", "python", "-u", str(WRAPPER.absolute())],
stdout=open(LOG, "w"),
stderr=subprocess.STDOUT,
cwd=str(WORK),
)
print(f"PID: {proc.pid}", flush=True)
# Wait for hook server
ready = False
for i in range(30):
time.sleep(1.0)
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/status", timeout=2)
ready = True
print(f"Hook server ready after {i+1}s", flush=True)
break
except Exception:
pass
if not ready:
print("Hook server never came up!", flush=True)
else:
# Get health
try:
r = urllib.request.urlopen("http://127.0.0.1:8999/api/gui_health", timeout=2)
body = r.read().decode()
print(f"health: {body}", flush=True)
except Exception as e:
print(f"health failed: {e}", flush=True)
time.sleep(3)
# Kill
print(f"\nKilling PID {proc.pid}...", flush=True)
subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], check=False)
# Print log (only the IMGUI lines)
print("\n=== IMGUI TRACE ===", flush=True)
content = LOG.read_text(encoding="utf-8", errors="replace")
for line in content.splitlines():
if "imgui-error" in line or "Missing End" in line or "MAIN_CALL" in line or "first frame" in line or "first _gui_func" in line:
print(line, flush=True)
# Also dump the FULL log
print("\n=== FULL LOG (last 50 lines) ===", flush=True)
for line in content.splitlines()[-50:]:
print(line, flush=True)