Skip to content

feat(orders): force-cancel a stuck order from the order menu (MoonBot 7.73 N2) - #1488

Merged
guyverino merged 2 commits into
mainfrom
feat/order-force-cancel
Nov 26, 2026
Merged

guyverino merged 2 commits into
mainfrom
feat/order-force-cancel

Conversation

@guyverino

Copy link
Copy Markdown
Collaborator

What & why

MoonBot 7.73 N2 can force-cancel a stuck order: the core drops it from its own tracking even when the exchange did not confirm the cancel. The terminal now offers Force cancel… in the order menu.

  • moon-core: CoreFeatures, detected from the RuntimeState tails MoonProto documents per build (moon_stream_enabled = 7.73 N1, moon_streamer = N2; both builds report version 773, so the number cannot tell them apart). Mirrored per core into the store and forgotten on any departure from Ready or a server restart. Also carries the N1 flag the exchange-entries PR uses.
  • CoreCmd::ForceCancelOrder, a sibling of CancelOrder, routed to orders().force_cancel() and classified as a live action.
  • The item appears only for a BuySet/SellSet order. On an older or unreported core it is disabled with the reason ("needs MoonBot 7.73 N2 or newer"). The confirmation says the order may remain open on the exchange; the answer re-checks the workspace, the eligibility and the leg captured when the menu opened. The toast says "sent", not "cancelled".
  • The synthetic core announces both N1 and N2 features after Ready, so the fixture and the benches reach the new controls.

Notable decisions

  • The feature flags come from RuntimeState tails, not from the settings snapshot, so the library's compact-settings projection cannot unlock a control on an older core.

Known limitations

  • Ok from the SDK means the request was queued; the result arrives as normal order updates. Older cores ignore the request, which is why the item is gated.

Issues

None of the open issues tracks force-cancel. #1211 (cancel a filled order and keep the coins) is a different action and is not touched.

How to verify

cargo build -p moon-ui-gpui --bin moonterminal --target x86_64-pc-windows-msvc --all-targets
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings
cargo test --workspace --target x86_64-pc-windows-msvc

Local, after the rebase on 44b01ffcd: fmt --check exit 0, build --all-targets exit 0, clippy --workspace --all-targets --locked -D warnings zero warnings, cargo test --workspace 10595 passed / 0 failed, doc-tests green.

… 7.73 N2)

- moon-core: CoreFeatures, detected from the RuntimeState tails moonproto documents per build
  (moon_stream_enabled = 7.73 N1, moon_streamer = N2), mirrored per core into the store and
  forgotten on any departure from Ready or a server restart. Carries the N1 exchange-wide buys
  cancel flag for the follow-up.
- CoreCmd::ForceCancelOrder, a sibling of CancelOrder, routed to orders().force_cancel and
  classified as a live action.
- The order menu offers "Force cancel..." only for a BuySet/SellSet order on an N2 core; on an
  older or unreported core the row is disabled with the reason. A confirmation states that the
  order may remain open on the exchange; the answer re-checks the workspace, the eligibility and
  the leg captured when the menu opened, and the toast says sent, not cancelled.
- Locale keys in all eight languages.
The synthetic feed sent RuntimeState but never CoreFeatures, so the store kept the default on
every synthetic core and the order menu's force-cancel row (and the N1 exchange-entries control
that reuses the flag) stayed disabled on the fixture, the benches and the capture build.

The synthetic core stands in for a current core, so it now announces both the N1 and the N2
commands right after its RuntimeState, after Ready (the store forgets the build on any other
status). Its command drain executes no command, so a forced cancellation is dropped exactly like
an ordinary one; a test pins that the stream survives it.
@guyverino
guyverino merged commit ecffeef into main Nov 26, 2026
12 checks passed
@guyverino
guyverino deleted the feat/order-force-cancel branch November 26, 2026 11:13
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