fix: skip intermediate 'starting' notifications, only notify on failed/successful attempts

- lifecycle_hooks.publish_lifecycle_event now skips notification creation
  when event_type='instance.started' and status='starting'
- Users only see notifications for terminal states:
  - Failed: instance.error
  - Successful: instance.health_changed with status='running'
- Updated integration tests to verify new behavior:
  - test_lifecycle_started_intermediate_skips_notification
  - test_lifecycle_running_creates_notification

Quality gates: pytest 42 passed, ruff clean
This commit is contained in:
2026-05-29 14:05:29 +02:00
parent d9632a3412
commit 3da2bc93cb
2 changed files with 39 additions and 6 deletions
+8
View File
@@ -118,6 +118,14 @@ async def publish_lifecycle_event(
await event_bus.publish(event_type, payload)
# Create notification for instance owner (fire-and-forget)
# Skip intermediate "starting" notifications — only notify on terminal states
# (failed or successful attempts)
_is_starting_intermediate = event_type == "instance.started" and (
status or instance.status
) == "starting"
if _is_starting_intermediate:
return
severity = "error" if event_type == "instance.error" else "info"
title = _derive_title(event_type)