Skip to content

fix(server): stop routine events from rescanning thread history - #8150

Merged
t3dotgg merged 2 commits into
mainfrom
t3code/improve-stream-mode-fixes
Aug 25, 2026
Merged

fix(server): stop routine events from rescanning thread history#8150
t3dotgg merged 2 commits into
mainfrom
t3code/improve-stream-mode-fixes

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 25, 2026

Copy link
Copy Markdown
Member

Assistant messages and routine tool activity reload complete thread histories even when no thread summary can change. This slows both the default buffered mode and legacy streaming, and busy threads can delay other conversations.

Skip the summary refresh for assistant messages and routine activities. Keep existing refreshes for user messages, approvals, user input, plans, session changes, and reverts.

Thanks to @cheruvian for #5855, @dain for #7356, and @maria-rcks for #7486.

Fixes #4008.

Checks:

  • vp test run apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts
  • vp run --filter t3 typecheck
  • vp check apps/server/src/orchestration/Layers/ProjectionPipeline.ts apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts

Model and harness: GPT-5.6 Sol in Codex.


Note

Medium Risk
Changes when derived projection_threads summary columns update; anything expecting fresh counts after assistant or routine tool activity may stay stale until a user message or allowlisted event.

Overview
Stops expensive thread shell summary refreshes on events that cannot change sidebar/summary fields (latestUserMessageAt, pending approval/input counts, actionable plans).

Adds shouldRefreshThreadShellSummary and uses it before refreshThreadShellSummary in the shared message/activity/plan handler. Assistant thread.message-sent events and most thread.activity-appended kinds (e.g. tool.updated) no longer trigger a full history rescan; user messages and allowlisted approval/user-input activity kinds still do. Session, revert, and proposed-plan paths are unchanged.

The projection pipeline test uses a projection_threads update trigger to assert assistant messages and routine tool activity each produce only the lightweight updatedAt upsert—not an extra summary refresh.

Reviewed by Cursor Bugbot for commit ec7c00a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Guard refreshThreadShellSummary call in applyProjectsProjection to skip routine events

Introduces shouldRefreshThreadShellSummary to decide whether a given event warrants a thread shell summary refresh. It returns true for user messages and a specific set of activity kinds (approval.requested, approval.resolved, provider.approval.respond.failed, user-input.requested, user-input.resolved, provider.user-input.respond.failed), and false for assistant messages and other activity kinds.

  • Replaces the unconditional refreshThreadShellSummary(threadId) call in ProjectionPipeline.ts with a conditional call guarded by this function. The thread row upsert with updatedAt still runs on every event.
  • Adds a test in ProjectionPipeline.test.ts using a SQL trigger to count projection_threads updates, verifying that a user message triggers one refresh and a subsequent tool.updated activity does not trigger an additional one.

Macroscope summarized ec7c00a.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

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 Plus

Run ID: 8db5e17a-95a7-445e-b284-86a46aab3afa

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.4 KiB 13.3 KiB −100 B (−0.7%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB −5 B (−0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB −95 B (−1.4%) 7.8 KiB
Codex Live turn WebSocket decoded 55.0 KiB 55.6 KiB +602 B (+1.1%) 66.4 KiB
Codex Live turn messages 16 11 −5 (−31.3%) 21
Claude Total thread wire 13.4 KiB 13.3 KiB −105 B (−0.8%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB +6 B (+0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.4 KiB −111 B (−1.7%) 7.8 KiB
Claude Live turn WebSocket decoded 55.8 KiB 56.4 KiB +620 B (+1.1%) 66.4 KiB
Claude Live turn messages 16 11 −5 (−31.3%) 21

Baseline: 9996038 · PR result: ec7c00a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 25, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

A prior Macroscope approval was dismissed. Re-evaluating ec7c00a

@macroscopeapp
macroscopeapp Bot dismissed their stale review August 25, 2026 00:48

Dismissing prior approval to re-evaluate ec7c00a

@t3dotgg
t3dotgg enabled auto-merge (squash) August 25, 2026 00:49
@t3dotgg
t3dotgg merged commit c034f51 into main Aug 25, 2026
23 checks passed
@t3dotgg
t3dotgg deleted the t3code/improve-stream-mode-fixes branch August 25, 2026 00:50
BarretoDiego added a commit to BarretoDiego/t3code that referenced this pull request Aug 25, 2026
- Evita que eventos de rotina reprocessem o histórico da thread (pingdotgg#8150) no ProjectionPipeline
- Ajusta a lógica de projeção em `orchestration/Layers/ProjectionPipeline.ts` (+27 linhas)
- Adiciona cobertura de testes nova em `ProjectionPipeline.test.ts` (+72 linhas)
- Atualiza expectativas do teste do `ClaudeAdapter` para acompanhar a mudança
- Sem conflitos: merge automático limpo, modificações do fork preservadas

Sync automatico t3code-sync em 2026-08-24T22:15:01-03:00
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 25, 2026
## What's Changed
* fix(server): stop routine events from rescanning thread history by @t3dotgg in pingdotgg/t3code#8150
* fix(deps): stop pnpm installs from changing the lockfile by @t3dotgg in pingdotgg/t3code#8163


**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260825.1180...v0.0.34-nightly.20260825.1181

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260825.1181
frankdavidcorona pushed a commit to frankdavidcorona/t3code that referenced this pull request Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Streaming assistant deltas rescan full thread activity history

1 participant