Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 2, 2026
Merged
This branch has not been deployed
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 changed
Native account snapshots dropped peak/drawdown facts before account admission. Carrying those facts into the old target scaler could turn a matching holding target into a liquidation plan while the portfolio stop-loss switch was off.
Preserve whole-account equity and native drawdown facts through the strategy projection, and restore/persist a drawdown OPEN in the existing physical-account submission journal before execution or a no-target return. With
PORTFOLIO_LOSS_STOPLOSS_ENABLEDoff, a drawdown brake preserves the supplied targets and blocks new positions/adds without creating reduction targets. With it on, the existing scaling/reduction path remains available. Recovery, CLOSED projections and untrusted reset flags cannot clear the latch. Real buys bindnew_risk=Trueinto PREPARED and are checked again at dispatch.How verified
Validation used synthetic inputs, local journals, an allowlisted environment and inherited seccomp network denial:
Companion library draft: QuantStrategyLab/QuantPlatformKit#768. Consumer dependency pins, switch defaults, risk parameters and production configuration are unchanged. Missing QPK latch capability fails closed for real new risk; this draft is not independently deployable with an older pin. Inner dry-run previews without a session explicitly report persistence as NOT_PROVEN. Authentic initial state, old-writer quiescence, deployed consumer identity, real store readback and real orders/fills remain NOT_PROVEN. No broker/cloud access, deployment or live enablement was performed.
Hosted readback:
testcompleted with FAILURE at its unit-test step;tqqq-offline-riskcompleted with SUCCESS. The unchanged QPK pin6136b1c667a60d484f500c6d6046c0585c75305dhas AccountSubmissionSession but lacks both the new latch API and thenew_riskreserve keyword (verified from the exact pinned source). Full hosted failure-log retrieval timed out, so this source comparison is not a claim to have classified every CI failure. No assertion was skipped or relaxed, and pins remain unchanged as required. The risk gate remains failed pending the established approval/review process; the template check now passes.AI assistance
Authored with OpenAI Codex (job configuration: gpt-6.1-sol, high). Independent review and hosted-CI acceptance belong to the established code-review-and-merge bot; no independent review is claimed here. Keep this PR in draft.