fix: preserve sell event routing owner

This commit is contained in:
Hermes Agent
2026-09-20 20:34:00 +09:00
parent 3f6a967aa1
commit c66acf6e47
20 changed files with 766 additions and 32 deletions
+13 -1
View File
@@ -469,6 +469,18 @@ class IntentService:
return IntentDecision(
intent.intent_id, "rejected", None, f"slot_not_holding:{slot.status.value}"
)
# req-0011 / ac-0038: decide the SELL event owner at admission and
# persist it in the existing canonical slot field. An explicit SELL
# owner wins, then a preserved owner from a prior zero-fill cancel,
# then the legacy holding owner used by autonomous safety sells.
def non_empty(value: Optional[str]) -> Optional[str]:
return value if isinstance(value, str) and value.strip() else None
sell_event_owner = (
non_empty(intent.sell_strategy_id)
or non_empty(slot.sell_strategy_id)
or non_empty(slot.strategy_id)
)
# dcy-022 / REQ-068: resolve effective timeout.
effective_timeout = (
intent.timeout_sec
@@ -482,7 +494,7 @@ class IntentService:
SlotState.PENDING_SELL,
reason=intent.reason,
actor="intent_api",
sell_strategy_id=intent.sell_strategy_id,
sell_strategy_id=sell_event_owner,
# dcy-012 / REQ-007: optional sell limit (None => market sell).
limit_price=intent.limit_price,
# dcy-021 / REQ-062: partial-sell order qty (None => sell all);