Repository navigation
Backpressure paper streams and distinguish frozen outcomes - #1084
Merged
seathatflowsinourveins merged 5 commits intoOct 14, 2026
Merged
Conversation
This was referenced Oct 13, 2026
seathatflowsinourveins
force-pushed
the
foundation/paper-stream-backpressure-20261013
branch
from
October 13, 2026 21:24
e6771e0 to
12719ff
Compare
5 tasks done
seathatflowsinourveins
force-pushed
the
foundation/paper-stream-backpressure-20261013
branch
from
October 14, 2026 03:49
12719ff to
9084d29
Compare
seathatflowsinourveins
deleted the
foundation/paper-stream-backpressure-20261013
branch
October 14, 2026 21:23
5 tasks done
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.
Scope
A bounded quote queue could overflow while the native owner loop was briefly
blocked, then a flat run could be reported as having no signals. Use alpaca-py's
awaited handler contract to backpressure the existing queue and distinguish
observed stream failures as
stream_frozen. Keep quote-stale-only quiet-marketends distinct, preserve pending received order events during reconciliation,
and refuse irreversible observation loss through recovery's final send boundary.
59899aaf32535032fadc4e208d36e7811195e691(Separate extended-hours paper startup readiness from order freshness #1097 landed first).lane:trading.regression modules, decision and source/evidence registrations.
9084d29bc193cfd152d570a15e97ac56b28a848d. Cued rebase retainsthe read implementation at12719fff with exactly one approved transport union:
Separate extended-hours paper startup readiness from order freshness #1097's selected-benchmark max_age plus this PR's stale-drop counter. The new
combined test exercises registered start30/benchmark5 with handler8/ping10,
strict order3 and irreversible-loss refusal for buys and owned sells.
transport default id differs in new context; its zero-context id matches,
all99 added/deleted lines are byte-equal and full source equals the measured
union. Both registries retain main/read-head keys and bind actual head bytes.
SOTA sources
Evidence-class table
Local commands run
Final landing checks (bounded idle scope, TMPDIR=/var/tmp):
Earlier read-head evidence retained below; it is not substituted for final checks.
The consolidated fail-before selection at
e6771e01ran20 tests, rc1 with11failures including subcases and two absent-counter errors. It reproduces the
quiet extended-hours mover classification,15-second handler wait, post-hook
recovery sell and native wire-guard gap. The unexplained frozen-flag case also
fails before correction and then retains generic needs_attention.
An initial454-test batch had three failures: the terminal receipt fixture needed
the new counter fields; two fill-dependent mover cases failed only in that
batch and pass isolated on both unchanged
e6771e01and fixed bytes. That failedbatch remains retained and is not reported as green. The final472 run above
passes after fixture/reference updates. No broker, credential, GO, unit or
account-state call; all test scratch is isolated.
Decision record
docs/decisions/2026-10-13-paper-stream-backpressure.mdThe pending-order counter overlaps the callback-held/queued handoff under the
state lock. Recovery checks observation integrity before and after awaited
authorization; the native final guard checks every registered integrity-loss
reason for buys and sells. Definitive-not-sent handling preserves
recovery_observation_integrity_lost. Fresh owned recovery exits remain permitted
through soft stale/reconnect admission pauses; no order is priced from stale data.
Stale-only quotes cannot prove a broken stream. A recorded quote SDK disconnect
followed by successful re-ack provides the selected separating signal. Other
nonstream refusals retain needs_attention. Stream failures remain sticky through
cleanup. Terminal receipts count blocked events once, stale quote skips and
successful reconnects; orderly shutdown may discard a callback-held event and
that shutdown discard is not separately counted or claimed lossless.
Host evidence
No sustained feed throughput, real reconnect timing, broker acceptance or
deployment is claimed. Private operating survey/receipt locators stay in
coordination. This PR must not deploy to extended-hours stages before the
consolidated correction passes its normal reads and lands.
Checklist
original PR rows re-registered, patch ids recorded in coordination.
Follow-ups