GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(server): avoid thread-wide scans for message projection by juliusmarminge · Pull Request #1647 · pingdotgg/t3code

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Apr 1, 2026 •
edited by macroscopeapp Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

  • add keyed projected-message lookup support in the projection repository
  • stop loading every thread message row for each thread.message-sent projection update
  • extend repository coverage for the new lookup path

Stack

  • base: oxc stack #1 in this stack (codex/backend-perf-queries)

Validation

  • bun run test src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProjectionPipeline.test.ts
  • bun run test src/orchestration/Layers/ProjectionSnapshotQuery.test.ts src/checkpointing/Layers/CheckpointDiffQuery.test.ts src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProjectionPipeline.test.ts src/orchestration/Layers/OrchestrationEngine.test.ts src/orchestration/Layers/CheckpointReactor.test.ts src/orchestration/Layers/ProviderRuntimeIngestion.test.ts src/orchestration/Layers/ProviderCommandReactor.test.ts
  • bun fmt
  • bun lint
  • bun typecheck (currently fails in apps/web due pre-existing @effect/atom-react / Layer.suspend errors)

Note

Medium Risk
Changes the thread.message-sent projection write path to depend on a new getByMessageId query instead of scanning all messages in a thread, which could subtly affect message text/attachment merge behavior if the lookup or Option handling is incorrect.

Overview
Improves message projection performance by avoiding per-event thread-wide reads when handling thread.message-sent.

Adds a keyed ProjectionThreadMessageRepository.getByMessageId API (service + SQLite implementation) and refactors the projector to fetch only the prior row for that message to compute streaming text updates and attachment retention/clearing. Tests are extended to cover the new lookup path alongside existing attachment-preservation behavior.

Written by Cursor Bugbot for commit d64edba. This will update automatically on new commits. Configure here.

Note

Replace thread-wide message scan with direct lookup by messageId in projection pipeline

  • Adds getByMessageId to ProjectionThreadMessageRepository (ProjectionThreadMessages.ts), returning Option<ProjectionThreadMessage> via a targeted SQL query instead of listing all thread messages.
  • Updates the thread.message-sent handler in ProjectionPipeline.ts to use this new lookup, eliminating a full thread scan per message event.
  • Introduces a shared toProjectionThreadMessage helper to consolidate row-to-domain mapping used by both listByThreadId and getByMessageId.

Macroscope summarized d64edba.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Apr 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cc8271a2-c88d-4bae-9276-d15ac875f896

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/backend-perf-message-projection

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Apr 1, 2026
@juliusmarminge juliusmarminge mentioned this pull request Apr 1, 2026
perf(desktop): reduce startup load time by ~95% #1650
Closed
2 of 4 tasks
@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-queries branch from 0e0bad4 to dbbf25c Compare April 1, 2026 16:37
@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-message-projection branch from f07a69d to ed2220e Compare April 1, 2026 16:37
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 1, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Apr 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Performance optimization that replaces a thread-wide message scan with a direct message ID lookup. The business logic is preserved and restructured using Effect's Option utilities. The PR author owns this code and tests are included.

You can customize Macroscope's approvability policy. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-message-projection branch from ed2220e to acc331e Compare April 1, 2026 16:59
@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-queries branch from dbbf25c to 03d24d6 Compare April 1, 2026 16:59
@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-message-projection branch from acc331e to f23d141 Compare April 1, 2026 17:06
Base automatically changed from codex/backend-perf-queries to main April 1, 2026 21:41
@macroscopeapp
macroscopeapp Bot dismissed their stale review April 1, 2026 21:41

Dismissing prior approval to re-evaluate f23d141

@juliusmarminge @codex
perf(server): avoid thread-wide scans for message projection
059ff5b
Co-authored-by: codex <[email protected]>
@juliusmarminge
juliusmarminge force-pushed the codex/backend-perf-message-projection branch from f23d141 to 059ff5b Compare April 1, 2026 21:41
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 1, 2026
View reviewed changes
@juliusmarminge @codex
Refactor projection message Option handling
d64edba
Co-authored-by: codex <[email protected]>
@macroscopeapp
macroscopeapp Bot dismissed their stale review April 1, 2026 21:45

Dismissing prior approval to re-evaluate d64edba

macroscopeapp[bot]
macroscopeapp Bot approved these changes Apr 1, 2026
View reviewed changes
@juliusmarminge
juliusmarminge merged commit 4963fcc into main Apr 1, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge deleted the codex/backend-perf-message-projection branch April 1, 2026 21:48
@juliusmarminge juliusmarminge mentioned this pull request Jun 16, 2026
Optimize streaming message projection path #1688
Closed
youpele52 referenced this pull request in youpele52/bigbud Jun 17, 2026
@juliusmarminge @codex
perf(server): avoid thread-wide scans for message projection (#1647)
cb9f36e
Co-authored-by: codex <[email protected]>
@cheruvian cheruvian mentioned this pull request Aug 8, 2026
[Bug]: Assistant streaming causes full-thread projection scans for every text delta #5719
Closed
NeilTheFisher pushed a commit to NeilTheFisher/t3code that referenced this pull request Aug 18, 2026
@juliusmarminge @codex
perf(server): avoid thread-wide scans for message projection (pingdot…
b296fb0
…gg#1647)

Co-authored-by: codex <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.