Skip to content

feat(conversations): --all on list follows next_cursor to the end - #20

Open
usv240 wants to merge 2 commits into
bee-computer:mainfrom
usv240:feat/conversations-list-all
Open

usv240 wants to merge 2 commits into
bee-computer:mainfrom
usv240:feat/conversations-list-all

Conversation

@usv240

@usv240 usv240 commented Oct 8, 2026 •

Copy link
Copy Markdown

What

Adds --all to bee conversations list. It follows next_cursor until the server stops returning one, then prints a single combined response: { conversations, next_cursor: null, timezone }. --limit still sets the page size and --cursor sets where to start.

Why

list returns one page (20 by default), so reading a whole history means every client writes the same paging loop. On a real account with 143 conversations over nine days, bee conversations list --json returns 20; bee conversations list --all --limit 100 --json returns all 143.

This bit me while building on the CLI for the Amazon Developer Hackathon: a first pull came back with two days out of nine and nothing looked wrong. bee changed without a cursor also only covers recent changes, so list is the only way to read a full history, and it shouldn't take a loop to do it.

Details

  • New CLI flag --all (kind: "bool"); USAGE and README updated.
  • Stops when next_cursor is missing or empty, when a page comes back empty (even if it carries a cursor), or after a 1000-page safety cap, so a misbehaving cursor can't loop forever. The combined response reports next_cursor: null in every case except the cap, where more history is known to remain.
  • CLI only. The MCP tool bee_list_conversations is unchanged: agents already page one tool call at a time, and returning a whole history in one tool result would be the wrong shape for them. The tool snapshot is untouched.
  • Without --all, behaviour and output are byte-for-byte the same.

Tests

Four new tests in sources/resources/conversations/index.test.ts:

  • follows three pages and returns ids [1, 2, 3], checking each request's query string
  • starts from --cursor when given
  • stops on an empty page that still carries a cursor, and reports next_cursor: null
  • prints no pagination footer in Markdown when it stops that way

bun run typecheck and bun test pass locally (315 pass, 1 skip, 0 fail).

Heads-up: as in #12, installing locally needed a workaround for #10 (bun.lock resolves to a private registry). No lockfile changes are included in this PR.

bee conversations list returns one page; reading a whole history means a
paging loop in every client. --all follows next_cursor until it runs out
and prints one combined response. --limit sets the page size, --cursor
the starting point, and an empty page or a 1000-page cap stops the loop.
CLI only: MCP callers already page one tool call at a time.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Empty terminal pages incorrectly preserve and return their cursor instead of null.

1 open finding
What changed in this PR

Adds automatic pagination to bee conversations list via --all.

Changes:

  • Follows cursors while aggregating conversations.
  • Adds pagination tests and CLI documentation.
File Description
sources/​resources/​conversations/​index.ts Implements --all pagination.
sources/​resources/​conversations/​index.test.ts Tests pagination behavior.
README.md Documents the new flag.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +169 to +173
const next = record["next_cursor"];
cursor = typeof next === "string" && next.length > 0 ? next : undefined;
if (cursor === undefined || items.length === 0) {
break;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch, fixed in ab2c0be. An empty page now ends the walk with next_cursor: null, so there is no pagination footer either. Only the 1000-page cap leaves a cursor in place, since that is the one case where more history is known to remain. The empty-page test now asserts next_cursor is null, and a new test checks the Markdown output has no ## Pagination section. Both fail on the previous commit and pass now. Full suite: 315 pass, 1 skip, 0 fail; typecheck clean.

…page

An empty page that still carried a cursor ended the walk but left the
cursor in the combined response, so --all printed next_cursor and a
pagination footer for a page it had decided not to follow. Only the
page cap now leaves a cursor in place. Review feedback on bee-computer#20.
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.

2 participants