Skip to content

perf(summaries): read lastActivity off the thread row, never a shard (#1475) - #1480

Merged
currentbits merged 1 commit into
mainfrom
coder/perf-f-summaries-no-transcript-reads-ccbf24
Oct 5, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/perf-f-summaries-no-transcript-reads-ccbf24

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part of #1475, main-process finding 2.

Before this change, threads:summaries read every transcript shard synchronously to find each thread's last assistant line. Now each thread row stores a lastActivity snippet:

  • Stamped from in-memory messages on every pushDetail. The transcript is already in memory there, so no disk read.
  • Read straight off the row when a thread's transcript isn't loaded.
  • Backfilled in the background for older rows that don't have it yet: it reads the last 64 KiB of the transcript file first, and the whole file only if the tail has no assistant reply.

lastActivity is removed from the threads:changed rows, so that push doesn't get bigger.

Verified independently:

  • Real data: cloned the live store plus its 2,097 message files. Output on main and on this branch is byte-identical for all 2,009 rows (Date.now and randomUUID frozen). The first call drops from 7.4 s to 4.7 ms.
  • Electron suite: 4131 of 4131 passing.
  • The new test file (threads-summaries.test.js) fails on main.

Trade-offs:

  • On the very first poll after upgrading, rows that haven't been backfilled yet show no snippet. The next poll has it.
  • thread-last-activity.js reads some of the Store's private fields (read-only). It's marked with a ponytail: comment, and the upgrade path is a public store.hasMessagesInMemory(id).

🤖 Generated with Claude Code

…1475)

threads:summaries read every cold transcript synchronously to find one
line (1,166 shards / 463 MiB / 2 s on the first Agents-panel open).
The row now carries lastActivity { text, at } | null: runner pushDetail
restamps it from in-memory messages, summaries recompute it only when
the transcript is already loaded, and unknown rows are backfilled once
with an async 64 KB tail read (whole-file fallback when the tail holds
no assistant message). listRow keeps the field off threads:changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 7acfbae into main Oct 5, 2026
6 checks passed
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