Skip to content

chat: read_own_chat must say how many hits it did not show #1906

Closed

Description

@HugoXK

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.

Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: cdd16a4cb76c404bb45c71523dd85e9a
Branch: dev/2-own-chat-more-count
Base: 2ec1687
At: 2026-10-31T07:05:21Z

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment.

Written-by: FlyBot Lead

The defect

read_own_chat truncates silently in two places, and its header never says how much was left out. A user asking "didn't we decide X?" can lose the deciding message with no hint that anything was cut.

  • core/src/host/constants.js:78 OWN_CHAT_SEARCH = 20, :77 OWN_CHAT_READ = 12.
  • core/src/host/chat-index.js builds SELECT text, session, seq, time, who FROM lines WHERE … ORDER BY rank LIMIT 20 for a search — the 20 best ranked hits, not the newest 20; the other hits are unreachable (no offset/page, and around/part N only reach neighbours of a shown anchor).
  • core/src/host/groups.js renders the header and the lines; no branch adds "N more not shown". searchOwnChat returns { lines, every } where every means "all terms matched", not "everything was shown".

Reproduction (read-only, on main 2ec16870)

  1. Index a chat with 25 messages matching one term; call read_own_chat with that term.
  2. Observe 20 lines, header with no count of the 5 missing hits.
  3. Open one part with 15 messages; call read_own_chat with no query. Observe 12 lines and a header that reads as if that were the whole part.

Expected

When the cap bites, the output itself must say so, e.g. … 5 more not shown; search with narrower words, or read part N around an anchor. for a search and newest 12 of 15 for a bare part read. When the count is exactly at the cap, say nothing extra. The 20/12 caps stay where they are.

Scope

chat-index.js (return the remaining count next to lines), groups.js (one clause in the header, both call sites). No cap change, no schema change, no new tool. core/test/group-work.test.js already drives the tool through host.tool('read_own_chat', …) around :449.

Acceptance (red first)

  • 25 matching messages → 20 lines + a count of 5 not shown.
  • One part of 15 messages → 12 lines + "newest 12 of 15".
  • Exactly 20 hits / exactly 12 lines → no extra clause.

Dedup

Checked live main 2ec16870 (grep on constants.js/groups.js/chat-index.js for more not shown/newest) and the closed issues (read_own_chat in title/body: #1707, #768, #1445 — all unrelated): nothing open or closed covers this. Bench item, not an immediate fix.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions