fix(core): apply system-time snapshot to history when known_at is omitted - #167
Merged
Merged
Conversation
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>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
why()andtimeline()only applied their system-time post-filter(
ingested_at/expired_at) when the caller passed an explicitknown_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:
expired_at <= now) leaked into public history outputingested_at > now) appeared before they were knownRecallEngine.recall()already normalizes this exact case by defaultingknown_atto the current snapshot (core/recall.py:186-188). This changeapplies the same normalization in
_relatedness(), which backs both historyhelpers.
Test plan
test_why_and_timeline_default_snapshot_hides_expired_and_future_recordscovers the default path with a retention-expired record, a future-dated record,
and a live closed-interval control (must still appear).
test_why_and_timeline_history_respect_known_time_but_keep_closed_recordsconfirms explicit
known_at=100.0behavior is unchanged.tests/test_engine.py: 122 passed, 2 env-skipped.compact recall, session idempotency/isolation): 287 passed.
Co-authored-by: CommandCodeBot noreply@commandcode.ai