fix(agent): clear sticky LastError on successful sync paths

Pages reconcile could succeed while agent state retained a previous
network error, so health events stayed active indefinitely. Clear
LastError whenever sync completes successfully without re-applying
config, and cover the paths with regression tests.
This commit is contained in:
ryan
2026-08-06 13:47:48 +08:00
parent fd62570431
commit 1a4a03a20d
4 changed files with 168 additions and 0 deletions
+2
View File
@@ -122,6 +122,8 @@ func (s *Service) syncMismatchedChecksum(ctx context.Context, mode string, start
if !reconciled {
slog.Debug("skipping config fetch because state already records target version/checksum", "version", target.Version, "checksum", target.Checksum)
}
// Successful reconcile must clear sticky LastError so health events can resolve.
snapshot.LastError = ""
return s.stateStore.Save(snapshot)
}