Startup and update sequence

1. Version mismatch restart loop (pkg/hooks/worker.go):
    - Added versionsCompatible() and extractBaseVersion() functions
    - Hooks no longer restart worker when base versions match (e.g., v0.3.5-dirty ≈ v0.3.5-2-gca711a8-dirty)
2. Auto-update detection (internal/update/update.go):
    - isNewerVersion() now extracts base version before comparing
    - No longer always reports updates for dirty/dev builds
3. Non-blocking ChromaDB sync (internal/worker/handlers.go):
    - SyncUserPrompt now runs in a goroutine with 10-second timeout
    - /api/sessions/init responds immediately without waiting for ChromaDB
This commit is contained in:
2025-12-19 02:17:06 +00:00
parent c715413c09
commit 816af36dd3
4 changed files with 53 additions and 10 deletions
+7 -5
View File
@@ -537,14 +537,16 @@ func isNewerVersion(latest, current string) bool {
latest = strings.TrimPrefix(latest, "v")
current = strings.TrimPrefix(current, "v")
// Handle dev/dirty versions
if strings.Contains(current, "-dirty") || strings.Contains(current, "-dev") {
return true // Always show update available for dev builds
// For dev/dirty builds, extract the base version for comparison
// e.g., "0.3.5-2-gca711a8-dirty" -> "0.3.5"
currentBase := current
if idx := strings.Index(current, "-"); idx > 0 {
currentBase = current[:idx]
}
// Simple semver comparison
// Simple semver comparison using base version
latestParts := strings.Split(latest, ".")
currentParts := strings.Split(current, ".")
currentParts := strings.Split(currentBase, ".")
for i := 0; i < len(latestParts) && i < len(currentParts); i++ {
latestNum, _ := strconv.Atoi(latestParts[i])