Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(client): defer active thread cache writes #4006

MergedChrrxs(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/4006/headmerged by juliusmarminge View on GitHub

What Changed

  • Skip full cache writes while a thread session is starting or running.
  • Apply the same guard during thread-state teardown.
  • Add a regression test for the debounce and teardown paths.

Why

Active updates previously encoded and wrote the complete retained thread after each 500 ms quiet interval. One affected thread encoded approximately 78 MiB per write.

The server remains the source of truth during active turns. Persisting once the session settles removes this work from the streaming path without changing warm-cache resume behavior.

Fixes #4005.

Verification

  • vp test packages/client-runtime/src/state/threads-sync.test.ts
  • vp check
  • vp run typecheck

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Screenshots and video are not applicable; there are no UI changes
    1. 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: dce8c95f-3e8b-4b8b-b9ea-581e49b4e5e0

      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

      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:unvouched

    3. Approvability

      Verdict: Approved

      Performance optimization that defers client-side cache writes during active streaming. The change is self-contained to caching logic, the server remains source of truth, and appropriate test coverage is included.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged this765e1b5

    5. juliusmarminge closed this

Sign in to join this conversation.