Skip to content

refactor(mcp): async snapshot lock and workspace-scoped state#272

Closed
defin85 wants to merge 1 commit intozilliztech:masterfrom
defin85:feat/mcp-snapshot-async-workspace
Closed

refactor(mcp): async snapshot lock and workspace-scoped state#272
defin85 wants to merge 1 commit intozilliztech:masterfrom
defin85:feat/mcp-snapshot-async-workspace

Conversation

@defin85
Copy link

@defin85 defin85 commented Feb 20, 2026

Problem

Snapshot persistence used sync busy-wait lock backoff, causing high CPU under lock contention. Snapshot state was global, so multiple workspaces/sessions contended on one lock file.

Changes

  • Replaced busy-spin lock retry with async retry + jitter.
  • Added lock wait/retry telemetry logs.
  • Added serialized snapshot save queue and scheduled/coalesced saves.
  • Switched default snapshot scope to workspace-specific file (hash of process.cwd()).
  • Added best-effort migration from legacy global snapshot into workspace snapshot.
  • Updated MCP handlers to await snapshot saves.
  • Reduced indexing progress write frequency via coalesced scheduling.

Breaking Changes

  • SnapshotManager.saveCodebaseSnapshot() is now async and must be awaited.
  • Default snapshot scope changed from global to workspace.

Validation

  • packages/mcp/node_modules/.bin/tsc -p packages/mcp/tsconfig.json --noEmit
  • pnpm --filter @zilliz/claude-context-mcp build
  • bash scripts/build-local-mcp.sh
  • pnpm build

@defin85 defin85 marked this pull request as ready for review February 20, 2026 12:46
@defin85 defin85 force-pushed the feat/mcp-snapshot-async-workspace branch from cc3af88 to f598bf6 Compare February 20, 2026 12:46
@defin85 defin85 changed the title mcp: replace snapshot busy-wait lock with async lock and workspace-scoped snapshots refactor(mcp): async snapshot lock and workspace-scoped state Feb 20, 2026
@defin85 defin85 marked this pull request as draft February 20, 2026 12:47
@defin85
Copy link
Author

defin85 commented Feb 20, 2026

Superseded by #274 to align with CONTRIBUTING.md branch naming ().

@defin85 defin85 closed this Feb 20, 2026
@defin85
Copy link
Author

defin85 commented Feb 20, 2026

Superseded by #274 for branch naming compliance with CONTRIBUTING.md (feature/*).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant