Skip to content

Commit a6b9326

Browse files
fix(session): explicit no-op fallback for observability emit_event
The P1-5 deposit event imports core.observability.events (introduced by HKUDS#181). Previously an ImportError was swallowed silently by the blanket except; per maintainer review, make the fallback explicit so the event is intentionally skipped until the observability bus lands, regardless of merge order (HKUDS#183 vs HKUDS#181).
1 parent 5bf8c61 commit a6b9326

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

core/events/session.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,21 @@ def _work() -> None:
519519
write_compaction_summary(self._workspace, summary, anchor)
520520
try:
521521
from core.observability.events import emit_event
522-
523-
emit_event(
524-
"memory.compaction.deposited",
525-
session=(anchor or {}).get("session_key"),
526-
chars=len(summary or ""),
527-
phase=(anchor or {}).get("phase"),
528-
)
529-
except Exception: # noqa: BLE001, S110
530-
pass
522+
except ImportError:
523+
# The observability bus is introduced by #181. Until it
524+
# lands, no-op the event so the deposit still succeeds
525+
# regardless of merge order.
526+
emit_event = None
527+
if emit_event is not None:
528+
try:
529+
emit_event(
530+
"memory.compaction.deposited",
531+
session=(anchor or {}).get("session_key"),
532+
chars=len(summary or ""),
533+
phase=(anchor or {}).get("phase"),
534+
)
535+
except Exception: # noqa: BLE001, S110
536+
pass
531537
except Exception: # noqa: BLE001 - memory work never breaks turns
532538
logger.debug("compaction summary deposit failed", exc_info=True)
533539

0 commit comments

Comments
 (0)