fix: [codex] Handle failed Binance withdrawals#3175
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b669fa4d49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52931079e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bebd3b1 to
5438b3d
Compare
5438b3d to
253c860
Compare
… npai/codex/binance-withdraw-failure-handling
… npai/codex/binance-withdraw-failure-handling
9fd9ca1
into
npai/codex/binance-completed-withdrawal-filtering
* filter callers to completed Binance withdrawals * fix: [codex] Handle failed Binance withdrawals (#3175) * handle failed Binance withdrawals * preserve failed Binance withdrawal tags * match only terminal Binance withdrawals * reuse Binance withdrawal status enum
What changed
CANCELLED,REJECTED, andFAILUREas terminal failures in the rebalancer Binance adapterPENDING_WITHDRAWALback toPENDING_SWAPPENDING_SWAP -> PENDING_WITHDRAWALtransition in place after a successfulwithdraw()submissionWhy
A successful
withdraw()response only means Binance accepted the withdrawal request for processing. It can still later fail.Before this change, the adapter only looked for completed withdrawals onchain and otherwise treated the withdrawal as still pending. That meant terminal Binance withdrawal failures could get stuck in
PENDING_WITHDRAWALindefinitely.This patch keeps the current state machine intact, but adds the minimal recovery path needed for failed withdrawals.
Validation
yarn test test/BinanceAdapter.withdrawals.tsyarn eslint src/rebalancer/adapters/binance.ts test/BinanceAdapter.withdrawals.tsyarn buildStack
npai/codex/binance-completed-withdrawal-filtering