Skip to content

Conversation search: index a growing transcript incrementally, debounced to one pass per 30 s - #374

Merged
SSFSKIM merged 4 commits into
masterfrom
fix/search-text-incremental
Oct 30, 2026
Merged

SSFSKIM merged 4 commits into
masterfrom
fix/search-text-incremental

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 30, 2026

Copy link
Copy Markdown
Owner

The search index re-read a transcript's whole text from byte 0 (fs.sessionText) every time its size changed, so a large transcript a terminal session was writing cost seconds of CPU per append. This makes the pass incremental.

  • Resume. The index stores a checkpoint with a ready text: the byte offset after the last consumed line, the inode, a sha1 of the first and of the last 4 KiB before the offset, and whether a text block has been produced (the next block's \n separator). fs.sessionText takes it back as resume and answers from (0 for a full pass) and, on the last page, the next checkpoint. The host resumes only when the inode is the same, the file is at least the offset long and both digests match; otherwise it reads from byte 0 and the index replaces the text. A resumed pass re-checks the prefix at its end and fails (then retries as a full pass) if it changed meanwhile.
  • Equality with a full pass. Lines are split on \n in the worker (readline is gone) so the offset is exact in bytes. A line counts as consumed once it ends in \n, or, for the unterminated last line, once it parses as JSON; a torn line is left for the next pass, which starts at it. A pass cut short clears the checkpoint, so the next one is a full pass.
  • Debounce. A transcript already indexed in this run is re-indexed no sooner than SEARCH_REINDEX_DEBOUNCE_MS (30 s, src/services/index/source.ts) after its last pass finished; bursts of appends coalesce into one pass of the latest state. First indexing after a start is immediate.
  • Schema and wire. Index migration 15 (session_text_state.resume); WIRE_MINOR 8 with the manifest regenerated (fs.sessionText gains optional resume input and from/checkpoint output). engine-host/fs/service.ts gets a two-line pass-through of resume (searchText).

Measured on a 383 MB synthetic transcript (this MacBook, loaded): one append cost about 1.0 s of CPU before (a full pass, 1.05 and 1.02 s in two runs) and about 1 ms after, reading 4.3 KB of appended lines plus four 4 KiB fingerprint spans.

Not covered, by design: an in-place, same-length rewrite of a transcript's middle that touches neither fingerprint span (logged in docs/tech-debt-tracker.md).

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

…ost resumes fs.sessionText at the stored checkpoint (offset after the last consumed line, inode, a digest of the head and of the bytes before the offset) and the index appends; a replaced, truncated or rewritten file gets a full pass; a transcript indexed in this run is re-indexed at most once per SEARCH_REINDEX_DEBOUNCE_MS (30 s). Index migration 15 (session_text_state.resume); wire minor 8 (fs.sessionText resume, from, checkpoint)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… fails and retries as a full pass; the same-length in-place rewrite the cheap check cannot see goes to the tech-debt tracker

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…de tests: the rewound version-13 file lacks session_text_state.resume, and the upgrade applies 14 and 15

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:29:07.176806Z 137702d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM merged commit b3fef97 into master Oct 30, 2026
SSFSKIM added a commit that referenced this pull request Oct 30, 2026
…ntal search text (#374); O3 Decision Log 20: O3-E's document landed (#375), executing

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 30, 2026
…-load; the window's fields take WIRE_MINOR 9 beside #374's resume

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 30, 2026
…E's document)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant