Skip to content

fix(core): apply system-time snapshot to history when known_at is omitted - #167

Merged
Coding-Dev-Tools merged 2 commits into
mainfrom
fix/why-timeline-known-at-default
Aug 25, 2026
Merged

fix(core): apply system-time snapshot to history when known_at is omitted#167
Coding-Dev-Tools merged 2 commits into
mainfrom
fix/why-timeline-known-at-default

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

why() and timeline() only applied their system-time post-filter
(ingested_at / expired_at) when the caller passed an explicit known_at.
On the default call path — known_at=None, which is how the service layer,
MCP tools, and dashboard call them — the filter was skipped entirely, so:

  • retention-expired records (expired_at <= now) leaked into public history output
  • future-dated records (ingested_at > now) appeared before they were known

RecallEngine.recall() already normalizes this exact case by defaulting
known_at to the current snapshot (core/recall.py:186-188). This change
applies the same normalization in _relatedness(), which backs both history
helpers.

Test plan

  • New regression test test_why_and_timeline_default_snapshot_hides_expired_and_future_records
    covers the default path with a retention-expired record, a future-dated record,
    and a live closed-interval control (must still appear).
  • Existing test_why_and_timeline_history_respect_known_time_but_keep_closed_records
    confirms explicit known_at=100.0 behavior is unchanged.
  • Full tests/test_engine.py: 122 passed, 2 env-skipped.
  • Adjacent modules (service, MCP, inspector, poisoning boundary, vectors,
    compact recall, session idempotency/isolation): 287 passed.
  • ruff clean; pyright: 0 errors on the changed file.

Co-authored-by: CommandCodeBot noreply@commandcode.ai

Coding-Dev-Tools and others added 2 commits August 25, 2026 08:10
setdefault kept a real shell export working, so an owner machine exporting
ENGRAPHIS_EXTRACTOR=llm_structured leaked a live LLM extractor into every
ingest-path test. Under tests/conftest.py's DNS stub the extraction call
hangs instead of failing fast, deterministically timing out
test_session_close_linearizes_before_delayed_memory_write[ingest].

Force the variable to "none" like ENGRAPHIS_UPDATE_CHECK; tests that
exercise extraction already opt back in explicitly via monkeypatch.setenv.
…tted

why()/timeline() only ran the ingested_at/expired_at post-filter when the
caller passed an explicit known_at. On the default call path (known_at=None)
retention-expired and future-dated records leaked into public history output.
Normalize to now_ts() when known_at is omitted, matching RecallEngine.recall.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Coding-Dev-Tools
Coding-Dev-Tools merged commit 68dcc3a into main Aug 25, 2026
23 checks passed
@Coding-Dev-Tools
Coding-Dev-Tools deleted the fix/why-timeline-known-at-default branch August 25, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant