You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor: sync/watch lifecycle via SyncCoordinator #497
Refactor: sync/watch lifecycle via SyncCoordinator
Why
Background sync + watch lifecycle is a cross-cutting concern that can easily leak into initialization, routers, and MCP lifespan. Centralizing lifecycle improves reliability and reduces coupling.
Scope
Introduce a SyncCoordinator responsible for:
starting/stopping watch service
scheduling background sync
reporting status
Entrypoints decide when to start it (API/MCP/CLI) via their containers.
Acceptance criteria
Lifecycle logic centralized in one place.
Fewer scattered background-task conditionals.
Stable shutdown behavior (especially in Postgres test mode where hangs were previously noted).
This refactoring addresses a legitimate architectural concern. The sync/watch lifecycle is currently scattered across multiple initialization points, leading to:
Coupling between initialization code and background services
Difficulty managing stable shutdown (Postgres test hangs mentioned)
Scattered background-task conditionals
Proposed Solution:
Introduce SyncCoordinator to centralize:
Should be implemented after that refactoring is complete
Labels Applied
enhancement - Architectural improvement to existing functionality
Recommendation
This is a well-scoped refactoring with clear acceptance criteria. The dependency on #491 is appropriate since container/dependency refactoring should happen first. Once #491 is complete, this would be a good candidate for implementation.
Activity
claude commentedon Dec 31, 2025
Claude finished @phernandez's task in 1m 43s —— View job
Issue Triage Analysis
Tasks
Classification
Type: Enhancement (architectural refactoring)
Priority: Medium
Component: Sync/Watch Services
/syncdirectoryComplexity: Complex
Duplicate Check
No duplicates found. This is a unique refactoring initiative.
Related Issues:
Analysis
This refactoring addresses a legitimate architectural concern. The sync/watch lifecycle is currently scattered across multiple initialization points, leading to:
Proposed Solution:
Introduce
SyncCoordinatorto centralize:Dependencies:
Labels Applied
enhancement- Architectural improvement to existing functionalityRecommendation
This is a well-scoped refactoring with clear acceptance criteria. The dependency on #491 is appropriate since container/dependency refactoring should happen first. Once #491 is complete, this would be a good candidate for implementation.
Next Steps:
refactor: centralize sync/watch lifecycle via SyncCoordinator (#497)