Repository navigation
search: a Gemini CLI reply re-appended under the same id is indexed once - #273
connorburgess wants to merge 3 commits into
Conversation
Symptom: a Gemini CLI reply that ran tools shows up several times in search: "Let me read the config." three times and its read_file line twice for one reply, so hit and match counts for the session are inflated. Cause: Gemini CLI's chat recorder appends a message's whole record again each time it updates it (tokens, tool calls scheduled, tool calls done), under the same id; its own loader keeps the last record per id. The search adapter turned every record into docs. Fix: the adapter state keeps the last 8 message ids, whether each one's text is indexed and the tool calls indexed for it (it survives read slices and is copied, never changed in place). A record under a known id adds only what was not indexed yet: its text if none was, and tool calls by id (a call without an id by its place in the list). 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 repeated Gemini message 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 47453785502 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. |
Updated against v0.8.18 / main
d16a2c01on 2026-12-05. Current validation and refresh details.What
History search indexes a Gemini CLI reply, and each of its tool calls, once. Before this, a reply that ran tools came back several times for one message (e.g. "Let me read the config." three times and its
read_fileline twice), inflating hits and match counts for the session.Why
Symptom: duplicate hits for Gemini CLI replies that ran tools.
Cause: Gemini CLI's chat recorder (
ChatRecordingService, checked in 0.70.0) appends a message's whole record tosession-*.jsonlagain every time it updates it: when the reply gains its token counts, when its tool calls are scheduled, and again when they complete, all under the sameid. The CLI's own loader keeps the last record per id.server/search/sources/gemini.tsturned every record into docs, and the builder/indexer do no dedupe.Fix: the adapter state now keeps the last 8 message ids, each with whether its text was indexed and the tool calls indexed for it. A record under a known id adds only what is not indexed yet: its text if none was (a first record with empty content still gets its text later), and tool calls by
id(a call without an id by its place in the list, so two identical calls in one message stay two). The state survives read slices and passes (returned asstate), and it is copied, never changed in place, so a read that fails and is retried from the stored cursor sees the same state. Keeping a few ids, not only the last, covers a message re-appended after a later user record. The whole-filesession-*.jsonandlogs.jsonpaths are unchanged in behaviour (their messages are unique by id). The file's header comment now describes the re-appends.An index built before this keeps its duplicate docs until it is rebuilt or the file is read again from the start.
Original proof (before the v0.8.18 refresh)
A recording made with Gemini CLI 0.70.0's own recorder (scratch home, no network) holds: header, user,
$set, gemini m1,$set, m1 again with tool calls scheduled, m1 again with them done, gemini m2,$set. The adapter over it, onmain: the m1 reply 3 times andread_file /w/tsconfig.json2 times. On this branch:Two tests in
server/search/sources/antigravity.test.ts(the "gemini cli" block), writing files in the recorder's shape:Both fail with
main'sgemini.ts:and pass on the branch:
The one failure is unrelated: the same test times out the same way in a full run with
main's files (Tests 1 failed | 3366 passed | 2 skipped (3369),TestTimeoutError: Test timed out in 15000ms.), and passes when run alone on this branch (Tests 11 passed (11)).Checklist
git commit -s): the DCO is the only paperwork.npm run typecheck && npm run lint && npm testpass;npm run test:e2efor a UI change. (Not a UI change; the onenpm testfailure is the parity timeout above, which also fails onmain.)// SPDX-License-Identifier: Apache-2.0. (No new files.)--demo).shared/*names the wire-contract change in the description. (Noshared/*change.)CHANGELOG.md.