diff --git a/modules/state.py b/modules/state.py
index d70972b..9a10d32 100644
--- a/modules/state.py
+++ b/modules/state.py
@@ -32,7 +32,7 @@ RESULT_SUCCESS = "success"
 RESULT_FAILURE = "failure"
 
 STATE_FILENAME = "auh-state.json"
-STATE_VERSION = 1
+STATE_VERSION = 2
 
 SECONDS_PER_DAY = 86400
 DEFAULT_RETRY_SAME_VERSION_DAYS = 30
@@ -41,7 +41,9 @@ DEFAULT_SUCCESS_MAX_AGE_DAYS = 30
 
 
 class State:
-    """Tracks upgrade attempts as {recipe: {version: {timestamp, result}}}."""
+    """Tracks upgrade attempts as a flat dict, one entry per recipe:
+    {recipe: {oldversion, oldversion_firstseen, newversion, newversion_firstseen,
+              timestamp, result}}."""
 
     def __init__(self, state_dir,
                  retry_same_version_days=DEFAULT_RETRY_SAME_VERSION_DAYS,
@@ -53,10 +55,9 @@ class State:
         self.success_max_age = success_max_age_days * SECONDS_PER_DAY
         self.retry_any_version = retry_any_version_days * SECONDS_PER_DAY
         self.any_version_recipes = set(retry_any_version_recipes or [])
-        self.data = self._load()
-        self._prune()
+        self.data = self._load_state_file()
 
-    def _load(self):
+    def _load_state_file(self):
         if os.path.exists(self.path):
             try:
                 with open(self.path) as f:
@@ -76,38 +77,46 @@ class State:
             json.dump({"version": STATE_VERSION, "recipes": self.data},
                       f, indent=2)
 
-    def record(self, pn, version, result):
-        entry = {"timestamp": time.time(), "result": result}
-        if pn not in self.data:
-            self.data[pn] = {}
-        self.data[pn][version] = entry
-
-    def should_skip(self, pn, version):
-        """Return True if this recipe/version should not be attempted."""
-        return self.check(pn, version)['skip']
-
-    def skip_reason(self, pn, version):
-        """Return a human-readable string explaining why pn/version is being skipped."""
-        return self.check(pn, version)['reason']
-
-    def check(self, pn, version):
+    def record(self, pn, old_version, new_version, result):
+        current_time = time.time()
+        oldversion_firstseen = current_time
+        newversion_firstseen = current_time
+
+        if pn in self.data:
+            if self.data[pn]['oldversion'] == old_version:
+                oldversion_firstseen = self.data[pn]['oldversion_firstseen']
+            if self.data[pn]['newversion'] == new_version:
+                newversion_firstseen = self.data[pn]['newversion_firstseen']
+
+        self.data[pn] = {"timestamp": current_time,
+                         "result": result,
+                         "oldversion": old_version,
+                         "oldversion_firstseen": oldversion_firstseen,
+                         "newversion": new_version,
+                         "newversion_firstseen": newversion_firstseen,
+                         }
+
+    def check(self, pn, old_version, new_version):
         """Return {'skip': bool, 'reason': str} for a recipe/version pair.
 
         For any_version_recipes, any recent attempt (any version) causes a skip.
-        For normal recipes, only a matching version entry causes a skip.
+        For normal recipes, only an entry for the same old and new version
+        causes a skip.
         """
+
+        entry = self.data.get(pn, {})
+
+        if not entry:
+            return {'skip': False, 'reason': ''}
+
         if pn in self.any_version_recipes:
-            entry = self._newest_entry(pn)
             max_age = self.retry_any_version
         else:
-            entry = self.data.get(pn, {}).get(version)
-            if entry is None:
-                return {'skip': False, 'reason': ''}
             max_age = self.success_max_age \
                 if entry.get("result") == RESULT_SUCCESS \
                 else self.retry_same_version
 
-        if not entry:
+        if pn not in self.any_version_recipes and (entry['oldversion'] != old_version or entry['newversion'] != new_version):
             return {'skip': False, 'reason': ''}
 
         ts = entry.get("timestamp", 0)
@@ -122,19 +131,3 @@ class State:
         return {'skip': True,
                 'reason': "%slast attempt %s result=%s; will retry in %d day(s)"
                           % (prefix, when, result, retry_in)}
-
-    def _newest_entry(self, pn):
-        """Return the most recent entry for a recipe across all versions."""
-        versions = self.data.get(pn, {})
-        return max(versions.values(), key=lambda e: e.get("timestamp", 0),
-                   default={})
-
-    def _prune(self):
-        """Remove entries that check() would no longer skip."""
-        for pn in list(self.data):
-            versions = self.data[pn]
-            for ver in list(versions):
-                if not self.check(pn, ver)['skip']:
-                    del versions[ver]
-            if not versions:
-                del self.data[pn]
diff --git a/upgrade-helper.py b/upgrade-helper.py
index 56b1f02..8e47e40 100755
--- a/upgrade-helper.py
+++ b/upgrade-helper.py
@@ -498,10 +498,10 @@ class Updater(object):
         if self.state:
             kept = []
             for g in pkggroups_ctx:
-                pn, npv = g['pkgs'][0]['PN'], g['pkgs'][0]['NPV']
-                r = self.state.check(pn, npv)
+                pn, opv, npv = g['pkgs'][0]['PN'], g['pkgs'][0]['PV'], g['pkgs'][0]['NPV']
+                r = self.state.check(pn, opv, npv)
                 if r['skip']:
-                    I(" %s %s: skipping (%s)" % (pn, npv, r['reason']))
+                    I(" %s %s -> %s: skipping (%s)" % (pn, opv, npv, r['reason']))
                     self.statistics.skip(g, r['reason'])
                 else:
                     kept.append(g)
@@ -579,7 +579,7 @@ class Updater(object):
                 # upgrades them atomically; individual outcomes are not tracked.
                 for pkg_ctx in g['pkgs']:
                     I(" %s %s: recording result=%s" % (pkg_ctx['PN'], pkg_ctx['NPV'], result))
-                    self.state.record(pkg_ctx['PN'], pkg_ctx['NPV'], result)
+                    self.state.record(pkg_ctx['PN'], pkg_ctx['PV'], pkg_ctx['NPV'], result)
 
         if self.state:
             self.state.save()
