Skip to content

CEM: no reception status indicator for inbound messages #17

Description

@martijnversluis

Our RM sends reception statuses for RM->CEM messages:

Image

but the CEM dashboard displays the status as unknown:

Image

According to Claude this is the cause:

The real cause lives in cem-reference-1/cem/s2/session_manager.py:165-178:

async def _send_message(self, message: S2Message, ...):
await self.outgoing_queue.put(TransportMessage(...))
if isinstance(message, S2MessageWithID):
await emit_s2_event(S2Event.MESSAGE_SENT, context, message)

  • Every outbound message is put on the wire, but the MESSAGE_SENT event is only emitted for messages that carry a message_id field (i.e. S2MessageWithID).
  • MESSAGE_SENT is exactly the trigger that handle_sent_message in event_handlers.py uses to persist the message into the messages table.
  • And, as just confirmed inside the running cem_app container:

>>> 'message_id' in ReceptionStatus.model_fields
False
>>> issubclass(ReceptionStatus, S2MessageWithID)
False

In s2python, ReceptionStatus only has subject_message_id, no message_id of its own, so it is not an S2MessageWithID. Consequence: the CEM does send its outbound ReceptionStatus on the wire (our RM receives it — you can see the green ✓ next to those messages in our
dashboard now), but it never lands in the messages table.

The dashboard query in message_repository.py:66-91 does:

messages LEFT OUTER JOIN messages AS rs
ON rs.payload->>'message_type' = 'ReceptionStatus'
AND rs.payload->>'subject_message_id' = messages.payload->>'message_id'
WHERE messages.payload->>'message_type' != 'ReceptionStatus'

For RM→CEM messages this join looks for an outbound ReceptionStatus record — which doesn't exist — so the join is NULL → the UI shows "unknown". For CEM→RM messages it looks for an inbound ReceptionStatus record, and those are stored via handle_received_message → the
join hits → the status is displayed.

So: it's one missing else branch in _send_message (or a dedicated persistence hook for ReceptionStatus) on the CEM side.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions