agent/pkg/agentic/sync_example_test.go
Snider 83364a6080 feat(agent): sync backoff + ledger + auto-flush loop
- sync.go: syncBackoffSchedule (1s/5s/15s/60s/5min) with per-push Attempts
  and NextAttempt honoured on retry (RFC §16.5)
- runSyncFlushLoop: ticks every minute from OnStartup when API key present,
  drains the queue without re-scanning workspaces
- SyncPushInput.QueueOnly: lets flush loop drain without triggering a full
  workspace scan (prevents duplicate pushes)
- Sync ledger at .core/sync/ledger.json: fingerprints keyed by workspace
  name + (updated_at, runs); skips already-synced workspaces until fresh
  activity
- docs/RFC-AGENT.md: synced from plans/code/core/agent/RFC.md with latest
  AgentPlan status enum, complete capability, pr.close/branch.delete,
  indexed_at/org brain fields

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 12:06:04 +01:00

27 lines
499 B
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic
import "fmt"
func Example_shouldSyncStatus() {
fmt.Println(shouldSyncStatus("completed"))
fmt.Println(shouldSyncStatus("running"))
// Output:
// true
// false
}
func Example_syncBackoffSchedule() {
fmt.Println(syncBackoffSchedule(1))
fmt.Println(syncBackoffSchedule(2))
fmt.Println(syncBackoffSchedule(3))
fmt.Println(syncBackoffSchedule(4))
fmt.Println(syncBackoffSchedule(5))
// Output:
// 1s
// 5s
// 15s
// 1m0s
// 5m0s
}