ADR 0007 — The outbox desk: the outbox harness's belt, arena trials and claim desk, run on the platform and operated from the studio¶
The platform depends on the outbox harness (bamr87/outbox) to view, manage, run and publish onto its belt from a studio workspace: the belt's files stay the record, a page going live rides the transactional outbox onto the belt, the claim desk only advises, and every run is the worker's — on a dependency pinned to the outbox commit that adds the belt.
- Status: proposed 2026-10-27. The dependency is pinned to the merge of bamr87/outbox#10, which added the belt (
ec82031on the harness'smain; it was the pull request's head,4221c90, until it merged). - Inputs: the owner's request of 2026-10-27, to build an "Outbox desk" capability so a person can view, manage, run and publish the outbox harness's functionality from the platform's studio; bamr87/outbox's branch
feature/platform-e2e-proof, whoseoutbox/belt.py,outbox/claimdesk.pyande2e/run.py(stage_verify,stage_learn,stage_publish) are what is integrated. - Where:
content/outboxdesk/,/api/v2/outbox/, the studio's Outbox area (web/packages/ui/src/outbox/), the composebelt-publisherservice, the ledger rowsoutbox.*in../plan/capabilities.yml, feature ZER0-045.
Context¶
The outbox harness is a stdlib-only Python library for asynchronous messaging between agents through immutable outbox records: a sender writes a file into its own outbox, and one relay — holding a file lock, minting a gapless sequence — copies it into each recipient's inbox and a ledger, or into the dead letters. Its belt profile carries one piece of work between pipeline stations (scout, planner, drafter, verifier, editor, publisher, learner) as typed handoffs (idea, assignment, draft, verdict, approval, published, signal) sharing a trace; its arena races a scout and two claimants on a task card and scores the winner after close; its claim desk races two verifiers on each of a draft's claims against what the claim's sources said over time, gives a verdict, and — once the truth is known — re-scores each arena into Brier scores and calibration. The e2e proof on the branch runs it all across the fleet's repositories.
The platform already has a transactional outbox of its own (content/outbox/: events committed with the change, relayed to Redis Streams, consumed once per consumer), the one way a side effect leaves it. A belt in the platform must sit beside that, not replace or bypass it.
Decisions¶
| # | Decision | Mechanism that enforces it |
|---|---|---|
| 1 | The platform depends on the outbox package, installed from git because the repository has no release tags, and pinned to a commit as every dependency here is pinned to a version: outbox @ git+https://github.com/bamr87/outbox.git@ec82031… in content/requirements.txt, the merge of bamr87/outbox#10, which added the belt to the harness's main. It moves to a tag if bamr87/outbox starts tagging. The image installs git for that one step and removes it in the same layer. If the harness cannot load, the platform still starts and the desk answers 503 outbox.unavailable. |
the requirements comment; content/Dockerfile; outboxdesk/harness.py and tests/outboxdesk/test_belt.py::test_a_harness_that_cannot_load_is_a_503_and_the_platform_still_answers |
| 2 | The library is loaded under another name. Its import package is outbox, which is also the platform's transactional-outbox app; the platform's directory is first on every process's path (manage.py, gunicorn, Celery, pytest), so import outbox.belt can never reach the library — and must not, or the platform's app would lose its name. outboxdesk/harness.py finds the installed distribution's outbox/__init__.py through importlib.metadata and loads it as outbox_harness; the library's modules import each other relatively, so they load unchanged. An editable install records no files and is refused with a reason. |
tests/outboxdesk/test_belt.py::test_the_desk_names_the_kinds_the_library_has_and_the_platform_keeps_its_outbox |
| 3 | The belt's files are the record. The stations' outboxes and inboxes, ledger.jsonl and dead_letter.jsonl live under OUTBOX_BELT_ROOT (compose: the outbox-data volume) and are read through the library — Belt.ledger, dead_letters, journey, write_belt_summary, to_cloudevent — on every request. No table mirrors them: a second copy would be a second ledger to drift. The platform stores only its own requests: SentHandoff (who sent what), Trial and ClaimCheck (what was asked, and what the library returned). Only a sender's own record (Station.send) and the relay (Belt.deliver, in the worker) write belt files. |
outboxdesk/services.py; tests/outboxdesk/test_belt.py |
| 4 | A person sends as the editor station, and only an idea, an approval (of a delivered message, keeping its trace) or a signal: validated by the library, refused with its reasons on the fields they name, recorded with who sent it (payload.by on the belt, a SentHandoff row in the platform). People only (IsPerson), behind Django permissions — outboxdesk.view_belt, send_handoff, deliver_belt, and the trial and claim-check model permissions. |
outboxdesk/views.py (Allowed); tests/outboxdesk/test_belt.py::test_the_belt_is_for_people_who_hold_the_desks_permissions |
| 5 | A page going live reaches the belt through the transactional outbox. The publish and its content.page.published event commit together; the relay puts the event on zer0:content; a consumer group of the desk's own (manage.py consume_events --stream zer0:content --group outboxdesk, the compose belt-publisher service) sends a published handoff from the publisher station once per event. Its ref names the page; its parent is the latest delivered message about the page (an editor's approval naming it), else the event — the belt requires every published to have one; its trace is that parent's, since the belt keeps one trace per piece of work (only a page nothing on the belt names takes the event's traceparent's, and the traceparent rides in the payload either way — the 2026-10-27 platform run found the event's trace splitting every published piece off its journey); its id derives from the event's, so a redelivery after a lost commit writes nothing twice. Nothing writes a belt file from the request or the signal that published the page. consume_events now loads every app's consumers module rather than naming graph's. A revision the importers published (legacy:import) is not announced: an import brings a site's existing pages in, and no piece of work went live. |
outboxdesk/consumers.py; tests/outboxdesk/test_publish.py::test_a_page_that_goes_live_is_announced_by_the_outbox_events_consumer_once (no belt file after the publish, one handoff after the event, none on redelivery), ::test_a_page_an_import_published_is_not_announced |
| 6 | The claim desk only advises. A check reads claims and a source timeline and writes its own arenas; it never edits, saves or publishes a page. A block is advice; the editor decides, through the platform's own publishing paths. A check may name the draft page it is about, as a link, and only a page the person can find. |
outboxdesk/services.py imports no page writer; tests/outboxdesk/test_runs.py::test_a_claim_check_gives_a_verdict_per_claim_and_never_touches_the_page |
| 7 | Every run is the worker's. The relay, trials, claim checks and resolutions are Celery tasks under a time limit; a request that starts one answers 202 and the studio reads the row (or, for the relay, the summary) again until it is final; a run-starting request honours an Idempotency-Key. Beat runs the relay every minute. A trial's or a check's arenas are kept under OUTBOX_OUT_DIR/runs/<run-id>/, as the harness's own --out; a failure is kept on its row. Cards and claim sets are validated field by field before the worker sees them, and a claim's id, which names a directory, is held to a safe name. |
outboxdesk/tasks.py; CELERY_BEAT_SCHEDULE["outbox-belt"]; tests/outboxdesk/test_runs.py |
Consequences¶
- The studio gains an Outbox area: the belt (numbers, messages, journeys, CloudEvents, dead letters, sending, delivering), trials and the claim desk with calibration. The extension has no counterpart yet — a gap the ledger records (
extension: missing), closed by G10 like every studio workspace. - The belt is a directory every role that touches it must share: the web role (reads, sends), the worker (relay, runs) and
belt-publisher. The relay's lock is anflockon that filesystem, so a deployment with workers on several hosts needs a filesystem whereflockholds, or one relay host. belt-publisherreads throughoutbox.consumers.consume_streamas it is: a new consumer group starts at the stream's beginning, so its first start announces every page publish the stream still holds (up to the relay'smaxlen); and a handler that raises stops the process with the event left pending in the group, which a restart does not read again. Both are that function's behaviour for every consumer, not the desk's to change here.- Reading the ledger reads the file. That is the record's cost; at a size where it hurts, the answer is the library's (an index beside the ledger), not a mirror table here.
- The desk's capability rows are
doneon the API and in the studio andmissingin the extension, which has no counterpart yet (G10, like every studio workspace).
Open — the owner's decisions¶
- The pin. Resolved: the requirement pins bamr87/outbox#10's merge commit on the harness's
main. It moves to a tag if bamr87/outbox starts tagging releases. - The import name. Whether bamr87/outbox renames its import package (e.g.
outbox_harness), which would letharness.pygo, or the alias loader stays. - Who holds the desk's permissions. No group is given them; superusers hold them, and anyone else is granted them in Wagtail's groups. Whether the "Editors" or "Moderators" group should get some by default is a policy choice.
- The parent of a
publishedhandoff with nothing before it. The belt requires a parent; when no delivered message names the page, the parent is the outbox event's id — an id from the platform's stream, not from the belt. - Retention. Arenas under
runs/and the belt's files grow without bound; no cleanup is scheduled.