Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/8150/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

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](https://cursor.com/bugbot) for commit ec7c00a5d3ebc93a513ffb63b504cbb0186231a5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.4 KiB13.3 KiB−100 B (−0.7%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB−5 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.5 KiB−95 B (−1.4%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.0 KiB55.6 KiB+602 B (+1.1%)66.4 KiB✅
      CodexLive turn messages1611−5 (−31.3%)21✅
      ClaudeTotal thread wire13.4 KiB13.3 KiB−105 B (−0.8%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB+6 B (+0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.6 KiB6.4 KiB−111 B (−1.7%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded55.8 KiB56.4 KiB+620 B (+1.1%)66.4 KiB✅
      ClaudeLive turn messages1611−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.

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      A prior Macroscope approval was dismissed. Re-evaluating ec7c00a…

Sign in to join this conversation.