server: commit operations before enqueueing and answer seq_no races with PREV_HASH_MISMATCH

The operation and receipt now commit before the queue send. A Postgres
23505 on operations_agent_id_seq_no_key is answered with 400
PREV_HASH_MISMATCH carrying the stored chain hash so hook retries can
resync. A failed enqueue after the commit is logged as
operation.enqueue_failed and the receipt is still returned.

Every producer now names its message: MessageQueue.send takes the
durable message id, and the BullMQ adapter passes it as the job id, so
the receipt's queue_message_id is the real queue identifier.

Claude-Session: https://claude.ai/code/session_01QoUjdc7HGKTsgj5GhG8HvF
This commit is contained in:
雷电芽衣 committed 2026-09-02 08:56:58 -04:00
1 parent 060a072f1f
commit 1bb9d4d49d
7 files changed
+159 -21

No files matched your search

+1
View File
@@ -56,6 +56,7 @@ This repository publishes the open-source server, console, integration catalog,
- Keep production source files at or below 500 lines.
- Keep functions focused on one ownership boundary.
- Propagate unexpected errors to the CLI or request boundary.
- Commit the operation and receipt before enqueueing. Log a failed enqueue as `operation.enqueue_failed` and still return the receipt; answer a `UNIQUE(agent_id, seq_no)` conflict with `PREV_HASH_MISMATCH` carrying the stored chain hash.
- Keep technical claims executable through tests or generated validation.
- Keep the mirrored Python package, distribution, and CLI version in `sdks/python/elydora/_version.py`; Setuptools metadata must read that literal dynamically.
- Ship `sdks/python/elydora/py.typed` in every mirrored wheel and verify public annotations from an installed-wheel consumer.