Skip to content

Commit 584c1ce

Browse files
phernandezclaude
andcommitted
Remove sync_status_service and all related code
Removed the sync_status_service completely as it was adding unnecessary complexity and state tracking that wasn't providing value. Changes: - Removed sync_status_service.py - Removed sync_status MCP tool - Removed all sync_status_tracker calls from sync_service.py - Removed migration status checks from MCP tools (write_note, read_note, build_context) - Removed check_migration_status() and wait_for_migration_or_return_status() from utils.py - Removed test files: test_sync_status_service.py, test_tool_sync_status.py - Removed migration status tests from test_tool_utils.py - Removed sync_status from MCP tools __init__.py All tests passing (1184 passed, 4 skipped). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 6d29ca6 commit 584c1ce

12 files changed

Lines changed: 0 additions & 1147 deletions

File tree

src/basic_memory/mcp/tools/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from basic_memory.mcp.tools.list_directory import list_directory
1919
from basic_memory.mcp.tools.edit_note import edit_note
2020
from basic_memory.mcp.tools.move_note import move_note
21-
from basic_memory.mcp.tools.sync_status import sync_status
2221
from basic_memory.mcp.tools.project_management import (
2322
list_memory_projects,
2423
create_memory_project,
@@ -44,7 +43,6 @@
4443
"recent_activity",
4544
"search",
4645
"search_notes",
47-
"sync_status",
4846
"view_note",
4947
"write_note",
5048
]

src/basic_memory/mcp/tools/build_context.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -106,28 +106,6 @@ async def build_context(
106106
# Get the active project using the new stateless approach
107107
active_project = await get_active_project(client, project, context)
108108

109-
# Check migration status and wait briefly if needed
110-
from basic_memory.mcp.tools.utils import wait_for_migration_or_return_status
111-
112-
migration_status = await wait_for_migration_or_return_status(
113-
timeout=5.0, project_name=active_project.name
114-
)
115-
if migration_status: # pragma: no cover
116-
# Return a proper GraphContext with status message
117-
from basic_memory.schemas.memory import MemoryMetadata
118-
from datetime import datetime
119-
120-
return GraphContext(
121-
results=[],
122-
metadata=MemoryMetadata(
123-
depth=depth or 1,
124-
timeframe=timeframe,
125-
generated_at=datetime.now().astimezone(),
126-
primary_count=0,
127-
related_count=0,
128-
uri=migration_status, # Include status in metadata
129-
),
130-
)
131109
project_url = active_project.project_url
132110

133111
response = await call_get(

src/basic_memory/mcp/tools/read_note.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ async def read_note(
9797
)
9898
return f"# Error\n\nIdentifier '{identifier}' is not allowed - paths must stay within project boundaries"
9999

100-
# Check migration status and wait briefly if needed
101-
from basic_memory.mcp.tools.utils import wait_for_migration_or_return_status
102-
103-
migration_status = await wait_for_migration_or_return_status(
104-
timeout=5.0, project_name=active_project.name
105-
)
106-
if migration_status: # pragma: no cover
107-
return f"# System Status\n\n{migration_status}\n\nPlease wait for migration to complete before reading notes."
108100
project_url = active_project.project_url
109101

110102
# Get the file via REST API - first try direct permalink lookup

src/basic_memory/mcp/tools/sync_status.py

Lines changed: 0 additions & 261 deletions
This file was deleted.

src/basic_memory/mcp/tools/utils.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -512,71 +512,3 @@ async def call_delete(
512512
raise ToolError(error_message) from e
513513

514514

515-
def check_migration_status() -> Optional[str]:
516-
"""Check if sync/migration is in progress and return status message if so.
517-
518-
Returns:
519-
Status message if sync is in progress, None if system is ready
520-
"""
521-
try:
522-
from basic_memory.services.sync_status_service import sync_status_tracker
523-
524-
if not sync_status_tracker.is_ready:
525-
return sync_status_tracker.get_summary()
526-
return None
527-
except Exception:
528-
# If there's any error checking sync status, assume ready
529-
return None
530-
531-
532-
async def wait_for_migration_or_return_status(
533-
timeout: float = 5.0, project_name: Optional[str] = None
534-
) -> Optional[str]:
535-
"""Wait briefly for sync/migration to complete, or return status message.
536-
537-
Args:
538-
timeout: Maximum time to wait for sync completion
539-
project_name: Optional project name to check specific project status.
540-
If provided, only checks that project's readiness.
541-
If None, uses global status check (legacy behavior).
542-
543-
Returns:
544-
Status message if sync is still in progress, None if ready
545-
"""
546-
try:
547-
from basic_memory.services.sync_status_service import sync_status_tracker
548-
import asyncio
549-
550-
# Check if we should use project-specific or global status
551-
def is_ready() -> bool:
552-
if project_name:
553-
return sync_status_tracker.is_project_ready(project_name)
554-
return sync_status_tracker.is_ready
555-
556-
if is_ready():
557-
return None
558-
559-
# Wait briefly for sync to complete
560-
start_time = asyncio.get_event_loop().time()
561-
while (asyncio.get_event_loop().time() - start_time) < timeout:
562-
if is_ready():
563-
return None
564-
await asyncio.sleep(0.1) # Check every 100ms
565-
566-
# Still not ready after timeout
567-
if project_name:
568-
# For project-specific checks, get project status details
569-
project_status = sync_status_tracker.get_project_status(project_name)
570-
if project_status and project_status.status.value == "failed":
571-
error_msg = project_status.error or "Unknown sync error"
572-
return f"❌ Sync failed for project '{project_name}': {error_msg}"
573-
elif project_status:
574-
return f"🔄 Project '{project_name}' is still syncing: {project_status.message}"
575-
else:
576-
return f"⚠️ Project '{project_name}' status unknown"
577-
else:
578-
# Fall back to global summary for legacy calls
579-
return sync_status_tracker.get_summary()
580-
except Exception: # pragma: no cover
581-
# If there's any error, assume ready
582-
return None

0 commit comments

Comments
 (0)