feat: autoCaptureContextTurns rolling context window for extraction - #966
Open
gorkem2020 wants to merge 1 commit into
Open
feat: autoCaptureContextTurns rolling context window for extraction#966gorkem2020 wants to merge 1 commit into
gorkem2020 wants to merge 1 commit into
Conversation
…PR 966, composed with master's reconcile-with-kept-texts and protected-prefix contracts)
gorkem2020
marked this pull request as ready for review
August 25, 2026 08:49
gorkem2020
force-pushed
the
feat/autocapture-context-turns
branch
from
August 25, 2026 08:49
ed2d3e4 to
9409506
Compare
Contributor
Author
|
Recomposed against current master after #988 merged: the branch now carries a single commit with only this family's delta (rolling pair window: trimTurnsToUserCap, dedupePairWindow, the autoCaptureContextTurns knob and pair-window wiring). The two earlier commits are gone because their content already landed on master via #942 and #965. Full suite green locally. |
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.
Problem
In steady state (history-carrying sessions extract every turn) each extraction transcript contains only that call's own turns. The extractor never has the surrounding conversation, so it cannot resolve references ("yes exactly, that one", "make it the second option") and either drops the fact or stores a hollow one.
Change
A rolling pair window retains conversational context across extractions:
autoCaptureContextTurns(new knob): 0 (the default) disables retention entirely and preserves stock behavior byte-for-byte; 1 to 10 sets the window size, decoupled from theextractMinMessageswarm-up gate.trimTurnsToUserCap, which never trims this call's own unextracted turns out of their transcript and never leaves an orphan assistant turn ahead of the window's first user turn.dedupePairWindowrepairs double-included pairs: a below-threshold deferral keeps content alive on two paths (the rolling buffer and the watermark rollback or ingress re-queue), and the repair collapses duplicate exchanges at pair granularity while keeping legitimately repeated user messages whose replies differ.Tests
test/pair-window-retention.test.mjs(full-pipeline harness over a mock LLM and embedding server): retention across successful extractions, window bounding, knob-0 wipe, absent-knob default. Unit coverage fortrimTurnsToUserCapanddedupePairWindowintest/auto-capture-cleanup.test.mjs; manifest schema checks pin the 0 default. Registered in the test chain and CI manifest.Stacked on #965; the diff includes its predecessors until they merge.