Skip to content

perf(mcp): seek canonical open pages without rescanning whole sessions #598

Description

@eric-tramel

Summary

The original projector-retirement work described by this issue was delivered by #630: events is now the full-content source, the mcp_open_* runtime tables are gone, and canonical open uses thin locator/navigation indexes.

One performance problem remains. open(session|turn|event) can scan the entire session navigation history to build a page, and continuation pages can repeat that narrow full-session scan. Large sessions therefore pay prior-history cost on each page even though the response is bounded.

This issue tracks only that residual problem. Do not restore a transcript cache, publication-head architecture, or the deleted projector.

Scope

  • Seek directly to the requested session/turn/event page through content-free navigation data.
  • Hydrate text and payloads only for events on the selected page.
  • Avoid rereading the full session prefix on every continuation page.
  • Preserve turn boundaries, summaries, neighbors, ordering, scope checks, event-version checks, and cursor/reopen behavior.
  • Extend the existing content-free navigation index only if direct keyset predicates cannot preserve current behavior.
  • Keep open(event) isolated to its locator seek and owning session.

Acceptance criteria

  • Query logs show continuation pages do not rescan the full session navigation history.
  • A complete traversal performs at most one session-wide narrow ordering pass plus work proportional to returned pages.
  • Text/payload reads are limited to selected-page events.
  • open(event) does not scan unrelated sessions.
  • Large-session benchmarks meet the existing open memory/latency targets under perf(clickhouse): bound aggregate query resources and expose pressure #644's resource limits without a default elapsed-time deadline.
  • Existing scope, ordering, summary, turn-boundary, cursor, and full-payload fixtures pass.
  • No full-content read model or cache is introduced.

Chain

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical priorityarea/clickhouseClickHouse integrationarea/mcpMCP service and protocol behaviorbugSomething isn't workingstatus/merge-trainAutomation lock label for merge-train repair work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions