Repository navigation
Load a send identity's candidates once per execution (#1014) - #1125
Merged
Merged
Conversation
MessageStream::recordedSend listed every exactly matched outbound row for the identity on each send, so a workflow repeating one send N times did 1+2+...+N row reads per replay. MessageReplayLedger now keeps the matched list per identity for the execution (loaded once, extended with rows the execution writes via rememberSend) and the send takes its offset from it. No durable schema or matching change; the ledger is per execution as before. V2MessageStreamReplayTest::testReplayingIdenticalSendsLoadsTheirCandidatesOncePerExecution: one candidate query for 2 and for 8 identical sends (base: 2 and 8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
message-stream-identical-sends-load-once: six identical sends in one turn; a query replay loads that identity's candidates once (base: six times). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Security PASS at 272dc02, on green CI.
Non-blocking: the cached rows are model instances from the first load. If a caller ever reads mutable columns from the returned row, such as |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Closes #1014.
Problem:
MessageStream::recordedSendlisted every exactly matched outbound row for the send identity on each send, then took the offset-th. A workflow that repeats one send N times therefore read 1+2+…+N rows per replay, and ran N candidate queries.Change:
MessageReplayLedgerkeeps the matched list per send identity for the execution. It loads once through the same narrowing query and exact field comparison, andrememberSend()extends it with the rows the execution writes. The send takes its offset from that list. There's no durable schema change and no matching or ordering change. The ledger is per execution, as before, so nothing is reused across attempts or runs.recordedReceiveis unchanged: live consumption at a step can add rows during the execution, so caching it would need its own invalidation, and the issue's measured cost is the send path.Tests:
V2MessageStreamReplayTest::testReplayingIdenticalSendsLoadsTheirCandidatesOncePerExecution: one candidate query for both 2 and 8 identical sends (base: 2 and 8).message-stream-identical-sends-load-oncewith consumertestMessageStreamIdenticalSendsCorpusLoadsCandidatesOncePerReplay: six sends give 1 load (base: 6). The cold-replay runner passes the fixture.V2MessageStreamReplayTest20,MessageServiceTest,MessageStreamTest,MessageStreamCursorTest,V2MessageCursorContinueAsNewTest,V2MessageStreamAuthoringTest).🤖 Generated with Claude Code