Skip to content

sessions: message search reports complete_zero/fresh during catch-up #2512

Description

@ScriptedAlchemy

What happens

tracedecay_message_search answers complete_zero with temporal.freshness.state: fresh and all watermarks 0 while the store's historical catch-up is pending. The answer claims that nothing matches, but the workers have not admitted the sources yet.

#2390 reported the same answer on the operator profile during Codex catch-up (complete_zero, freshness: fresh, all watermarks 0).

Reproduction

Branch cursor/codex-catchup-walk-335c at 53dacc318f (PR #2441). There, sessions import hands catch-up to the refresh workers and returns a partial receipt (one deferred unit per store) without waiting.

cargo test -p tracedecay --features test-helpers,test-transport --test mcp_suite -- --exact \
  mcp_handler_test::session_search_test::scheduled_session_import_makes_the_final_codex_source_searchable

The first search after the import receipt returns:

{"count":0,"outcome":"complete_zero","provider":"codex","require_fresh":false,"results":[],"store_scope":"project",
 "temporal":{"coverage":{"hidden":0,"redacted":0,"unknown":0,"visible":0},"freshness":{"state":"fresh"},
 "watermarks":{"generation":0,"index":0,"projection":0,"source":0,"summary":0}}}

The worker's serving state at that moment is Stale { HistoricalConvergence }: the import marks history pending before it wakes the worker.

Cause

DaemonSessionRetrievalService::retrieve_admitted (crates/tracedecay-session-runtime/src/session_retrieval/admitted.rs) consults refresh_not_current() only when requires_refresh_worker(query.freshness_policy()). A default search (require_fresh: false) runs against the projected store. It reports that store's own freshness, which is fresh for an empty store.

Expected

While the serving state is historical convergence or retry, an empty answer is not complete. It should come back as a typed not-yet-converged outcome (the existing Stale outcome, or partial with unknown coverage), and it becomes complete_zero only once history is current.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions