feat(daemon): add sync backoff and consolidate hints into tips
Daemon sync improvements: - Adds exponential backoff on sync failures (30s → 1m → 2m → 5m → 10m → 30m cap) - Tracks sync state in .beads/sync-state.json (NeedsManualSync, FailureCount, BackoffUntil) - Resets backoff on daemon start and manual bd sync - Adds sync-state.json to default .gitignore Tips consolidation (following ox-cli pattern): - Moves sync conflict hint from hints.go into tips.go - Proactive health checks trump educational tips - Uses InjectTip() with high priority (200) and 100% probability for urgent warnings - Removes deprecated hints.go
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
)
|
||||
|
||||
@@ -353,6 +354,30 @@ func initDefaultTips() {
|
||||
return isClaudeDetected() && !isClaudeSetupComplete()
|
||||
},
|
||||
)
|
||||
|
||||
// Sync conflict tip - ALWAYS show when sync has failed and needs manual intervention
|
||||
// This is a proactive health check that trumps educational tips (ox-cli pattern)
|
||||
InjectTip(
|
||||
"sync_conflict",
|
||||
"Run 'bd sync' to resolve sync conflict",
|
||||
200, // Higher than Claude setup - sync issues are urgent
|
||||
0, // No frequency limit - always show when applicable
|
||||
1.0, // 100% probability - always show when condition is true
|
||||
syncConflictCondition,
|
||||
)
|
||||
}
|
||||
|
||||
// syncConflictCondition checks if there's a sync conflict that needs manual resolution.
|
||||
// This is the condition function for the sync_conflict tip.
|
||||
func syncConflictCondition() bool {
|
||||
// Find beads directory to check sync state
|
||||
beadsDir := beads.FindBeadsDir()
|
||||
if beadsDir == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
state := LoadSyncState(beadsDir)
|
||||
return state.NeedsManualSync
|
||||
}
|
||||
|
||||
// init initializes the tip system with default tips
|
||||
|
||||
Reference in New Issue
Block a user