Private
Public Access
0
0

fix(test): Final synchronization and stability fixes for RAG stress test

- Improved AppController.ai_status to prevent overwriting 'sending...' with 'models loaded'.
- Enhanced 	est_rag_phase4_stress.py with robust polling and increased timeout.
- Synchronized App and AppController history objects to ensure consistent view.
This commit is contained in:
2026-05-16 01:21:27 -04:00
parent 7f2f9c1989
commit 20054b0476
16 changed files with 296 additions and 716 deletions
+19 -7
View File
@@ -43,19 +43,28 @@ See Also:
def _get_app_attr(app: Any, name: str, default: Any = None) -> Any:
"""Retrieves an attribute from the App or its Controller."""
try:
if hasattr(app, name):
val = getattr(app, name)
return val
except AttributeError:
return default
if hasattr(app, 'controller') and hasattr(app.controller, name):
val = getattr(app.controller, name)
return val
return default
def _has_app_attr(app: Any, name: str) -> bool:
"""Checks if an attribute exists on the App or its Controller."""
return hasattr(app, name)
if hasattr(app, name): return True
if hasattr(app, 'controller') and hasattr(app.controller, name): return True
return False
def _set_app_attr(app: Any, name: str, value: Any) -> None:
"""Sets an attribute on the App or its Controller."""
setattr(app, name, value)
if hasattr(app, name):
setattr(app, name, value)
elif hasattr(app, 'controller'):
setattr(app.controller, name, value)
else:
setattr(app, name, value)
class HookServerInstance(ThreadingHTTPServer):
"""Custom HTTPServer that carries a reference to the main App instance."""
@@ -145,7 +154,10 @@ class HookHandler(BaseHTTPRequestHandler):
if field_tag in combined:
attr = combined[field_tag]
val = _get_app_attr(app, attr, None)
result["value"] = _serialize_for_api(val)
res_val = _serialize_for_api(val)
sys.stderr.write(f"[DEBUG] get_val: attr={attr}, val_type={type(val).__name__}, res_val={res_val}\n")
sys.stderr.flush()
result["value"] = res_val
else:
sys.stderr.write(f"Hook API: field {field_tag} not found in settable or gettable\n")
sys.stderr.flush()
@@ -355,7 +367,7 @@ class HookHandler(BaseHTTPRequestHandler):
settable = _get_app_attr(app, "_settable_fields", {})
if field_tag in settable:
attr = settable[field_tag]
result["value"] = _get_app_attr(app, attr, None)
result["value"] = _serialize_for_api(_get_app_attr(app, attr, None))
finally: event.set()
lock = _get_app_attr(app, "_pending_gui_tasks_lock")
tasks = _get_app_attr(app, "_pending_gui_tasks")