OrderLifecycleManager
OrderLifecycleManager is the single source of truth for every order's state machine, tracking transitions from intent through terminal state.
What it does
OrderLifecycleManager is the single source of truth for every order's state machine, tracking transitions from intent through terminal state. It reconciles local state against the CLOB V2 user-state endpoint, detects stuck-in-flight and orphaned orders, and emits ExecutionReports on every transition.
Pipeline placement
Applies to: Every live order from submission through terminal state (FILLED, CANCELLED, EXPIRED)
Why it matters
| If this fails | Consequence |
|---|---|
| Order state out of sync | Strategy layer acts on stale position data, potentially doubling into a filled position or missing a cancellation. |
| Stuck-in-flight order not detected | An order that never received an ack occupies position budget indefinitely, blocking new orders. |
| Orphaned ack not cancelled | A resting order with no owning strategy leaks capital and may fill at an unintended price. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| CLOB V2 user orders endpoint | clob_auth | required | Reconcile local state against exchange state every reconcile_interval_s. |
| WebSocket user feed — fill and cancel events | ws_user | required | Receive real-time order state transitions (ack, partial fill, full fill, cancel, expire). |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Signed order from SmartRouter | exec.smart_router | required | Initialise order state record on first submission. |
| KillSwitch active flag | risk.kill_switch | required | Cancel all open orders and halt state updates when active. |
Authority
What this bot is permitted to do
State
Readiness
Spec started
Status
planned
Class
Execution Utility
Default mode
shadow_only
Developer owner
Polytraders core — Execution pod
Capital impact
Direct
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| ORDER_LIFECYCLE_TRANSITION | INFO | Normal state transition recorded. | Emit ExecutionReport; no intervention required. |
| ORDER_STUCK | HARD_REJECT | Order has been PENDING_ACK beyond stuck_order_timeout_s. | Cancel order via clob_auth; emit ExecutionReport. |
| ORDER_ORPHAN_CANCELLED | WARN | Order found during reconcile with no owning strategy record. | Cancel order; log warning. |
| KILL_SWITCH_ACTIVE | HARD_REJECT | Global kill switch active; cancel all open orders. | Cancel all open orders; halt processing. |
| RECONCILE_DISCREPANCY | WARN | Local state does not match exchange state after reconcile poll. | Overwrite local state with exchange state; emit WARN. |
Related bots in Execution
Used by
Reverse index — strategies that currently reference exec.orderlifecyclemanager. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| US Elect — book-builder | demo-wired | last triggered 7m ago |
| NBA H2H — moneyline market-make | demo-wired | last triggered 14m ago |
Showing 2 of 2 · demo-wired ≠ production-live
Why this matters
Execution bots does NOT propose new positions; only routes and shapes approved intents. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →