Warm server runs one tsserver per worktree, pushing parallel-agent hosts into swap
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 36/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- performance, tooling
調査の方向性
Start with the repro script in the issue, which creates worktrees and prints per-process RSS. The spawn decision is in dist/enforcement/server.js near line 874, the idle timeout is DEFAULT_IDLE_MS near line 61, and the tsserver options are in dist/adapters/typescript.js near line 264. Done means the RSS total stays bounded as worktrees grow, for example via a maxTsServerMemory setting or a machine-wide cap. The cap design is still open, so confirm the approach with maintainers before coding.
索引モデルが issue の本文から書いたものです。
説明
Each git worktree gets its own warm server (serve -> typescript-language-server -> tsserver), with no machine-wide cap, no memory check before spawning, and no tsserver heap limit. Parallel agent sessions in separate worktrees of one repo therefore run N copies of the same project load. On a 16 GB host, 4 sessions pushed it into swap.
Environment
- @posthog/coherence 1.8.0
- tsserver from coherence's bundled typescript 5.9.3, via typescript-language-server 5.3.0
- Node v22.23.2, Debian 12, 8 cores, 15.8 GB RAM
- Project: 916
.tsfiles, 160k lines
Measurements
Fresh worktree, 30 s after coherence warm: serve 71 MB + LSP 58 MB + tsserver 485 MB = 614 MB per tree. Grows linearly with the worktree count.
Live, 4 agent sessions in 4 worktrees:
| tree RSS | tsserver RSS |
|---|---|
| 928 MB | 1,094 MB (peak 1,405 MB) |
| 887 MB | 949 MB |
| 838 MB | 697 MB |
| 540 MB | 547 MB |
- About 3.2 GB in total. tsserver grows from 485 MB to 0.7 to 1.4 GB with use.
- Host state: swap 976/976 MB full,
/proc/pressure/memory full avg300=22.58, load 46 on 8 cores. - In that state, two
coherenceCLI calls that normally take about 170 ms took about 12 s, andgit statustimed out at 10 s. - Idle exit (
DEFAULT_IDLE_MS= 5 min) followed by a respawn on the next hook adds repeated cold project loads while the host is already swapping. Observed tsserver ages: 15 s and 4 min inside sessions 25+ min old.
Repro
repro.sh <ts-repo-with-coherence> <count> creates <count> worktrees, runs coherence warm in each, prints RSS per process after 30 s, then cleans up.
#!/usr/bin/env bash
set -euo pipefail
repo=$(realpath "$1"); count=${2:-4}
base=$(mktemp -d /tmp/coherence-warm-repro.XXXXXX)
export COHERENCE_NO_UPDATE_CHECK=1
cli=$(readlink -f "$repo/node_modules/@posthog/coherence/dist/cli.js")
rss_mb() { local kb; kb=$(ps -o rss= -p "$1" 2>/dev/null || true); echo $(( ${kb:-0} / 1024 )); }
cleanup() {
for root in "$base"/wt-*; do
[ -d "$root" ] || continue
serve=$(pgrep -f "[c]li.js serve --root $root\$" || true)
[ -n "$serve" ] && kill $serve && sleep 1
rm -f "$root/node_modules"; rm -r "$root/.coherence/run" 2>/dev/null || true
git -C "$repo" worktree remove "$root" || true
done
rmdir "$base" 2>/dev/null || true
}
trap cleanup EXIT
for i in $(seq 1 "$count"); do
root="$base/wt-$i"
git -C "$repo" worktree add --detach --quiet "$root" HEAD
ln -s "$repo/node_modules" "$root/node_modules"
(cd "$root" && node "$cli" warm)
done
sleep 30
for root in "$base"/wt-*; do
serve=$(pgrep -f "cli.js serve --root $root\$"); lsp=$(pgrep -P "$serve" | head -1); tsserver=$(pgrep -P "$lsp" | head -1)
echo "$(basename "$root"): serve $(rss_mb "$serve") MB, lsp $(rss_mb "$lsp") MB, tsserver $(rss_mb "$tsserver") MB"
done
Output with count 2:
wt-1: serve 71 MB, lsp 58 MB, tsserver 485 MB
wt-2: serve 72 MB, lsp 58 MB, tsserver 485 MB
Code
dist/enforcement/server.js:874: the client spawnsserve --root <root>whenever nothing listens, with no count or memory checkdist/adapters/typescript.js:264: nomaxTsServerMemoryininitializationOptions.tsserverdist/enforcement/server.js:61:DEFAULT_IDLE_MS = 5 * 60 * 1000dist/lifecycle/hook.js:890:WARM_UPfires on SessionStart, UserPromptSubmit, and project entry
Possible fixes
- Machine-wide cap on warm servers with LRU eviction, or skip warming and answer cold when
MemAvailableis low - Set
maxTsServerMemory - Make the idle timeout configurable
- 主要言語
- TypeScript
- スター
- 21
- フォーク
- 6
- 平均マージ
- 8時間 31分
- マージ済み PR(30日)
- 55
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PostHog/coherence のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
run --each reads every test as failed alone on Node 26: the test command's output is no longer TAP対応中かも @Roshan931 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
hooks install and hooks --check miss the 0.x launcher hooks from @danilocampos/coherence再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
PostHog/coherence の issue をすべて見る
似ている issue
-
Stop retrying permanent GitHub API failures in retry.sh対応中かも @muspi-merol-review が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
promplate/code-review#113 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
サムネイルの Storage のバケット(`thumbnails`)に、大きさの上限(1 MiB)と許可する種類(JPEG、PNG、WebP)を設定する対応中かも @ykzts が今日担当しました。 オープンtech: supabase
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
inabagumi/shinju-date#7147 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elecnix/your-attention#129 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
umami-software/umami#4780 ·
メンテナーはふだん 3 日以内に返信