Skip to content

fix(orderbook): continue reduce-only close recovery when a selected order fills - #348

Merged
jackhai9 merged 1 commit into
mainfrom
fix/reduce-only-recovery-filled-target
Nov 10, 2026
Merged

jackhai9 merged 1 commit into
mainfrom
fix/reduce-only-recovery-filled-target

Conversation

@jackhai9

Copy link
Copy Markdown
Owner

Near the tail of a continuous close, a Binance reduce-only rejection (90802022) starts recovery, which selects same-direction close orders to cancel. A selected order often fills between selection and its click. cancelOpenOrderRowsForPlan required each selected order to match exactly one rendered row and otherwise ended the task. On 2026-11-10 a live JCTUSDT continuous close stopped at round 624/628 with 无法确认待替换订单,已停止重新挂单 · 只减仓订单被拒绝 · 错误码 90802022.

During reduce-only recovery (confirmed_reduce_only_conflict) only:

  • a selected order absent from both the rendered Basic rows and the native list's complete committed data ends the batch before any further click;
  • it is not counted as released quantity, because absence alone cannot prove the quantity was freed (an external order may have replaced it);
  • the step status reads 待替换挂单已成交或消失,重新核对持仓 and the replacement returns target_left_list;
  • runCloseLadderWithPositionRecovery then waits, rereads the authoritative position and rebuilds. A fill continues the task. An unchanged position followed by another rejection stops with the existing "替换后仍有只减仓冲突,复核持仓未减少" guard.

These cases still stop: a committed but unrendered order, more than one match, quantity mismatches, scope or dialog changes, and every ordinary replacement.

Release: orderbook 2.7.246.

Validation:

  • 2,644 Node tests and the full Playwright suite (664) pass; lint, syntax and diff checks pass.
  • New browser scenarios:
    • a selected order fills before its cancellation → the runner rereads the decreased position and submits the rebuilt plan without failing (fails on the previous code with the live status text);
    • a selected order disappears while the position never decreases → stops on the persisting conflict without cancelling the spare order;
    • a selected order is committed but pushed out of the rendered rows → still stops as unconfirmable (a mutation removing the committed-data check fails it).
  • The three scenarios passed three consecutive runs.
  • An independent read-only review found no bypassed invariant (receipt draining, cancelled-identity bookkeeping, progress counters, runner replacement guard). Its two suggestions are applied: no overwritten status, and a committed-data check before treating an order as gone.

Not exercised live: real reduce-only rejections near the end of a close.

🤖 Generated with Claude Code

…rder fills

Near the tail of a continuous close, a reduce-only rejection (90802022)
selects close orders to cancel, and one often fills before its click. The
cancel loop required every selected order to be present and stopped the whole
task otherwise; a live JCTUSDT close stopped at round 624/628 with
"无法确认待替换订单".

During reduce-only recovery only, a selected order that is absent from both
the rendered rows and the native list's complete committed data now ends the
batch without counting it as released quantity. The recovery runner waits,
rereads the authoritative position and rebuilds: a fill continues the task,
while an unchanged position followed by another rejection stops with the
existing no-progress message. A committed but unrendered order, more than one
match, and ordinary replacements still stop.

Release: orderbook 2.7.246.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jackhai9
jackhai9 merged commit 8846065 into main Nov 10, 2026
2 checks passed
@jackhai9
jackhai9 deleted the fix/reduce-only-recovery-filled-target branch November 10, 2026 15:14
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