Define persistent acceptance and retry semantics for observation ingestion

Author: rohitg00Created Sep 29, 2026Updated Sep 29, 2026

Problem

The observation endpoint invokes the storage function directly even though an observation subscriber already exists. Persistent observation state and stream updates do not establish that a pending delivery will survive a process restart.

At main ab3e4efd282659b87d31b36c8514c6bc6b871f0b, the HTTP route calls mem::observe directly. The event registration separately subscribes to agentmemory.observation. Merely registering that subscriber does not put HTTP capture on the queued path.

Live evidence

A controlled local runtime probe used the same dependency version as the tested build:

  • A handler intentionally failed twice and succeeded on its third delivery. Existing retry behavior worked.
  • A second publish returned successfully, then its first delivery failed and remained pending.
  • With the default built-in in-memory queue configuration, killing and restarting the engine produced no recovered delivery during the test window.
  • With the existing built-in file persistence enabled and a 1,000 ms save interval, the same sequence recovered one delivery after restart.

The file-mode test waited three seconds after the first failed delivery before killing the engine. This demonstrates recovery after a persistence opportunity. It does not demonstrate immediate durable acknowledgment, power-loss safety, disk-full behavior or exactly-once transport. The regular HTTP route was source-inspected; this probe did not establish an accepted HTTP observation loss rate.

Required behavior

  • Route accepted ingestion through the existing durable delivery mechanism, with an explicitly selected persistence policy.
  • Define what the HTTP response guarantees: receipt, persisted acceptance, completed observation, or pending processing. Preserve compatibility or version a response change.
  • Surface pending, retrying, completed and exhausted delivery states without silently treating them as the same success.
  • Keep retry scheduling and failed-delivery handling in the existing runtime.
  • Make effects idempotent across worker and engine restarts before replaying delivery or paid processing.
  • Bound retained queue and failed-delivery data, with observable expiration or overflow.

Acceptance checks

Use real processes and storage for: kill immediately after response, kill after a completed persistence interval, worker disconnect, retry exhaustion, timeout after commit, read-only/full storage, and restart recovery. Publish the measured loss window and configuration. Do not infer durable acceptance from a successful return alone.

The service-unavailable hook case is a separate pre-acceptance concern. Both paths need stable event identity, but they should share the existing persistence and delivery foundation.