Skip to content

Commit 590e6b7

Browse files
jsbattigclaude
andcommitted
fix: fix-config now respects filesystem backend and skips Qdrant operations
CRITICAL BUG FIX: fix-config was applying Qdrant-specific configuration (ports, container names, CoW symlinks) even when using filesystem backend. This wasted resources and could confuse deployment scenarios like claude-server. Root Cause Analysis: 1. Line 836: Only preserved embedding_provider, NOT vector_store config 2. Steps 4-7: Always executed Qdrant operations regardless of backend 3. Result: Unnecessary Qdrant port allocation and container name generation Solution - Option A: Conditional Container Configuration: 1. Preserve vector_store in config_dict (line 837-840) 2. Detect filesystem backend (lines 453-456) 3. Skip Qdrant client initialization if filesystem (line 459-460) 4. Skip CoW symlink creation if filesystem (lines 474-477) 5. Skip collection checks if filesystem (lines 486-489) 6. Skip port/container regeneration if filesystem (lines 951-954) Testing Results: - Before: fix-config applied 8 fixes (included Qdrant port/container regeneration) - After: fix-config applies 3 fixes (path, project name, git commit only) - Verification: vector_store.provider preserved as "filesystem" - Verification: project_ports/project_containers remain null (not regenerated) - Verification: cidx start/query work correctly after fix-config Impact: - Fixes claude-server CoW clone issue where vector_store was lost - Eliminates unnecessary Qdrant configuration for filesystem backend - Reduces fix-config execution time and resource usage - Maintains backward compatibility with Qdrant backend Files Modified: - src/code_indexer/services/config_fixer.py: - Lines 831-840: Preserve vector_store in _regenerate_project_configuration - Lines 453-489: Add conditional Qdrant operation checks in fix_configuration - Lines 939-954: Add filesystem backend check in _fix_project_configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6761a39 commit 590e6b7

File tree

1 file changed

+35
-14
lines changed

1 file changed

+35
-14
lines changed

src/code_indexer/services/config_fixer.py

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,14 @@ def fix_configuration(self) -> FixResult:
450450

451451
all_fixes.extend(config_fixes)
452452

453-
# Step 4: Initialize Qdrant client for metadata analysis
454-
self._initialize_qdrant_client(config)
453+
# Determine if we're using filesystem backend (skip Qdrant-specific operations)
454+
is_filesystem_backend = (
455+
config.vector_store and config.vector_store.provider == "filesystem"
456+
)
457+
458+
# Step 4: Initialize Qdrant client for metadata analysis (Qdrant backend only)
459+
if not is_filesystem_backend:
460+
self._initialize_qdrant_client(config)
455461

456462
# Step 5: Validate and fix metadata.json
457463
if self.metadata_file.exists():
@@ -464,20 +470,23 @@ def fix_configuration(self) -> FixResult:
464470
backup_path.write_text(self.metadata_file.read_text())
465471
backup_files.append(str(backup_path))
466472

467-
# Step 6: Check and fix CoW symlink issues
468-
print("🔍 Checking CoW symlinks...")
469-
cow_fixes = self._fix_cow_symlinks()
470-
all_fixes.extend(cow_fixes)
473+
# Step 6: Check and fix CoW symlink issues (Qdrant backend only)
474+
if not is_filesystem_backend:
475+
print("🔍 Checking CoW symlinks...")
476+
cow_fixes = self._fix_cow_symlinks()
477+
all_fixes.extend(cow_fixes)
471478

472-
# Step 6.5: Check and fix project configuration (project hash, ports, container names)
479+
# Step 6.5: Check and fix project configuration (Qdrant backend only)
480+
# This is handled by conditional logic inside _fix_project_configuration
473481
print("🔍 Checking project configuration...")
474482
project_fixes = self._fix_project_configuration()
475483
all_fixes.extend(project_fixes)
476484

477-
# Step 7: Check for wrong collections
478-
print("🔍 Checking Qdrant collections...")
479-
collection_warnings = self._check_collections()
480-
all_warnings.extend(collection_warnings)
485+
# Step 7: Check for wrong collections (Qdrant backend only)
486+
if not is_filesystem_backend:
487+
print("🔍 Checking Qdrant collections...")
488+
collection_warnings = self._check_collections()
489+
all_warnings.extend(collection_warnings)
481490

482491
print("✅ Configuration analysis complete")
483492
print(f" Applied {len(all_fixes)} fixes")
@@ -828,12 +837,16 @@ def _regenerate_project_configuration(self) -> Dict[str, Any]:
828837
# Get the correct project root (parent of .code-indexer)
829838
project_root = self.config_dir.parent.absolute()
830839

831-
# Load current config to get embedding provider information
840+
# Load current config to get embedding provider and vector store information
832841
config_manager = ConfigManager(self.config_file)
833842
current_config = config_manager.load()
834843

835844
# Prepare config dict for DockerManager
836-
config_dict = {"embedding_provider": current_config.embedding_provider}
845+
# CRITICAL: Preserve vector_store configuration to avoid losing filesystem backend setting
846+
config_dict = {
847+
"embedding_provider": current_config.embedding_provider,
848+
"vector_store": current_config.vector_store,
849+
}
837850

838851
# Initialize DockerManager to get project-specific values
839852
docker_manager = DockerManager(
@@ -933,14 +946,22 @@ def _clear_stale_container_references(
933946
return fixes
934947

935948
def _fix_project_configuration(self) -> List[ConfigFix]:
936-
"""Fix project configuration for CoW clones (project hash, ports, container names)."""
949+
"""Fix project configuration for CoW clones (project hash, ports, container names).
950+
951+
Only applies to Qdrant backend. Filesystem backend doesn't need container/port configuration.
952+
"""
937953
fixes: List[ConfigFix] = []
938954

939955
try:
940956
# Load current configuration
941957
config_manager = ConfigManager(self.config_file)
942958
config = config_manager.load()
943959

960+
# Skip Qdrant-specific configuration if using filesystem backend
961+
if config.vector_store and config.vector_store.provider == "filesystem":
962+
print(" ℹ️ Skipping Qdrant container/port configuration (filesystem backend)")
963+
return fixes
964+
944965
# Regenerate project configuration based on current filesystem location
945966
project_info = self._regenerate_project_configuration()
946967

0 commit comments

Comments
 (0)