omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(cli): conversation list --limit above 100 (25 with --include-transcript) silently returns a truncated page

Open goldnbones opened this issue 2 months ago • 2 comments

Symptom

omi conversation list --limit 200 prints at most 100 rows under a table titled conversations (limit=200); omi conversation list --include-transcript --limit 50 prints at most 25. In --json mode an agent that paginates with the CLI's documented bound (--limit 200 --offset 200, --offset 400, …) silently skips half of every window. Nothing warns, the exit code is 0, and the CLI's own help advertises --limit up to 200.

Evidence

  • sdks/python-cli/omi_cli/commands/conversation.py line 39: limit: int = typer.Option(25, "--limit", min=1, max=200); lines 51-62 issue one GET /v1/dev/user/conversations with that limit.
  • backend/routers/developer.py get_conversations (line ~1474): limit = max(1, min(limit, 25 if include_transcript else 100)) — clamped before the Firestore query, and the response carries no effective-limit signal. docs/api-reference/openapi.json declares limit with default: 25 and no maximum, so a client cannot know the cap from the contract.
  • The other list commands are unaffected because their endpoints clamp at 1000 (memories, action-items) or above the CLI bound (goals); only conversations sits below the CLI's --limit range.
  • Reproduced hermetically with a respx stub that clamps like the API: --limit 200 produced 100 rows from a single limit=200 request. The same class of silent truncation applies to the export example in docs/doc/developer/api/conversations.mdx (lines ~850-873), which pages with limit = 100 and include_transcript: True and then offset += limit, so it skips 75 of every 100 conversations — noting it here as a follow-up rather than mixing a docs change into the CLI fix.

Proposed Fix

Have conversation list honour --limit by splitting the requested window into offset-preserving, server-sized page requests (100, or 25 with --include-transcript) that advance by the requested page size — the API filters locked conversations after paging, so a short page is not exhaustion (the contract action-item get already follows, #13214); an empty page is. The result is exactly what one honoured request would return, so a user's own --offset paging stays consistent. Requests at or below the cap keep issuing a single unchanged call.

Tests

sdks/python-cli/tests/test_conversation_list_paging.py drives the real Typer app through CliRunner against a respx stub that clamps like the API: 200 rows arrive as two limit=100 requests; --include-transcript --limit 60 becomes 25/25/10; --offset 10 --limit 150 requests (100, 10) then (50, 110); an empty page stops; a short page continues; --limit 100 stays a single request. Six of the seven cases fail on main.


Proposed Bounty Reward: $50.00 USD Bounty Payout Destination (PayPal): will be provided by email to [email protected] on payout

cc @josancamon19 @kodjima33

goldnbones avatar Sep 14 '26 21:09 goldnbones

Hi! I'd like to work on this. The fix involves:

  1. Backend: Remove or raise the hard cap in get_conversations() (currently clamps to 100/25) to match what the OpenAPI spec advertises
  2. CLI: Add client-side pagination that splits large --limit requests into server-sized pages and merges results
  3. Docs: Fix the export example in conversations.mdx that would skip 75 of every 100

Claiming now — I have 10+ open PRs in this repo and understand the codebase.

armorbreak001 avatar Sep 14 '26 22:09 armorbreak001

Opened PR #13991 resolving this issue.

Summary of resolution:

  • Zero backend changes: Leaves backend/routers/developer.py server limits and security hardening completely untouched (avoiding any regressions to test_dev_api_conversations_poison.py).
  • Client-side paging loop: omi_cli.commands.conversation.list_conversations automatically chunks requests exceeding server limits (25 with --include-transcript, 100 without).
  • Post-filter resilience: Advances pagination by current_offset += batch_limit rather than len(page), correctly handling short pages caused by server-side post-filtering.
  • Unit tests: Added 6 tests in sdks/python-cli/tests/test_conversation_list_paging.py asserting limit chunking, offset continuity, empty-page termination, and short-page continuation. All 433 CLI tests pass cleanly.

Aj2280 avatar Sep 15 '26 10:09 Aj2280