Repository navigation
Conversation
A restarted session adopts the executors a dead session of its strategy left RUNNING (CORR-726), and the risk gate counts them — but the snapshot line and the canvas nudge still read the provider's session-scoped rows, so they reported a book smaller than the one the gate protects. `_book_totals` is now the one place the provider rows and the adopted rows are summed; the gate, the snapshot and the prompt all read it.
[Medium impact] The PR appears safe to merge; the previous loss-limit issue is fixed. SummaryCounts adopted executors alongside this session's own executors through
Reviews (2) · Last reviewed commit: "fix(agents): keep drawdown's exposure in..." · Reviewed by Greptile |
The snapshot's exposure is the denominator of a drawdown over the provider's PnL, which excludes adopted executors. Counting their size there diluted the percentage — a $100 loss on $1,000 of own positions against $9,000 adopted read 1% instead of 10% — so pause and shutdown limits could stop firing. The book exposure still feeds the risk gate; the snapshot records the book's open count, and its exposure stays paired with the PnL it divides. The journal summary reads the same book count, so the two lines agree.
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.
A restarted session adopts the executors a dead session of its strategy left RUNNING (CORR-726):
_adopt_running_executorsfeeds them into the tick's snapshot, the stop gate allows them, and the risk gate counts their exposure. Three other reads still used only the provider's rows, which are fetched under this session's owncontroller_id— so they reported a book smaller than the one the gate protects:open=<provider only>;_book_totals()is now the one place the provider rows and the adopted rows are summed, and the gate, the snapshot, the summary and the prompt all read it.The snapshot's exposure deliberately stays the provider's own. It is the denominator of
get_drawdown_pct_checked, which divides the provider's PnL — a figure that excludes adopted executors — so counting adopted size there would dilute the percentage (a $100 loss on $1,000 of own positions against $9,000 adopted would read 1% instead of 10%) and configured pause/shutdown limits could stop firing. The book exposure still feeds the risk gate, where it is only compared against limits and never divided by a session-scoped PnL.Tests: three cases in
tests/test_executor_adoption.pypin the arithmetic (_book_totalsignores malformed rows), the snapshot's book count, and the scoped exposure. Full file: 40 passed. Full suite: 8050 passed; the 6 failures present are identical on a cleanupstream/mainand unrelated (conversation listing, host load, timing probes).