Skip to content

fix(session_search): demote cron below interactive sessions in discover ranking - #53597

Merged
teknium1 merged 1 commit into
mainfrom
fix/19434-session-search-cron-demotion
Jun 27, 2026
Merged

fix(session_search): demote cron below interactive sessions in discover ranking#53597
teknium1 merged 1 commit into
mainfrom
fix/19434-session-search-cron-demotion

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

session_search discover now surfaces the user's own conversations even when cron jobs flood the FTS index — fixing the "recall blindness" sub-bug of #19434 where only cron sessions came back.

Root cause: cron jobs accumulate large volumes of repetitive vocabulary (recurring project names, dates, summaries). Under bare BM25 their rows dominate the top FTS results, so discover's early-exit-at-N lineage dedup collected only cron sessions and the user's interactive sessions never made the cut.

Changes

  • tools/session_search_tool.py: _order_for_recall() stable-sorts FTS rows so interactive sources rank above cron before lineage dedup. Within each class BM25/recency order is preserved (Python's sort is stable). Cron is demoted, not excluded, so it still surfaces when it's the only match.
  • tools/session_search_tool.py: raise discover scan limit 50 → 300 so interactive matches buried under a wall of cron rows are still in hand for the demotion pass.
  • tests/tools/test_session_search.py: 3 new tests — interactive ranks above cron when both match, cron still reachable when it's the only match, _order_for_recall is stable within class.

Validation

Before After
query matches 1 interactive (older) + 12 cron (newer) top result is a cron session top result is the cli/telegram session
query matches only cron cron returned cron still returned
session_search suite 50 passing 53 passing (50 + 3)

E2E verified against a real state.db (12 cron sessions out-numbering one older interactive session → interactive ranks first, cron fills remaining slots).

Scope

This addresses the cron-flooding sub-bug of #19434. The other audited items are already handled: the JSON/SQLite split-brain by #52798 (FTS write-corruption detect + repair + gateway preferring live cached history), and child-session hiding is superseded by in-place compaction (no parent/child fork → archived turns stay FTS-searchable on the same id).

Fixes #19434 (cron-flooding portion).

Infographic

session-search-cron-demotion

…er ranking

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of #19434. The split-brain sub-bug is
covered by #52798; the child-session sub-bug is superseded by in-place
compaction.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/19434-session-search-cron-demotion vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11508 on HEAD, 11508 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 6057 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have labels Jun 27, 2026
@teknium1
teknium1 merged commit fe1c1c1 into main Jun 27, 2026
30 checks passed
@teknium1
teknium1 deleted the fix/19434-session-search-cron-demotion branch June 27, 2026 11:41
pai-scaffolde pushed a commit to pai-scaffolde/hermes-agent that referenced this pull request Jun 28, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…er ranking (NousResearch#53597)

Cron jobs accumulate large volumes of repetitive vocabulary (recurring
project names, dates, summaries) and out-number a user's interactive
sessions. Under bare BM25 they dominate the top FTS rows, so discover's
early-exit-at-N dedup collects only cron sessions and the user's own
conversations never surface — "recall blindness" (NousResearch#19434).

- _order_for_recall() stable-sorts FTS rows so interactive sources rank
  above cron before lineage dedup; within each class BM25/recency order
  is preserved. Cron is demoted, not excluded, so it still surfaces when
  it is the only match.
- raise discover scan limit 50 -> 300 so buried interactive matches are
  in hand for the demotion pass.

Fixes the cron-flooding sub-bug of NousResearch#19434. The split-brain sub-bug is
covered by NousResearch#52798; the child-session sub-bug is superseded by in-place
compaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session_search recall failures: cron drowns user sessions in FTS + JSON/SQLite split-brain + child sessions hidden

2 participants