[codex] Fix LongBridge paper and SG execution guards#137
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52628ca392
ℹ️ 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".
| try: | ||
| execution_already_recorded = bool(execution_state_store.has_marker(execution_marker_key)) |
There was a problem hiding this comment.
Reserve execution markers atomically before submitting orders
When two Cloud Run requests/retries for the same signal overlap, both can pass this has_marker() check before either has recorded the marker, then both enter execute_rebalance_cycle and submit the same live orders. The marker write happens only after execution and uses a normal overwrite, so it does not act as a lock or create-if-absent reservation; the duplicate-run guard is therefore ineffective exactly in the concurrent invocation scenario it needs to protect. Use an atomic create/reservation step (e.g. GCS generation precondition / local exclusive create) before order submission and treat an already-existing marker as a skip.
Useful? React with 👍 / 👎.
Summary
regime=risk_onin PAPER messages.Root Cause
Validation
PYTHONPATH=/home/ubuntu/Projects/QuantPlatformKit/src python - <<'PY' ... renderer localization smoke ... PYpython -m pytest tests/test_rebalance_service.py tests/test_runtime_composer.py tests/test_request_handling.py -qpython -m ruff check notifications/renderers.py tests/test_notifications.py application/execution_state.py application/rebalance_service.py application/execution_service.py application/runtime_composer.py application/runtime_dependencies.py notifications/telegram.py tests/test_rebalance_service.py tests/test_runtime_composer.py