Skip to content

fix(daemon): make terminal notification delivery retryable#852

Merged
huangzesen merged 1 commit into
mainfrom
fix/daemon-terminal-notification-receipt-20260710
Jul 11, 2026
Merged

fix(daemon): make terminal notification delivery retryable#852
huangzesen merged 1 commit into
mainfrom
fix/daemon-terminal-notification-receipt-20260710

Conversation

@huangzesen

Copy link
Copy Markdown
Collaborator

Summary

  • make terminal_notified a post-publication receipt instead of a pre-publication claim
  • keep terminal notification mandatory and internal; no caller-facing boolean/config toggle
  • clear a temporary claim after enqueue failure so terminal delivery stays retryable without crashing the daemon result path
  • reconcile explicit new-format unpublished terminal records at startup, while conservatively skipping pre-contract records whose receipt field is absent
  • add a stable internal idempotency key so publish-before-receipt crash recovery does not duplicate a retained system event
  • bound startup result previews to 2,000 characters and document the capped-window at-least-once edge

Why

A read-only machine-wide audit correlated 6,763 daemon manifests with 19 owning-parent event logs (4.761 GB). It found two compatible terminal runs where terminal_notified=true was persisted but no matching system_notification_published event existed. The source path explained the failure: it persisted the claim first, then swallowed enqueue errors without rollback or retry.

The same audit found a strict post-publication missed-wake lower bound of zero. This PR therefore fixes the publication receipt/retry boundary instead of adding another public wake toggle.

Rollout safety

  • new runs initialize an explicit unpublished receipt
  • startup retries only terminal_notified is False
  • missing-key historical records are not replayed or mutated; the audit found roughly 4,666 such pre-contract terminal records machine-wide
  • legacy terminal_notified=true records remain conservative
  • idempotency dedup is scoped to the retained 20-event system.json window; after dismissal/eviction, recovery may safely republish rather than record false success

Validation

  • 578 passed, 1 warning — all tests/test_daemon*.py plus every direct system-notification caller suite
  • py_compile on touched runtime modules
  • anatomy drift checker: 38 files, no drift; touched semantic citations manually re-anchored
  • git diff --check
  • independent GLM-5.2 review: APPROVE, no blockers; all low/informational findings addressed

Coordination

@huangzesen
huangzesen merged commit 1c79a36 into main Jul 11, 2026
@huangzesen
huangzesen deleted the fix/daemon-terminal-notification-receipt-20260710 branch July 11, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant