Skip to content

journal: timestamp comparison is string-based and format-sensitive, and is now the primary dedup discriminator #979

Description

@laynepenney

Two follow-ups from the review of the session-resume dedup fix (the reorder that made timestamp the primary discriminator within the manual/auto class). Neither blocked that fix; both should not be lost.

1. Timestamp comparison is string comparison, and the entry producers do not share a format.

The dedup ordering compares entry.timestamp values as strings. journal.py has three producer paths and they do not pin a common format: one writes timezone-aware UTC isoformat, one is unpinned, and one inherits its format from transcript chunk data. Measured on one machine for the same instant:

aware: 2026-08-13T17:11:14.875726+00:00
naive: 2026-08-13T12:11:14.876038

String comparison orders naive < aware here: five hours of apparent ordering that is formatting, not chronology.

Before the reorder, timestamp was a rarely-decisive third tuple element; it is now the primary discriminator, so any format divergence between producers becomes load-bearing on every dedup. This is not demonstrated as a live collision: the auto path cannot reach the comparison, and the two manual producers have not been shown to disagree in practice. The fix belongs at comparison time (parse, then compare, with naive values interpreted under a documented assumption), because write-time normalization cannot repair entries already on disk.

2. Stale docstring summary line.

_dedup_entries' first docstring line still reads "Keep only the richest entry per session_id" directly above the corrected Priority line. Two reviewers flagged it independently during the same review; fold it into whichever journal change lands next.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions