Terminal Order Statuses Need Reason-Preserving Mapping
By DX Research Group · · Execution mechanics
A canceled order can reflect owner action, margin changes or venue restrictions. Preserve reasons and reconcile economic effects before closing the agent record.
An execution adapter needs a lifecycle category and the original venue reason. We would map terminal statuses into stable internal categories while preserving the raw string. Hyperliquid distinguishes user cancellation, margin cancellation, self-trade cancellation and several placement rejections. Collapsing those into a single failed label loses the mechanism that the next agent turn needs.
Terminal is a lifecycle result with a reason
Illustrative case: three proposed 2-unit buys end as canceled, marginCanceled and badAloPxRejected. Each leaves zero resting quantity in this hypothetical fixture, but the corrective action differs. The first may implement the owner’s withdrawal of intent. The second calls for portfolio and collateral review. The third calls for a fresh passive-price decision. A generic retry rule would recreate withdrawn exposure, repeat inadequate-margin placement and potentially convert a passive action into an aggressive one.
Make unknown reasons visible
Maintain a versioned table from raw status to placement outcome, resting-order outcome and reason. Leave newly introduced strings in an explicit unmapped category for operator review. A terminal order may have executed quantity earlier, so completion of its lifecycle must still join to economic receipts. Test a previously unknown cancellation string and require preservation of the full raw response. Then test a triggered status and require a separate check for the resulting order or position rather than declaring the economic intention complete.
Exercise the mapping
The status mapper should be reviewed when venue documentation changes, and its version should accompany stored results. A historical row can then be interpreted under the mapping used at the time. Avoid rewriting raw venue statuses during migration. Reclassification may be useful, but publish both the original interpretation and the revised one when the difference affects an evaluation denominator.
Our execution and reconciliation framework provides the broader mandate-to-outcome trace. The state and memory contract explains how the verified result should enter the next decision. These notes narrow those published methods to one execution boundary; the worked amounts above are illustrative and the test is a proposed local fixture. The source inspected for the venue-specific statements is the official Hyperliquid order status documentation.