Skip to content

Same-timestamp rows: message order without a tie-break, and a profile upkeep watermark that can miss facts #236

Closed

Description

@itsskofficial

Found while fixing flaky tests (#228, #235). Windows' clock advances every 15.6 ms by default, so rows saved in the same tick share a timestamp.

  • Message order without a tie-break: sentient/agent/loop.py (around lines 1094 and 1221) and sentient/memory/episodic.py (around line 199) order messages by created_at only. Messages saved in the same tick can come back in the wrong order, which can scramble what the model sees. fix: make timing-sensitive tests reliable on busy machines #235 fixed the same problem in the user model by adding rowid as a tie-break; apply the same here and check the store for other ORDER BY created_at queries.
  • Profile upkeep watermark: upkeep picks new facts with updated_at > since. A fact saved in the same tick as an upkeep run, after its query, is never added to the profile. Use a watermark that can't collide (for example the highest fact rowid seen, or a sequence number).

Done when: both are fixed, with tests that reproduce the same-tick case (for example by freezing the clock).

Activity

  1. added
    bug
    help wanted
    area: engine
    area: memory
    priority: P1
    size: S
    on Oct 10, 2026
  2. added 2 commits that reference this issue on Oct 11, 2026
    79ca243
    b6da0f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: enginearea: memorybughelp wantedpriority: P1size: S

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions