-
Notifications
You must be signed in to change notification settings - Fork 0
fix(engine): replay missing venue submissions #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(engine): replay missing venue submissions #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| for _, emission := range emissions { | ||
| action := emission.action | ||
| latestForEmission := emission.latest | ||
| emit := true | ||
|
|
||
| if fillSnapshot != nil && latestForEmission != nil { | ||
| action, emit = e.adjustActionWithTracker(currency, oid, *latestForEmission, action, fillSnapshot, orderLogger, emission.skipExisting) | ||
| if !emit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip tracker-driven take-profit adjustments without 3C action
The call to adjustActionWithTracker now runs only inside the for _, emission := range emissions loop. Because an emission is added earlier only when shouldEmit or needsReplay is already true, any order where reduceOrderEvents returns ActionNone but the fill tracker needs to create/resize a take-profit (the common case when a position changes with no new 3Commas events) no longer reaches this block. In the previous version the tracker adjustment executed before deciding whether to emit and could flip ActionNone into a create/modify. After this refactor those tracker-driven actions are silently skipped, so take-profit orders will stop being placed or resized when the tracker is the only source of change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex provide a fix, keep the spec in mind specs/multi_venue_emission.adoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Reapplied fill tracker adjustments before emission gating so tracker-driven take-profit changes can still promote
ActionNoneinto creates or modifies when no direct 3Commas action is pending. engine/engine.goL286-L303
Testing
⚠️ go test ./...(terminated after hanging in the container).⚠️ go test ./engine...(terminated after hanging in the container).
Reapplied fill tracker adjustments before emission gating so tracker-driven take-profit changes can still promote ActionNone into creates or modifies when no direct 3Commas action is pending.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
bddc312
into
codex/investigate-multi-wallet-support-for-hyperliquid
Summary
Bug context
The new multi‑venue loop only attempts to replay a create when
reduceOrderEventsreturnsshouldEmit == false. When at least one submission already exists,hasLocalOrderbecomes true andreduceOrderEventswill emit modify/cancel actions for subsequent events. BecausereplayMissingTargetsis only computed when!shouldEmit, the branch that converts the action to a create formissingTargetsis never taken in this case, andresolveOrderTargetsskips the venues with no recorded submission. If a create to one venue fails (or a venue was added after the first create) and a modify/cancel event arrives before a no‑op poll, the engine will never send a create for the missing venue, leaving that venue permanently out of sync. The dispatcher rejects work for unregistered venues, but this code path simply omits the work entirely. Consider replaying missing venue submissions even when the current 3Commas action is modify/cancel.Read
specs/multi_venue_emission.adochttps://chatgpt.com/codex/tasks/task_e_6909752e80088326acc171ddcf989f9a