Skip to content

feat(report): drilldown reverse + offset options — let users reach the newest messages - #123

Open
Tyan66666 wants to merge 3 commits into
ranxianglei:masterfrom
Tyan66666:feat/drilldown-reverse-offset
Open

feat(report): drilldown reverse + offset options — let users reach the newest messages#123
Tyan66666 wants to merge 3 commits into
ranxianglei:masterfrom
Tyan66666:feat/drilldown-reverse-offset

Conversation

@Tyan66666

@Tyan66666 Tyan66666 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Closes #93

Problem

When agent opens the acp_status drilldown (scope:"uncompressed" + view:"messages", sort:"time"), the list always starts at the oldest message. slice(0, limit) only ever shows the head, so once the conversation is longer than limit, the newest messages are simply unreachable — there is no way to flip the order (reverse), page forward (offset), or sort newest-first. The same head-only limitation applies to sort:"size" / sort:"tool" and to scope:"compressed".

Why it matters differs by host:

Fix

Two new optional options on StatusReportOptions (backwards-compatible, no behavior change when omitted):

  • reverse?: boolean — after sorting, flip the order. sort:"time" + reverse:true gives newest-first, so the tail of a long conversation becomes reachable.
  • offset?: number — pagination. Rows are windowed with slice(offset, offset + limit).

Applied in renderMessageDrilldown and renderCompressedDrilldown (both honor reverse then window with offset). Footer text: offset 0 keeps the existing N of M shown.; offset > 0 prints Showing A–B of M.; an offset past the end prints Offset N past end (M total). instead of a silent empty page. The overview Tip now advertises sort:"time" + reverse:true for newest-first, and README's drilldown options table + example are updated.

Usage:

buildStatusReport(state, messages, countTokens, {
  scope: "uncompressed",
  view: "messages",
  sort: "time",
  reverse: true,   // newest message first — reach the tail
  limit: 30,
});
// pagination: offset: 30 → the next page

Tests

7 new cases in tests/report-drilldown.test.ts: status-quo pin (oldest-first head-only), reverse:time reaches the newest messages, offset pagination in both directions, offset past end, sort:"size" reverse (smallest-first), tool filter + reverse, and scope:"compressed" reverse + pagination. Full suite: 444 pass, typecheck + build clean.

sort:time drilldown was ascending-only with slice(0,limit) head truncation,
so the newest messages were unreachable in any sort once the conversation
exceeded the limit (acp-kernel#93). Hosts without <acp> ref tags in the
message stream (billion-context-dsh) rely on the drilldown as their only
message-location entry, amplifying the gap.

- StatusReportOptions: add reverse?: boolean (flip sorted order) and
  offset?: number (pagination), both backwards-compatible
- renderMessageDrilldown + renderCompressedDrilldown: apply reverse after
  sorting, window shown rows with slice(offset, offset + limit)
- footer: 'N of M shown.' stays for offset 0; offset > 0 prints
  'Showing A–B of M.'; offset past end prints 'Offset N past end' instead
  of a silent empty page
- overview Tip now advertises sort:"time" + reverse:true newest-first
- tests: 7 drilldown cases (status-quo pin, reverse:time tail reach,
  offset pagination both directions, past-end, size reverse, tool filter
  + reverse, compressed scope)
- README: buildStatusReport drilldown options table + example
…nd assertion

- README: drop the options table, document reverse/offset in the same
  prose+example style as the renderTags section (option defaults inline,
  compatibility note last)
- test: replace blank-line-strip body check with a line-level assertion
  (no '  m<N>' rows after a past-end offset) — robust against future
  non-row ref mentions
@Tyan66666 Tyan66666 changed the title feat(report): drilldown reverse/offset — reach newest messages feat(report): drilldown reverse + offset options — let users reach the newest messages Aug 22, 2026
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.

enhancement: acp_status drilldown cannot reach the newest messages — sort:time is ascending-only, slice(0,limit) has no offset/reverse

1 participant