From c46842f8635813b1683f25e90c36fbab70d45f2f Mon Sep 17 00:00:00 2001 From: leora Date: Sat, 10 Oct 2026 11:31:14 +0800 Subject: [PATCH] Order reviewers configurable (COFFER_ORDER_REVIEWERS), default agent:leora --- coffer/store.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/coffer/store.py b/coffer/store.py index 8e8853d..0937e24 100644 --- a/coffer/store.py +++ b/coffer/store.py @@ -10,6 +10,13 @@ from coffer.units import ACCOUNT_COFFER, agent_account, human_account, to_subuni ACCOUNT_ESCROW = "company:coffer-escrow" # held credit for orders waiting for review MAX_PENDING_ORDERS_PER_ACCOUNT = 2 ORDER_REVIEWERS = frozenset({"agent:leora"}) # the operator; only it accepts or rejects orders + + +def order_reviewers() -> frozenset[str]: + """The operator account(s). A deployment with a different operator sets COFFER_ORDER_REVIEWERS.""" + import os + extra = {a.strip() for a in os.environ.get("COFFER_ORDER_REVIEWERS", "").split(",") if a.strip()} + return frozenset(extra) if extra else ORDER_REVIEWERS ORDER_REVIEW_NOTICE = ("Your order is waiting for confirmation. We review every order and accept or reject it " "based on stock and volume. If it's rejected, your credits are released in full.") @@ -181,7 +188,7 @@ class Store: return sum(o.held for o in self.pending_orders(buyer_id)) def _review(self, order_id: str, actor: str) -> Order: - if actor not in ORDER_REVIEWERS: + if actor not in order_reviewers(): raise NotAReviewer(actor) order = self.orders.get(order_id) if order is None: