review: Say why a series is snoozed in patch listings

A snoozed series shows only the snooze symbol in the tracking list.
What it is waiting for is visible in the details pane, but not while
scanning the list, so telling a series waiting on a tag apart from one
waiting on a date means highlighting each in turn.

Show the wake-up condition before the subject. Rows are only rebuilt
when the database changes, so they use an absolute local time rather
than the countdown shown in the details pane: a countdown would go
stale on screen, and is long enough to crowd out the subject.

Co-developed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
diff --git a/docs/maintainer/review.rst b/docs/maintainer/review.rst
index 5c8277c..f4603dd 100644
--- a/docs/maintainer/review.rst
+++ b/docs/maintainer/review.rst
@@ -158,7 +158,8 @@
   are mutually exclusive — ``↑`` can only appear once revision data
   has been fetched
 * **Subject** — compact ``[subsystem,vN,0/M]`` prefix followed by the
-  series subject
+  series subject. Snoozed series show their wake-up date/time or Git tag
+  before the subject, for example ``(until tag v6.15-rc3)``.
 
 **Status symbols**
 
diff --git a/src/b4/review_tui/_tracking_app.py b/src/b4/review_tui/_tracking_app.py
index 09a3c1d..3b73163 100644
--- a/src/b4/review_tui/_tracking_app.py
+++ b/src/b4/review_tui/_tracking_app.py
@@ -692,6 +692,37 @@
     return True
 
 
+def _parse_snooze_datetime(value: str) -> Optional[datetime.datetime]:
+    """Return the aware datetime in a snoozed_until value, or None.
+
+    Tag targets and date-only strings (stored by older versions) are not
+    datetimes and return None, as does anything unparseable.  Naive
+    values are UTC, because that is how snoozes are stored.
+    """
+    if value.startswith('tag:') or 'T' not in value:
+        return None
+    try:
+        target = datetime.datetime.fromisoformat(value)
+    except (ValueError, TypeError):
+        return None
+    if target.tzinfo is None:
+        target = target.replace(tzinfo=datetime.timezone.utc)
+    return target
+
+
+def _format_snooze_short(value: str) -> str:
+    """Format a snoozed_until value for a list row.
+
+    Rows are only rebuilt when the database changes, so a relative
+    countdown would go stale on screen.  An absolute local time stays
+    correct, and is short enough to leave room for the subject.
+    """
+    target = _parse_snooze_datetime(value)
+    if target is None:
+        return _format_snooze_until(value)
+    return f'until {target.astimezone():%Y-%m-%d %H:%M}'
+
+
 def _format_snooze_until(value: str) -> str:
     """Format a snoozed_until value for display.
 
@@ -704,33 +735,27 @@
         return f'until tag {value[4:]}'
     if 'T' not in value:
         return f'until {value}'
-    try:
-        target = datetime.datetime.fromisoformat(value)
-        if target.tzinfo is None:
-            target = target.replace(tzinfo=datetime.timezone.utc)
-        now = datetime.datetime.now(datetime.timezone.utc)
-        delta = target - now
-        total_seconds = int(delta.total_seconds())
-        if total_seconds <= 0:
-            return 'expired'
-        parts: List[str] = []
-        days = total_seconds // 86400
-        remaining = total_seconds % 86400
-        hours = remaining // 3600
-        remaining %= 3600
-        minutes = remaining // 60
-        if days:
-            parts.append(f'{days}d')
-        if hours:
-            parts.append(f'{hours}h')
-        if minutes:
-            parts.append(f'{minutes}m')
-        relative = ' '.join(parts) if parts else '<1m'
-        local_dt = target.astimezone()
-        local_str = local_dt.strftime('%Y-%m-%d %H:%M')
-        return f'wakes in {relative} ({local_str})'
-    except (ValueError, TypeError):
+    target = _parse_snooze_datetime(value)
+    if target is None:
         return value
+    now = datetime.datetime.now(datetime.timezone.utc)
+    total_seconds = int((target - now).total_seconds())
+    if total_seconds <= 0:
+        return 'expired'
+    parts: List[str] = []
+    days = total_seconds // 86400
+    remaining = total_seconds % 86400
+    hours = remaining // 3600
+    remaining %= 3600
+    minutes = remaining // 60
+    if days:
+        parts.append(f'{days}d')
+    if hours:
+        parts.append(f'{hours}h')
+    if minutes:
+        parts.append(f'{minutes}m')
+    relative = ' '.join(parts) if parts else '<1m'
+    return f'wakes in {relative} ({target.astimezone():%Y-%m-%d %H:%M})'
 
 
 def _parse_art_from_message(commit_msg: str) -> Optional[Tuple[int, int, int]]:
@@ -1009,6 +1034,10 @@
         label.append(prefix_head)
         label.append(ver_token, style=accent if ver_accent else '')
         label.append(prefix_tail)
+        if status == 'snoozed':
+            snoozed_until = self.series.get('snoozed_until')
+            if snoozed_until:
+                label.append(f'({_format_snooze_short(snoozed_until)}) ', style='dim')
         label.append(ls.subject)
         return label
 
diff --git a/src/tests/test_review_tracking.py b/src/tests/test_review_tracking.py
index b0066a2..99c8bf6 100644
--- a/src/tests/test_review_tracking.py
+++ b/src/tests/test_review_tracking.py
@@ -22,7 +22,11 @@
 from b4.review import messages as review_messages
 from b4.review import tracking as review_tracking
 from b4.review_tui._modals import SnoozeScreen
-from b4.review_tui._tracking_app import _format_attestation, _format_snooze_until
+from b4.review_tui._tracking_app import (
+    _format_attestation,
+    _format_snooze_short,
+    _format_snooze_until,
+)
 
 from .helpers.mail import AUTHOR, MINIMAL_DIFF
 from .helpers.tracking import add_worktree, create_review_branch, make_tracking_data
@@ -2104,6 +2108,41 @@
         assert re.search(r'\(\d{4}-\d{2}-\d{2} \d{2}:\d{2}\)', result)
 
 
+class TestFormatSnoozeShort:
+    """Tests for _format_snooze_short(), the compact form used in list rows.
+
+    List rows are rebuilt only when the database changes, so the row form
+    must not contain anything relative to "now" that would go stale.
+    """
+
+    @pytest.mark.parametrize(
+        'value,expected',
+        [
+            pytest.param('2026-04-01', 'until 2026-04-01', id='date-only'),
+            pytest.param('tag:v6.15-rc3', 'until tag v6.15-rc3', id='tag'),
+            pytest.param('NOT_A_DATE', 'NOT_A_DATE', id='invalid-datetime'),
+        ],
+    )
+    def test_literal_values(self, value: str, expected: str) -> None:
+        """Non-datetime values match the details-pane wording."""
+        assert _format_snooze_short(value) == expected
+
+    @pytest.mark.parametrize(
+        'value,year',
+        [
+            pytest.param('2099-11-19T10:00:00+00:00', 2099, id='future'),
+            pytest.param('2020-11-19T10:00:00+00:00', 2020, id='past'),
+            pytest.param('2099-11-19T10:00:00', 2099, id='naive-is-utc'),
+        ],
+    )
+    def test_datetime_is_absolute_local_time(self, value: str, year: int) -> None:
+        """Datetimes render as a plain local time, never a countdown or
+        'expired', so the row stays correct however long it is on screen."""
+        target = datetime.datetime(year, 11, 19, 10, 0, tzinfo=datetime.timezone.utc)
+        expected = f'until {target.astimezone():%Y-%m-%d %H:%M}'
+        assert _format_snooze_short(value) == expected
+
+
 class TestSnoozeDurationRegex:
     """Tests for SnoozeScreen._DURATION_RE pattern matching."""
 
diff --git a/src/tests/test_tui_tracking.py b/src/tests/test_tui_tracking.py
index 6688d94..9290923 100644
--- a/src/tests/test_tui_tracking.py
+++ b/src/tests/test_tui_tracking.py
@@ -12,6 +12,7 @@
 """
 
 import contextlib
+import datetime
 import email.message
 import os
 import pathlib
@@ -5281,6 +5282,60 @@
         assert '[v1,0/1]' in plain
         assert '→' not in plain
 
+    @pytest.mark.asyncio
+    async def test_snooze_reason_precedes_subject(self) -> None:
+        """A snoozed row says what it waits for, in a dimmed, compact form;
+        rows that are not snoozed get no such prefix even if a stale
+        snoozed_until value is left in the database."""
+        identifier = 'test-snooze-reason'
+        base = {'num_patches': 1, 'message_count': 1, 'seen_message_count': 1}
+        seed_db(
+            identifier,
+            [
+                {**base, 'change_id': 'by-tag', 'subject': '[PATCH] tagwait'},
+                {**base, 'change_id': 'by-time', 'subject': '[PATCH] timewait'},
+                {
+                    **base,
+                    'change_id': 'no-until',
+                    'subject': '[PATCH] nountil',
+                    'status': 'snoozed',
+                },
+                {**base, 'change_id': 'leftover', 'subject': '[PATCH] leftover'},
+            ],
+        )
+        conn = tracking.get_db(identifier)
+        # A tag that will never exist and a far-future time, so the
+        # auto-wake on load leaves both series snoozed.
+        tracking.snooze_series(conn, 'by-tag', 'tag:v99.0-never')
+        tracking.snooze_series(conn, 'by-time', '2099-11-19T10:00:00+00:00')
+        tracking.snooze_series(conn, 'leftover', 'tag:v99.0-never')
+        conn.execute(
+            "UPDATE series SET status = 'reviewing' WHERE change_id = 'leftover'"
+        )
+        conn.commit()
+        conn.close()
+
+        app = TrackingApp(identifier)
+        async with app.run_test(size=(120, 30)) as pilot:
+            await pilot.pause()
+            lv = app.query_one('#tracking-list', ListView)
+            labels = {
+                c.series['change_id']: c.render_label()
+                for c in lv.children
+                if isinstance(c, TrackedSeriesItem)
+            }
+
+        by_time = datetime.datetime(2099, 11, 19, 10, 0, tzinfo=datetime.timezone.utc)
+        local = f'{by_time.astimezone():%Y-%m-%d %H:%M}'
+        assert '0/1] (until tag v99.0-never) tagwait' in labels['by-tag'].plain
+        assert f'0/1] (until {local}) timewait' in labels['by-time'].plain
+        assert '0/1] nountil' in labels['no-until'].plain
+        assert '0/1] leftover' in labels['leftover'].plain
+        # The reason is dimmed so the subject still stands out.
+        text = labels['by-tag']
+        dimmed = [text.plain[s.start : s.end] for s in text.spans if s.style == 'dim']
+        assert dimmed == ['(until tag v99.0-never) ']
+
 
 class TestAttestationPasses:
     """The A column ignores unverifiable attestations, not failing ones."""