Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

macOS: setStableProcessTitle() runs every 5 s → one LaunchServices check-in per session every 5 s (launchservicesd CPU)

Abierto Apto para principiantes
#1,000 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, macos, node.js
Área
cli, performance

Línea de trabajo

Lee el código de writeTitle() y setStableProcessTitle() que aparece en el issue y luego sigue dónde useTerminalTitle programa reassertTerminalTitle(). Comprueba la reproducción mínima de Node en macOS para confirmar que las asignaciones repetidas provocan check-ins. Se da por terminado cuando el título del terminal se puede volver a establecer cada 5 segundos sin asignaciones repetidas del título del proceso y la reproducción no muestra check-ins recurrentes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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: launchservicesd was the #1 CPU consumer of the machine:
    353 % average, 433 % p95
    (≈3.5 cores); 84 of 87 registering 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 % launchservicesd CPU
    (≈12–15 % of a core per session, ≈0.7 s of launchservicesd CPU 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).

Lenguaje dominante
Sin datos de lenguaje
Estrellas
4.1k
Forks
363
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CommandCodeAI/command-code

Todos los issues de CommandCodeAI/command-code

Issues similares

Más issues de CLI

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.