Warm server runs one tsserver per worktree, pushing parallel-agent hosts into swap
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 36/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- nodejs, typescript
- Área
- performance, tooling
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 21
- Forks
- 6
- Merge medio
- 8 h 31 min
- PR fusionados (30 d)
- 55
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PostHog/coherence
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
run --each reads every test as failed alone on Node 26: the test command's output is no longer TAPPosiblemente ocupada @Roshan931 la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
hooks install and hooks --check miss the 0.x launcher hooks from @danilocampos/coherenceQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de PostHog/coherence
Issues similares
-
Stop retrying permanent GitHub API failures in retry.shPosiblemente ocupada @muspi-merol-review la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
promplate/code-review#113 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
ix-toast (5.3): the status icon has `role="img"` and no accessible name (axe `role-img-alt`)Abiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
サムネイルの Storage のバケット(`thumbnails`)に、大きさの上限(1 MiB)と許可する種類(JPEG、PNG、WebP)を設定するPosiblemente ocupada @ykzts la tomó hoy. Abiertotech: supabase
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
inabagumi/shinju-date#7147 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elecnix/your-attention#129 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
umami-software/umami#4780 ·
Los mantenedores suelen responder en 3 días