Skip to content

[Improve] Add bounded task-history pagination - #3053

Draft
roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/task-history-pagination-294mc1yjqf303
Draft

roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/task-history-pagination-294mc1yjqf303

Conversation

@roomote-roomote

Copy link
Copy Markdown
Contributor

​Opened on behalf of @mrubens. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

What changed

  • Add bounded, backward get_messages pagination with target- and order-bound continuation cursors.
  • Return explicit hasMore, nextCursor, coverage, truncated, and newer-arrival metadata for task and Session history.
  • Freeze each read to a commit-time snapshot, preserve deterministic ordering across equal timestamps and resumed/replayed events, and cap transcript payloads.
  • Thread cursors through the MCP schema, API member tools, worker client, and readable task-tool output.
  • Document the bounded history workflow and add real-database coverage for ordering, concurrency, authorization, and payload limits.

Why this change was made

Visual-proof audits need to reconstruct task stages across older history without requesting an oversized transcript. The previous latest-history behavior could truncate the evidence needed to connect capture entry, review handoff, and delivery.

Impact

Task and Session inspection now defaults to bounded pages and can walk older history until coverage.complete is true. Cursor contents contain only non-secret identifiers and timestamps, while existing task, Session, custom-automation, and Fast-session access checks remain in force. Large message content is explicitly marked as truncated instead of silently inflating the inspection payload.

@roomote-community

roomote-community Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • Fast-session continuation cursors are unstable after a replay updates an existing event's timestamp or turn sequence (apps/api/src/handlers/tasks/fastSessionCommunication.ts:115).

Reviewed 5d9be65

const conditions = [
eq(fastAgentMessages.conversationId, fastConversationId),
sql`coalesce(${fastAgentMessages.metadata} ->> 'visibleInTranscript', 'true') <> 'false'`,
fastSnapshotCondition(snapshot, fastConversationId),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The creation-time cutoff does not freeze Fast-session pages. upsertMessage updates an existing event's ts and turnSeq on replay while leaving createdAt unchanged, so a replay after page one can move a pre-snapshot row across this cursor boundary. It still passes this predicate and hasNewer remains false, which can skip or duplicate it on the continuation page. The paging snapshot needs to account for mutable replayed rows (or the stored page ordering needs to be immutable).

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant