Keep active-turn prompts visible in budgeted timelines - #1639
Draft
brsbl wants to merge 1 commit into
Draft
Conversation
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.
Summary
Reproduce on base
Use a scratch checkout of this PR; the commands temporarily replace only the production timeline implementation with the exact PR base while retaining the regression assertions. Do not run them in a shared working tree.
Expected on base: the suite fails because the budgeted latest window contains newer work rows but omits the accepted initiating user conversation row. The event-count case fails at
bounds a running turn while keeping its initiating user message; the byte-only case fails atkeeps latest byte-page row identities stable while a turn grows.Restore the PR implementation and rerun:
Expected on this PR: both targeted tests pass. The full file passes 22/22. The active-turn prompt remains present on latest and older event-count and byte-budget pages while internal work stays bounded.
Cause and fix
When the 1,500-event budget or 4 MiB byte budget cut inside an unfinished turn, the selected event window began after
client/turn/requestedandturn/input/accepted. The projector therefore had newer agent work but no input pair from which to build the initiating user row. A fresh client window could not recover it.The server now identifies the unfinished turn for either cut and adds its first accepted input plus matching client request as small context rows. Page cursors, work-row budgets, response schemas, and daemon/public protocols are unchanged. Older pages repeat the same stable prompt row, which the existing client merge contract deduplicates.
Verification
@bb/db,@bb/server, and@bb/app: passedBB-Thread-ID: thr_2xxfbvsr9r