🤖 perf: throttle sub-agent projection refetches after usage-changed events

オープン
#7,870 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript

調査の方向性

Start from the store code that refetches the open sub-agent projection on each usage-changed event, and from the getSubagentUsage call it makes. The issue names no files, so find them by searching for those identifiers. Add a per-ancestor trailing-edge throttle of about 1 s, or a backend view cache, then rerun the 200-writes-at-20/s benchmark with the parent shown and report fetch counts and CPU before and after. The second note, about the settling stream's ledger refetch double counting, needs a design decision first.

索引モデルが issue の本文から書いたものです。

説明

After #7867, the store refetches the open sub-agent projection once per usage write for each ancestor shown on screen (single flight, no delay). An independent verifier measured the cost for a large tree:

  • One getSubagentUsage for 107 open sub-agents costs about 29 ms of server CPU (11 ms on the main thread).
  • 200 headless writes at 20/s with the parent shown cost 200 fetches and 9.16 s of server CPU over 11.6 s, against 2.10 s with the parent not shown.
  • The estimate is 11-22% of the backend main thread per window showing a large root at 10-20 usage events/s, about 30-60× more fetches than before #7867.

Fix: a per-ancestor minimum interval between projection fetches (about 1 s, trailing edge, so the last change always lands), or a per-sub-agent view cache on the backend. Acceptance: rerun the 200-writes-at-20/s benchmark with the parent shown, report fetches and CPU before and after, and keep totals exact.

A second note from the same verifier: a workspace's own headless spend (bash AI proxy, status titles) now shows only when that workspace's own stream ends. The store skips its own ledger refetch during its own stream to avoid counting the stream twice. The final total is correct. Fixing this needs a refetch that cannot double count the settling stream.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

主要言語
TypeScript
スター
2.1k
フォーク
139
平均マージ
4時間 38分
マージ済み PR(30日)
926

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

coder/xum のほかの issue

coder/xum の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。