Private
Public Access
refactor(src): Phase 10.2 batch 5 - log_registry + models + multi_agent_conductor + theme_2
For these 4 sites, the Result migration cascades badly (the function returns a non-Result type that's used in many places). Per the audit's heuristic #19 (catch + log = INTERNAL_COMPLIANT), we convert the SILENT_SWALLOW to narrow-catch + sys.stderr.write. This satisfies the no-silent-recovery principle while keeping the public API stable. log_registry.py:249 (2 sites - inner + outer try/except for OSError on session path scan and comms.log read) models.py:508 (datetime.fromisoformat ValueError; field stays as string on parse failure; logs the parse error to stderr) multi_agent_conductor.py:317 (PersonaManager.load_all fallback for ticket.persona_id lookup; logs the failure to stderr) theme_2.py:282 (markdown_helper.get_renderer().clear_cache; logs the import/attribute error to stderr) Tests verified: - tests/test_log_registry.py (5 tests) PASS - tests/test_logging_e2e.py (1 test) PASS - tests/test_auto_whitelist.py (4 tests) PASS - tests/test_orchestration_logic.py (8 tests) PASS - tests/test_mma_tier_usage_reset_fix.py (4 tests) PASS
This commit is contained in:
+6
-4
@@ -244,10 +244,12 @@ class LogRegistry:
|
||||
for kw in keywords_to_check:
|
||||
if kw in line and kw not in found_keywords:
|
||||
found_keywords.append(kw)
|
||||
except OSError:
|
||||
pass
|
||||
except OSError:
|
||||
pass
|
||||
except OSError as e:
|
||||
import sys
|
||||
sys.stderr.write(f"[LogRegistry] read comms.log entry failed: {e}\n")
|
||||
except OSError as e:
|
||||
import sys
|
||||
sys.stderr.write(f"[LogRegistry] scan session_path failed: {e}\n")
|
||||
size_kb = total_size_bytes / 1024
|
||||
whitelisted = False
|
||||
reason = ""
|
||||
|
||||
+3
-2
@@ -505,8 +505,9 @@ class TrackState:
|
||||
if isinstance(ts, str):
|
||||
try:
|
||||
new_item["ts"] = datetime.datetime.fromisoformat(ts)
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
import sys
|
||||
sys.stderr.write(f"[models] fromisoformat failed for ts={ts!r}: {e}\n")
|
||||
parsed_discussion.append(new_item)
|
||||
else:
|
||||
parsed_discussion.append(item)
|
||||
|
||||
@@ -314,8 +314,9 @@ class ConductorEngine:
|
||||
persona = personas[ticket.persona_id]
|
||||
if persona.preferred_models:
|
||||
models_list = persona.preferred_models
|
||||
except (OSError, KeyError, AttributeError, TypeError):
|
||||
pass # Fall back to default list
|
||||
except (OSError, KeyError, AttributeError, TypeError) as e:
|
||||
import sys
|
||||
sys.stderr.write(f"[ConductorEngine] persona load fallback (ticket={ticket.id}): {e}\n")
|
||||
model_idx = min(ticket.retry_count, len(models_list) - 1)
|
||||
model_name = models_list[model_idx]
|
||||
|
||||
|
||||
+3
-2
@@ -279,8 +279,9 @@ def apply(palette_name: str) -> None:
|
||||
try:
|
||||
import src.markdown_helper
|
||||
src.markdown_helper.get_renderer().clear_cache()
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
except (ImportError, AttributeError) as e:
|
||||
import sys
|
||||
sys.stderr.write(f"[theme_2] markdown_helper cache clear failed: {e}\n")
|
||||
|
||||
def apply_current() -> None:
|
||||
"""Apply the loaded palette and scale."""
|
||||
|
||||
Reference in New Issue
Block a user