Repository navigation
feat(core-expert): cancel entry orders on core exit (MoonBot 7.73 N2) - #1487
Merged
Merged
Conversation
Adds trading.auto_start_2.cancel_buys_on_exit to the expert window's General page as a standalone row under the risk group, as MoonBot draws it. Kept as Option<bool> end to end: a core that does not send the field (older than 7.73 N2) shows the row disabled with the reason, the writer never invents the field for such a core and never turns a sent value into None, and a bulk overlay keeps each target's own presence of it. The area comparison reads a missing flag as false, so an older core whose compact settings overlay projects Some(false) still confirms unrelated order-rules edits. The probe fills an absent optional leaf in its bases so a guarded setter is found for either value. The station MCP contract text now says what null means for an optional field.
…ancel flag The previous commit made OrderRulesSettings' PartialEq read a missing cancel_buys_on_exit as false. The session store dedupes arrivals with that same `!=`, so a core updated to 7.73 N2 (None -> Some(false)), or an older core's full snapshot replacing the compact overlay's Some(false), published no revision and left the expert window's row disabled or live until another field moved. PartialEq is structural again. The rule that an absent flag behaves as false moves to OrderRulesSettings::agrees_in_effect, used only by the write confirmation (rejection_within_mask, and through it agrees_within and edit_satisfied).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
MoonBot 7.73 N2 added a setting on its General tab: cancel the bot's own entry orders when the core exits. With it on, a core that is shut down (on Linux that includes systemd's SIGTERM) cancels its entries and pending orders before it closes. It never closes positions. This answers the "server switched off, buy orders stayed on the exchange" complaint: the watchdog still sees TurnOff and leaves the orders alone, so the core has to do it itself.
The terminal exposes it as one row on the expert window's General page, under the risk group, where MoonBot draws it.
Notable decisions
cancel_buys_on_exitstaysOption<bool>end to end. A core older than N2 does not send the field: the row is disabled with the reason, the writer never invents the field for such a core, and a bulk overlay keeps each target's own presence of it.OrderRulesSettingsequality is structural. The session store dedupes arrivals with!=, so treating a missing flag asfalsethere swallowed theNone -> Some(false)transition when a core was updated to N2. The "absent behaves as false" rule lives only inagrees_in_effect, which the write confirmation uses.nullmeans for an optional field.Known limitations
fe02d799projectsSome(false)onto an older core from its compact settings packet (absorb.rs:121), so for a moment such a core can read as "off" rather than "absent" until the next full snapshot. The row is gated on the core's features, not on the snapshot. Reported to the library.Issues
None of the 66 open issues tracks this setting.
How to verify
Local, after the rebase on
183a39f7f: fmt--checkexit 0, build--all-targetsexit 0, clippy--workspace --all-targets --locked -D warningszero warnings,cargo test --workspace10580 passed / 0 failed, doc-tests green.