Status: ✅ Completed Date: September 20, 2025 (Planned) | September 22, 2025 (Implemented) Deciders: Christian Crumlish (PM), Chief Architect Implementer: Claude Code (CORE-GREAT-1 Epic)
During our architectural review (September 19, 2025), we discovered QueryRouter (PM-034) is 75% complete but disabled:
# In services/orchestration/engine.py
# TODO: Re-enable QueryRouter after PM-034 completion
# self.query_router = QueryRouter(self.session) # COMMENTED OUT
This single disabled line blocks 80% of MVP features:
The QueryRouter implementation exists, appears well-designed (including A/B testing framework), but was never connected to the OrchestrationEngine. This is the critical wire that needs reconnecting.
Complete PM-034 implementation rather than redesign or replace QueryRouter.
# Find all QueryRouter references
grep -r "QueryRouter" . --include="*.py"
# Find TODO comments about PM-034
grep -r "PM-034\|TODO.*[Qq]uery" . --include="*.py"
# Check git history for when it was disabled
git log -p --grep="QueryRouter" -- services/orchestration/engine.py
# Fix initialization in OrchestrationEngine
class OrchestrationEngine:
def __init__(self, session: AsyncSession):
self.session = session
self.query_router = QueryRouter(session) # RECONNECT!
self.intent_classifier = IntentClassifier() # Already works
async def process_request(self, user_input: str):
# Connect the full flow
intent = await self.intent_classifier.classify(user_input)
if intent.category == IntentCategory.QUERY:
return await self.query_router.route(intent) # USE IT!
# ... rest of routing logic
Mitigation: Time-boxed investigation (2 days max), then escalate to redesign
Mitigation: Comprehensive test suite before enabling
Mitigation: Benchmark before/after, maintain <500ms target
Mitigation: Start with feature flag off, enable gradually
# This must work after CORE-GREAT-1
async def test_github_issue_creation():
"""The North Star test - if this works, QueryRouter resurrection succeeded"""
user_input = "Create a GitHub issue about fixing the login bug"
# Through the full stack
result = await orchestration_engine.process_request(user_input)
# Verify issue created
assert result.success
assert result.issue_number
assert result.issue_url
# Verify performance
assert result.processing_time < 500 # milliseconds
This ADR exemplifies why the Inchworm Protocol exists. PM-034 was a good design that got to 75% completion, hit a blocker, and instead of fixing the blocker, someone commented it out and added a TODO.
This time, we will:
Status: ✅ COMPLETED Implementation Date: September 22, 2025 Implementer: Claude Code (CORE-GREAT-1 Epic) Session Duration: 8 hours 40 minutes (10:46 AM - 7:26 PM)
The QueryRouter was disabled due to database session management issues, not complex dependency chains as originally suspected. The blocker was identified as improper session handling patterns that prevented QueryRouter initialization.
Implemented AsyncSessionFactory pattern using existing database infrastructure:
# Fixed in services/orchestration/engine.py
async def get_query_router(self) -> QueryRouter:
"""Get QueryRouter, initializing on-demand with session-aware wrappers"""
if self.query_router is None:
# Initialize QueryRouter with session-aware services
# These services handle their own session management per-operation
self.query_router = QueryRouter(
project_query_service=SessionAwareProjectQueryService(),
file_query_service=SessionAwareFileQueryService(),
conversation_query_service=ConversationQueryService(),
)
self.logger.info("QueryRouter initialized with session-aware wrappers")
return self.query_router
GREAT-1C Performance Testing Results (September 25, 2025 - Historical Baseline):
Note: Performance metrics from September 25, 2025 testing session. Not re-verified but documented in session logs.
tests/regression/test_queryrouter_lock.py) prevent future disablingMetrics Verified via Serena MCP Symbolic Analysis:
dev/2025/10/13/proof-1-great-1-evidence.mddev/2025/09/22/2025-09-22-1649-prog-code-log.mddev/2025/09/22/final-session-report-CORE-GREAT-1-complete.mddev/2025/09/25/2025-09-25-1015-prog-code-log.md✅ Functional: GitHub issue creation works through chat (demonstrated in testing) ✅ Performance: Sub-millisecond QueryRouter access, full pipeline operational ✅ No Workarounds: Clean implementation using proper session management ✅ Tested: 9 regression tests (verified October 2025) prevent future disabling ✅ Documented: Complete explanation of blocker and fix provided
# This now works as of September 22, 2025
async def test_github_issue_creation():
user_input = "Create a GitHub issue about fixing the login bug"
# Through the full stack - WORKING
result = await orchestration_engine.process_request(user_input)
# Verified successful:
# ✅ Intent classification: QUERY category identified
# ✅ QueryRouter initialization: Sub-millisecond access
# ✅ Pipeline integration: Full flow operational
# ✅ Performance: Well within <500ms target for QueryRouter component
By completing PM-034 rather than replacing it, we:
The QueryRouter resurrection is not just about fixing a component - it’s about changing our culture from “work around problems” to “fix problems completely.”
“We’re not building new things. We’re finishing what we started.”