Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): the working window and background groups stop rescanning the whole thread #32782

ClosedEntrpi(GitHub profile, opens in a new tab)wants to merge 250+ commits intomaria/redesign/2-composer-timeline fromrefs/pull/32782/headopened View on GitHub

Problem

When a tool call arrives in a long thread, the redesign's two post-derivation passes rescan the whole thread:

  • The working window filters every entry again, although row derivation has just done the same filtering, and it scans the whole thread for steer replies and compacted runs.
  • Background activity grouping maps every entry to its run and checks it for failures, even in threads with nothing to fold.

On an 8,600-item thread, the two passes cost 1.1–1.2 ms of each new item's update. Their own work only depends on the live turn and on any notifications.

Change

  • One filtered list per update. Row derivation and the working window share one filtered entry list. timelineRowEntries caches its result on the entries array, together with the six inputs it reads.
  • Working window: it collects steer replies from the last response boundary only. That scan starts over at each boundary, so the result for the window's entries is the same. It gathers compacted runs only when a resume-compaction answer needs them.
  • Background grouping: it looks for notifications first and returns right away when there are none. Only then does it map entries to runs and check exclusions.

This is independent of #32756 and #32769. All three target this branch.

Scope and approval

A focused, behavior-preserving performance fix in two passes this branch added, with no visible change. There's no prior issue. It's offered for the branch owner to take, or to fold into the stack.

Verification

  • Behavior is unchanged. The existing tests cover it: MessagesTimeline.logic.test.ts (working window, steer replies, compaction answers, background groups) and MessagesTimeline.browser.test.tsx, 186 tests in all, pass.

  • Per new item, in Node, through the full chain on synthetic threads where each run opens with a prompt and finished turns are folded, plus a live turn of 150 tool calls. These are two alternating rounds; the stages are timed separately:

    ItemsWorking windowBackground groupsWhole update
    4,3010.23–0.37 → 0.02 ms0.28–0.39 → 0.02–0.03 ms2.3–4.2 → 1.8–2.0 ms
    8,6010.51–0.53 → 0.02–0.03 ms0.57–0.67 → 0.05–0.07 ms4.9–5.2 → 4.1–5.3 ms

    At 8,601 items, row derivation (3.5–4.5 ms) is now nearly all of an update. One noisy "before" round at 8,601 items, taken under load, is left out.

  • vp run check:changed origin/maria/redesign/2-composer-timeline passes.

Claude Opus 5.5 via Claude Code, in T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at e0e6c0e

      Macroscope's review found this PR approvable — This change reduces repeated timeline scans by reusing filtered entries and skipping unnecessary grouping work. Its scope is client-side presentation, with no changes to product defaults, stored data, or external actions.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. maria-rckscommented

      Note

      Written by claude-opus-5-5 on behalf of Maria

      Takeover: conflict resolved

      The base branch maria/redesign/2-composer-timeline was rebased again, so this head conflicted in 2 files. I merged the current base (cb2ce53126) into the head with a merge commit (f301773ef5), no rebase or force-push. Every file takes the base's version except MessagesTimeline.logic.ts, which is the base's version with this PR's one commit applied unchanged (it applied cleanly). The diff against the base is still the same 1 file, +77/-33.

      • vp run check:changed against the base passes on Blacksmith: format, lint, knip, typecheck, MessagesTimeline.logic.test.ts (142 tests), react compiler.
      • I did not merge main: this PR targets the redesign branch, and merging main would add unrelated commits to its diff.
      • No review-bot findings were open.

      Not verified: no new runtime pass after the merge; the code change is identical to the head checked below.


      Earlier verification

      Verified in a real dev environment

      Checked exact head eb615265e4eebea62e78ee80d14dfe8bf9af67c3 on Linux using the real dev web app, repository Playwright, Google Chrome, and Codex gpt-6.1-sol through the local proxy. No mocks or seeded conversation fixtures. No source changes.

      • Installed and ran github/main in a separate worktree first, then stopped its server before starting the PR server with isolated state.
      • Added the real repository through the app. Both versions completed the same prompt with three separate shell calls and a final answer.
      • On the PR, expanding/collapsing the completed working window preserved the commands and answer. A subsequent live turn displayed successive shell calls. Settings > Chat > Tool calls in chat > Hide all removed commands; Show all restored them while preserving the failure message.
      • After the steering failure described below, an ordinary follow-up completed with RECOVERY_COMPLETE. The prior failure and its command rows remained visible.
      • Existing MessagesTimeline.logic.test.ts: 136 tests passed on Blacksmith. Hosted checks: 29 successful, none failing or pending at inspection. No new tests or code changes.

      Same prompt on main and PR, respectively. These demonstrate runtime behavior, not a performance comparison; the surrounding redesign is already different between branches.

      main: three real Codex commands and final answer

      PR: matching three-command prompt and completed answer

      Short screencast of successive real tool calls in the live working window. Frame sampling is accelerated; this is not timing evidence. Video playback and seeking checked; GIF included here for GitHub rendering.

      PR: real tool calls stream into the working window

      PR: failed steer remains visible and ordinary follow-up completes

      Not verified

      • Performance improvement and the original long-thread rescan cost. Current github/main lacks the working-window/background-group passes this PR optimizes; the PR targets maria/redesign/2-composer-timeline. No matching large real conversation or valid before/after timing was produced. No speedup claim is verified by this pass.
      • Successful in-flight steering: sending a steer during the second turn failed after seven commands with no active upstream websocket for response.interrupt (HTTP 400). This is a provider/proxy interrupt failure; I did not establish its behavior on the target branch before this patch, and did not change unrelated provider code.
      • Real notification delivery/background folding, resume-compaction, and approvals were not exercised end to end. Their existing logic tests passed, which is not runtime verification.
      • Native desktop, iOS/Android, other providers, and remote/relay/tunnel connections were not exercised on this Linux VM.
    4. This PR conflicts with maria/redesign/2-composer-timeline. Rebase it or merge maria/redesign/2-composer-timeline into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

      See the conflict window.

    5. Note

      🤖 Claude Opus 5.5 responding on behalf of Theo

      Closing. This PR conflicts with main in 47 files, which is more than we will review as a rebase. If the change still matters, open a fresh PR from current main.

Sign in to join this conversation.