Skip to content

Round-4 dogfood: getOrders crash, orderId truncation, spot reduceOnly#333

Merged
luokerenx4 merged 1 commit into
masterfrom
UTA-issue
Jun 12, 2026
Merged

Round-4 dogfood: getOrders crash, orderId truncation, spot reduceOnly#333
luokerenx4 merged 1 commit into
masterfrom
UTA-issue

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Summary

Fourth self-bootstrapped test run, targeting the never-exercised mutation paths. Four catches, all fixed + live-verified:

  • getOrders crashed on every call over the SDK path (Decimal methods on JSON strings) — listing open orders was entirely unusable for agents; rewritten on the value-tolerant compactors.
  • 19-digit order ids float-truncated in summaries (…344 → …300) — every downstream modify/cancel-by-id would silently miss; summaries now use the top-level string id.
  • Spot closePosition sent reduceOnly (derivatives-only; okx 51205) — partial spot closes were impossible; now gated by secType. Live: partial close 0.009 ETH filled.
  • Portfolio rows lacked secType/aliceId — ETH spot vs ETH perp were indistinguishable and unactionable; both added.

Verified clean with no fix needed: modifyOrder end-to-end (price+qty amend on okx), cashQty notional buys, bybit STP via the new trigger mapping (accepted/tracked/cancelled).

Test plan

  • pnpm test 1895 passing; root tsc clean
  • Live: modify→verify→cancel; notional buy→fill→partial close→fill; bybit stop place→track→cancel; accounts left at baseline (pending cleanup sell tracked by poller)

Boundary touch

CCXT closePosition params; agent-facing order summaries.

🤖 Generated with Claude Code

… spot reduceOnly, ambiguous portfolio rows

Walked the never-tested mutation paths (modify / partial close /
notional cashQty / second-venue stops). Four catches, all live-verified
on okx+bybit demo after fixing:

1. getOrders was COMPLETELY broken over the SDK: summarizeOrder called
   Decimal methods (.equals) on Order fields that arrive as plain JSON
   strings over HTTP — "totalQuantity.equals is not a function" on
   every listing. Rewritten on the value-tolerant compactors. (This
   also explains how the bug survived: the in-process path has real
   Decimals; only the split-process SDK path crashed.)

2. Order ids float-truncated in summaries: the inner IBKR-shaped
   order.orderId is a number — 19-digit CCXT ids lost their tail
   (…344 → …300), which would have made every downstream
   modify/cancel-by-id silently target a nonexistent order. Summaries
   now read the top-level string orderId.

3. closePosition sent reduceOnly on SPOT closes — a derivatives-only
   concept; okx rejects it outright (51205, observed on a partial spot
   close). reduceOnly now rides only on CRYPTO_PERP/FUT positions.
   Partial close live-verified: SELL 0.009 filled @1664.95.

4. getPortfolio rows carried symbol but neither secType nor aliceId —
   ETH spot and ETH perp rendered as two identical "ETH" rows, and the
   agent had no id to close either. Both fields added.

Verified working this round with no fixes needed: modifyOrder
end-to-end (price+qty amendment landed on okx, ids intact), cashQty
notional market buy (ticker-converted size, filled + tracked), bybit
STP via the new trigger mapping (accepted, tracked, cancelled).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jun 12, 2026 1:36am

Request Review

@luokerenx4 luokerenx4 merged commit 5fe81e7 into master Jun 12, 2026
5 checks passed
luokerenx4 pushed a commit that referenced this pull request Jun 12, 2026
…d loop

Five self-bootstrapped test rounds found ~20 real bugs (PRs #325#333)
that neither unit tests nor human UI sessions would ever hit: they only
exist on the real usage path, through the agent surface, against real
venue behavior. docs/uta-live-testing.md distills those rounds into a
repeatable catalog — S1–S12 covering read-state agreement, order
lifecycle, amendments, attached TP/SL (verify on the VENUE, the ledger
lied once), standalone stops in algo namespaces, external-order
observation, restart survival, partial closes, notional entries, error
ergonomics and staging undo — plus a new-broker acceptance checklist
(listing must SEE a real order, string ids end-to-end, in-kind fees as
reconcile dust, venue quirks documented in the exchange's override
file).

CLAUDE.md points at it from the subsystem guides: trading-path changes
run the relevant scenarios; new brokers run the full catalog before
being called supported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant