bug(conflicts): scan --since skips observations created on the same UTC day

Open Beginner friendly
#2,501 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, sqlite
Domain
cli, databases

Research direction

Start with the --since filtering in internal/store/relations.go, especially the lines cited in the report, and trace how observation timestamps are stored and compared. Check the related SinceTime filter there as well. Add regression coverage for a timestamp later on the same UTC day, then confirm the scan includes those observations.

Written by the indexing model from the issue text.

Description

status:needs-review type:bug
Existing Issue Search
  • I searched existing issues and will add evidence to a canonical tracker when applicable.

(Searched for "since RFC3339" and "conflicts scan since", and checked the 92 commits on main since v3.7.2. I found no report or fix.)

📝 Observed Consequence

engram conflicts scan --since <RFC3339> skips every observation created on the same UTC day as the --since value, even when the observation was created after that instant. A scan meant to cover only today's new memories inspects 0 observations, and the conflicts they would surface are never found.

🔄 Steps to Reproduce
export ENGRAM_DATA_DIR="$(mktemp -d)"
cd "$(mktemp -d)" && git init -q
engram save "Server port" "The test server listens on port 8080." --type decision --project demo
engram save "Server port" "The test server listens on port 9090." --type decision --project demo
sqlite3 "$ENGRAM_DATA_DIR/engram.db" "select id, created_at from observations;"
#   1|2026-11-27 07:03:53
#   2|2026-11-27 07:03:56
engram conflicts scan --project demo --since "$(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ)" --dry-run
#   inspected: 0
engram conflicts scan --project demo --since "$(date -u -d '1 day ago' +%Y-%m-%dT%H:%M:%SZ)" --dry-run
#   inspected: 2
✅ Expected Behavior

With --since set to one hour ago, the scan inspects both observations, because both were created after that instant.

❌ Actual Behavior

It inspects 0. Only a --since value from an earlier UTC day includes them.

The cause appears to be a text comparison between two different timestamp formats. created_at is stored as 2026-11-27 07:03:56 (with a space), while the scan binds --since as opts.Since.UTC().Format("2006-01-02T15:04:05Z") (with a T) in AND created_at >= ?. Compared as text, the space (0x20) sorts before T (0x54), so on the same day every stored row compares as earlier. See internal/store/relations.go lines 1460-1462 at 11521f4f3776.

Lines 1281-1283 build AND r.created_at >= ? for SinceTime the same way, so relation listing by time may have the same problem. I did not test that path.

Passing --since with a space is not a workaround: it fails with --since must be RFC3339 format.

Operating System

Linux (Ubuntu/Debian)

Release Version (Report Context)

engram 3.7.2 (Homebrew)

Agent / Client

Claude Code

Dominant language
Go
Stars
7.1k
Forks
729
Avg merge
1h 35m
Merged PRs (30d)
154

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gentleman-Programming/engram

All issues in Gentleman-Programming/engram

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.