Repository navigation
search: a running reply past 20,000 characters is indexed once - #279
connorburgess wants to merge 5 commits into
Conversation
sessionpipe sends a running turn's reply in turn.progress with its end
kept ("…" and the last 19,999 characters) once it passes 20,000
characters. The continuation check hashes the text's start, which moves
with every progress, so each later progress was indexed whole again and
so was the head-capped turn.transcript: a 34,889-character reply came to
98,997 indexed characters.
The cursor now also keeps two fingerprints of the end of the last reply
text seen (its last 64 and last 1,024 characters). A kept-end progress
whose start does not continue is searched for that end, and when it holds
it exactly once only what follows is indexed; how much of the reply's
start is indexed grows with it, so the head-capped transcript adds
nothing already indexed. A kept end that cannot be joined is indexed
whole, as before, and stops the start from growing.
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
The capped progress reply indexing fix still applies to SessionPipe GUI v0.8.18. Merged current Added the previously deferred Unreleased changelog entry. Validation on this head, macOS / Node 22.23.2:
GitHub CI run 47453787549 for head Also checked the combined source/test changes from all 19 refreshed PRs on the same main: no source conflicts; typecheck, lint and build passed; all 252 unit-test files passed (3,439 tests, two skipped). This was a local integration check, separate from the individual PR run above. Release-note entries may still need combining as PRs land. Merge blocker: confirmed loss of searchable text. The description already notes that an exact repeated 1,024-character ending after a large progress gap can be mistaken for an overlap. I reproduced this on the refreshed head: a marker present in the received progress is not indexed. The same regression probe passes with current main's Reproduction using the existing events adapter test helpers: const p1 = Array.from({ length: 1800 }, (_, i) => `prior${i}`).join(" ");
const gap = Array.from({ length: 6000 }, (_, i) => `later${i}`).join(" ");
const full = `${p1} ${gap} mustfindmarker ${p1.slice(-1024)} finalword`;Send Keeping the PR as draft until overlap detection can retain that text, or the optimization is narrowed to cases where continuity can be established. The refresh preserves the original implementation; it does not fix this blocker. |
…is found A progress more than 20,000 characters past the last one no longer holds that text's end. When the reply then repeated its last 1,024 characters once, the join was made at the copy and the text kept before it was not indexed. The cursor now also keeps fingerprints of the last text's final 1,024, 2,048, ... characters. A join is made only when every whole 1,024 characters the progress keeps before it match, and never when it keeps more before the join than the last text held. Otherwise the progress is indexed whole, as before. Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
Follow-up to my earlier comment, which held this PR as a draft because a repeated 1,024-character ending after a jump of more than 20,000 characters made That case is fixed in aaa302b9. The cursor now also keeps
Also merged current CI run 47497358863 for head Locally on With the blocker resolved, this is marked ready for review. |
Updated against v0.8.19 / main
e8bfe999on 2026-12-05. Current validation and refresh details.What
When a turn's reply runs past 20,000 characters, search now indexes each running piece once. Before, every later
turn.progresswas indexed whole again, and so was the finalturn.transcript. A 34,889-character reply came to 6 reply documents and 98,997 indexed characters. A word near the start was in 3 of those documents and a word in the middle was in 5.Why
sessionpipe caps reply text in
packages/core/src/privacy/filter.ts(capText), in two ways:turn.progresskeeps the end (capTail):…followed by the last 19,999 characters.turn.transcriptkeeps the start (cap): the first 20,000 characters followed by….A running turn sends a progress event at most every 20 s, and each one carries the whole reply so far. In
server/search/sources/events.ts, the continuation check compares a fingerprint of the text's first 64 characters with the last text's (fp(asst, pg.a) === pg.h). Once the reply is capped, its start moves with every progress, so the check fails and the whole capped text is indexed again. The head-capped transcript starts differently from the last progress, so it is indexed whole too. This breaks the contract inevents.test.ts: "progress pieces and the final transcript never repeat a word".Fix
All of the change is in
server/search/sources/events.ts.efor its last 64 characters,ffor its last 1,024, andl, a list with one fingerprint for each of its last 1,024, 2,048, 3,072, … characters (19 numbers at most). These are hashes, never words, likeh.…, is at least 20,000 characters, and does not continue from its start) is searched for that end. The join is made only if the end appears exactly once, every whole 1,024 characters the progress keeps before it matchl, and the progress does not keep more before it than the last text held. Then only the text after it is indexed.pg.a, which says how much of the reply's start is indexed, then grows by that amount. When the head-capped transcript comes, its first 20,000 characters are already covered, so it adds nothing.g), sopg.astops growing from then on.{ n, u, a, h }only. Withoute, the first new text simply records it, and joining starts from the next one.Not changed here:
parent_idset) are indexed as before: every text is indexed whole, because the cursor tracks the parent's turn only. The repeat after the cap happens there too, and needs a cursor per child.The source and test files remain independent of #277, which changes
server/search/sources/text.ts.An entry is now included under Unreleased in
CHANGELOG.md. Other open PRs also add release notes; those entries may need combining as the PRs land.Proof
New tests in
server/search/sources/events.test.ts, under "a reply past sessionpipe's 20,000-character cap". Each one builds the events with the same two caps as core.{ n, u, a, h }is passed back. Progress at 19k and 24k and the transcript then index no word twice, and the cursor holds numbers only.26ca736d).With
server/search/sources/events.tsfrom origin/main (6165bed), the same test file:The other five new tests pass on origin/main too, because it indexes those texts whole. They guard against the join losing words. A first version of this branch matched only the last 64 characters and took the first match. It failed the gap test, and the 1,024-character check is why it now passes.
On this branch:
npm run typecheckexits 0.npm run lintexits 0 withChecked 983 files … Found 135 warnings.and no errors, the same count as on origin/main.Checklist
git commit -s).npm run typecheck && npm run lintpass;npx vitest run server/searchpasses (the wholenpm testwas not run).shared/*.CHANGELOG.md.