You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(agent-manager): enrich only candidate PIDs ("node" in processNames enriches every Node process) #266
AgentManager.listAgents builds one shared process snapshot from the union of all adapters' processNames. The Gemini, Kiro and Pi adapters declare "node", so every Node.js process on the machine matches: editor helpers, dev servers, other CLIs.
captureProcessSnapshot then enriches all matched PIDs with lsof -a -d cwd -p <pids> and ps -o lstart= -p <pids> on every refresh, before any adapter's canHandle filters them out. On a typical developer machine, dozens of unrelated Node processes get enriched every 3 s (49 on a test machine), and the cost grows with unrelated software.
Proposed approach
Use two-phase capture in packages/agent-manager/src/utils/process.ts and AgentManager.listAgents:
Run ps -axo pid=,ppid=,tty=,command= once, as today.
Keep only processes that at least one adapter's canHandle accepts. canHandle is already on the AgentAdapter interface and needs only the command and executable.
Run lsof and ps lstart for that filtered PID set only.
Optionally, cache start times per PID, since they never change for a live PID; this lets ps lstart skip PIDs it has already seen.
Acceptance criteria
Given a snapshot with 50 unrelated node processes and 2 real agents, lsof/ps lstart receive only the PIDs that pass some adapter's canHandle (unit test with an injected exec).
Start times are fetched once per (pid) while the process is alive, not on every refresh.
Detection results are unchanged for existing Gemini, Kiro and Pi tests, including wrapper-process handling.
With no candidate agent processes, a refresh spawns only the base ps (no lsof/ps lstart).
Activity
perf(agent-manager): enrich only candidate PIDs and cache start times (…
test(agent-manager): use a fresh snapshot capture in the Antigravity …
perf(agent-manager): enrich only candidate PIDs and cache start times (…
test(agent-manager): use a fresh snapshot capture in the Antigravity …
perf(agent-manager): enrich only candidate PIDs and cache start times (…