macOS: setStableProcessTitle() runs every 5 s → one LaunchServices check-in per session every 5 s (launchservicesd CPU)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, macos, node.js
- 領域
- cli, performance
調査の方向性
issue に示されている writeTitle() と setStableProcessTitle() のコードを読み、次に useTerminalTitle が reassertTerminalTitle() をスケジュールする箇所を追ってください。macOS で最小限の Node 再現コードを確認し、繰り返し代入によって check-in が発生することを確かめてください。プロセスタイトルを繰り返し代入せずに、ターミナルタイトルを引き続き5秒ごとに再設定でき、再現コードで check-in が繰り返し発生しない状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Since the fix for #764 (v1.50.1), the process title is stable (command-code) — thanks.
But writeTitle() calls setStableProcessTitle() on every call, and
useTerminalTitle re-asserts the terminal title every 5 s:
function setStableProcessTitle(){process.title="command-code"}
function writeTitle(e){setStableProcessTitle(),process.stderr.isTTY&&process.stderr.write(SN(e))}
function reassertTerminalTitle(){null!==wN&&writeTitle(wN)}
// useTerminalTitle:
const e=setInterval(reassertTerminalTitle,5e3)
On macOS, every process.title assignment goes through libuv's darwin
proctitle code, which checks the process in with LaunchServices. lsd logs
pid N registering self and the check-in is rejected with -10811
(kLSNotAnApplicationErr), but launchservicesd still does the work (code
signature validation) each time. So every interactive session costs one
LaunchServices check-in every 5 s, forever, idle or not, even though the
value never changes.
Impact (measured)
macOS 26.6 (25G72), Apple Silicon (M5 Max, 18 cores), Node v24.21.0 arm64,
Command Code 1.79.1, ~20–30 interactive sessions open in a terminal multiplexer:
- 12 check-ins / min per session, constant (10-min idle window: 119–120 per session).
- 45-min audit:
launchservicesdwas the #1 CPU consumer of the machine:
353 % average, 433 % p95 (≈3.5 cores); 84 of 87registering self
events per probe window came from Command Code processes. - Controlled experiment with throw-away sessions (
--no-session, no prompt sent):
baseline 257 % → +4 sessions 316 % → +8 sessions 362 %launchservicesdCPU
(≈12–15 % of a core per session, ≈0.7 s oflaunchservicesdCPU per check-in).
Those throw-away sessions ran Node x86_64 under Rosetta; arm64 sessions show
the same 12 / min cadence.
Minimal repro (no Command Code needed)
node -e 'setInterval(()=>{process.title="command-code"},5000)' & A=$! # rewrite every 5 s
node -e 'process.title="command-code"; setInterval(()=>{},5000)' & B=$! # write once
sleep 42
log show --last 40s --style compact \
--predicate 'process == "lsd" AND eventMessage CONTAINS "registering self"' > lsd.txt
grep -c "pid $A registering self" lsd.txt # → 8
grep -c "pid $B registering self" lsd.txt # → 0
kill $A $B
With Command Code itself: start one session in a terminal, then
log stream --predicate 'process == "lsd" AND eventMessage CONTAINS "registering self"'
shows its pid every 5.000 s.
Suggested fix
Only write the process title when it changes, e.g.
function setStableProcessTitle(){ if (process.title !== "command-code") process.title = "command-code" }
or call it once at startup instead of inside writeTitle(). The OSC terminal
title write can stay on the 5 s interval — it does not touch LaunchServices.
Local workaround (until a release)
A user mod in ~/.commandcode/mods/ that performs the native write once and
then backs process.title with a plain JS property removes the check-ins
(same loop: 8 → 0 per 40 s; ps still shows command-code). It only takes
effect after a session's first message (mods load with the harness).
- 主要言語
- 言語のデータがありません
- スター
- 4.1k
- フォーク
- 363
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommandCodeAI/command-code のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
CommandCodeAI/command-code#992 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#933 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#855 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CommandCodeAI/command-code#841 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#655 · コメント 1 件 ·
CommandCodeAI/command-code の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
再現済み 要トリアージ 誤判定
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
yksr-melt/Meltype#421 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelstudioai/cli#242 ·
メンテナーはふだん 1 日以内に返信
-
good first issue needs-triage priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
melodic-software/claude-code-plugins#6982 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
trust: update-propagation-directive requires developer mode while add and remove do not対応中かも @bhuvan-somisetty が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信