Skip to content

perf(agent-manager): Copilot lock discovery scans every session directory on each refresh #265

Description

@codeaholicguy

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

  • With 1,000 historical session directory fixtures and 1 live process, a refresh runs readdir on only directories modified since that process started (the test asserts the calls).
  • A known live lock is re-validated with O(1) filesystem calls per refresh.
  • An unchanged events.jsonl reads 0 bytes on the second refresh; after appending K bytes, ≤ K + 64 KiB.
  • Existing Copilot detection tests pass with identical results.

Depends on #256.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions