Skip to content

Refactoring simple FSM order_execution_round.py#114

Draft
Karrenbelt wants to merge 5 commits intomainfrom
refactor/order_execution_round
Draft

Refactoring simple FSM order_execution_round.py#114
Karrenbelt wants to merge 5 commits intomainfrom
refactor/order_execution_round

Conversation

@Karrenbelt
Copy link
Collaborator

@Karrenbelt Karrenbelt commented Jul 5, 2025

This is mainly a refactor PR, as the logic was overly convoluted, making it unnecessarily hard to understand what was going on. All logic is still the same, including exception logic and all other branching behaviors, with one notable exception. There is a bug fix in this PR in the _handle_cancelled path:

  • Previously, a CANCELLED order with zero fill fell through and returned None (falsy), unintentionally treated as failure
  • Now explicitly return True when filled_amt == 0. Need to confirm this now is preserving intent, or otherwise return False

It also includes several improvements to the logging, which was the original reason I looked into this (and the other) behaviours of the simple FSM skill.

Comment on lines +266 to +267
# what do we return here??
return True
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug fix i referred to. Previously, only when the double if was hit this function returned a boolean (hence, implicitly returned None previously when the nested if statements weren't hit)

Base automatically changed from chore/simple_fsm_logging to feat/improve_logging July 10, 2025 09:45
Base automatically changed from feat/improve_logging to main July 10, 2025 12:21
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