You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 42e1f8d
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sessions): Search Sessions searches every session and whole conversations, title matches first
Three review findings in History search:
- Each conversation was cut to its first 400,000 characters before matching, so a phrase later in
a long or often-resumed session was never found. The whole conversation is matched now; the
cache is bounded by the characters it holds in all (20M, least recently used out first) rather
than by cutting each session.
- Only the newest 150 sessions were searched, title matches included, and the quick pick had no
way to reach the rest. searchStep(query, {from, readMax}) now reads conversations a batch at a
time (50) and returns where to go on. Its first step reports every title or preview match in
the index with no read. search() runs every step; the quick pick runs them in the background,
re-ranks as each lands, stops when the query changes or the pick closes, and says "no session
mentions" only after every session was searched.
- The limit was applied while scanning, before title matches were put first, so 40 newer matches
in the conversation pushed out an older exact title match. rankSearch ranks first, then cuts.
Tests over a store of 163 sessions: a match in the second-oldest conversation, a phrase past the
first 400,000 characters, an older title match ahead of 40 newer ones under limit 5, steps that
add up to search(); and the quick pick reaching past the first batch and dropping a superseded
query's scan. The test that pinned scanMax is replaced.
big.recordTurn(turn('Quokka migration plan','Planned in three steps.'),'m');constidQuokkaTitle=big.liveId();big.seal('done');
252
+
big.recordTurn(turn('Look at the old importer','Its retry loop is fine. The wombat flag is never read.'),'m');constidWombat=big.liveId();big.seal('done');
253
+
// one long conversation: the phrase is in its last turn, past the first 400,000 characters
254
+
constlong=[];for(leti=0;i<9;i++){long.push(...turn('Step '+i+' of the long refactor','x'.repeat(50000)));}
255
+
long.push(...turn('One more thing','The numbat cache is warmed at boot.'));
constsettled=async()=>{constend=Date.now()+3000;while(Date.now()<end){awaitnewPromise((r)=>setTimeout(r,20));if(!qp.busy){return;}}thrownewError('the search never finished');};
263
+
qp._h.change('platypus exporter');
264
+
awaitsettled();
265
+
assert.deepStrictEqual(qp.items.map((x)=>x.id),[oldId],'the oldest of 60+ sessions, past the first batch');
0 commit comments