Problem
CopilotSessionLocator.discoverActiveLocks (packages/agent-manager/src/providers/copilot/CopilotSessionLocator.ts) runs a readdir on every session directory ever created on every refresh, looking for inuse.<pid>.lock files. The cost grows with total Copilot history.
For each active lock, CopilotSessionParser.readSessionDir then reads the full events.jsonl (readEventEntries) and parses every line.
Proposed approach
Acceptance criteria
Depends on #256.
Problem
CopilotSessionLocator.discoverActiveLocks(packages/agent-manager/src/providers/copilot/CopilotSessionLocator.ts) runs areaddiron every session directory ever created on every refresh, looking forinuse.<pid>.lockfiles. The cost grows with total Copilot history.For each active lock,
CopilotSessionParser.readSessionDirthen reads the fullevents.jsonl(readEventEntries) and parses every line.Proposed approach
(pid, startTime)and re-validate it with a singlestatinstead of rescanning.events.jsonlsummaries through the incremental summary utility (perf(agent-manager): shared incremental session-summary cache (stop full transcript re-parse on every refresh) #256).Acceptance criteria
readdiron only directories modified since that process started (the test asserts the calls).events.jsonlreads 0 bytes on the second refresh; after appending K bytes, ≤ K + 64 KiB.Depends on #256.