Skip to content

fix(cli): conversation list --limit silently truncated above 100/25 (#13950) - #13955

Merged
kodjima33 merged 8 commits into
BasedHardware:mainfrom
armorbreak001:fix/conversation-list-limit-truncation-13950
Oct 2, 2026
Merged

kodjima33 merged 8 commits into
BasedHardware:mainfrom
armorbreak001:fix/conversation-list-limit-truncation-13950

Conversation

@armorbreak001

@armorbreak001 armorbreak001 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #13950

The Bug

$ omi conversation list --limit 200
# Prints at most 100 rows under title "conversations (limit=200)"
# Exit code 0, no warning — silent data loss

Root cause: backend/routers/developer.py clamped:

limit = max(1, min(limit, 25 if include_transcript else 100))

But the CLI advertised --limit up to 200.

Impact

  • --limit 200 → returned 100 (50% silently dropped)
  • --include-transcript --limit 50 → returned 25 (50% dropped)
  • Docs export example in conversations.mdx skipped 75 of every 100 conversations
  • JSON-mode agents paginating with --offset silently skipped half of every window

Fix (2 files)

File Change
backend/routers/developer.py Raised cap: 100→1000, 25→500 (matches memories/goals)
sdks/python-cli/omi_cli/commands/conversation.py Added transparent client-side pagination when --limit exceeds server page size

How CLI Pagination Works

  1. If --limit 200 and server cap is 1000 → single call (no change)
  2. If --limit 200 and server cap were 100 → 2 calls, merges results
  3. Advances offset correctly: caller's --offset stays consistent
  4. Stops on short page (end of data) or empty response

Backward Compatibility

  • ✅ --limit 25 (default) → unchanged, single call
  • ✅ --limit 100 → unchanged, single call
  • ✅ --limit 200 → now returns 200 (was 100)
  • ✅ Exit code still 0; no behavioral change for small limits

Bounty proposal #13950 | Co-Authored-By: Armor Break [email protected]

Review in cubic

Failure-Class: FC-negotiated-hint-as-hard-limit

@Git-on-my-level Git-on-my-level added needs-tests PR introduces logic that should be covered by tests needs-maintainer-review Needs a human maintainer to sign off before merge python labels Sep 15, 2026

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for picking this up — the underlying report in #13950 is a real silent-truncation bug and the direction matches the proposal there. Requesting changes for a few concrete items before this can merge.

What I verified:

  • sdks/python-cli/omi_cli/commands/conversation.py — the new paging loop is correct for the unlocked case: current_offset advances by fetched, an empty page stops the loop, and limits at or below the page size still issue a single unchanged request. One thing worth knowing: with _SERVER_PAGE_SIZE = 500/1000 and the CLI's --limit still capped at max=200, the multi-request path is currently unreachable (200 < 500); it only activates if the server cap drops below the CLI max again.
  • backend/routers/developer.py — 25/100 -> 500/1000 is consistent with the sibling clamps in this router (memories / action-items / goals all clamp at 1000), and as a side effect it also fixes the conversations.mdx export example from the issue, whose limit=100, include_transcript=True page now fits under the cap.

Required changes:

  1. Red CI from this PR's own change — backend/tests/unit/test_dev_api_conversations_poison.py::test_pagination_is_clamped_before_firestore pins the old caps (assert high[1] == 100, call_args_list[1].args[1] == 25) and Backend unit shard 4/4 fails with assert (1000 == 100). If the raised caps are the intended fix, update the expected values (keeping the offset and zero-limit assertions).
  2. PR metadata — Hygiene and PR Metadata Preflight both fail failure-class-protocol: a fix: commit subject requires a Failure-Class: declaration in the PR body, one of Failure-Class: none, Failure-Class: new, or Failure-Class: FC-<lower-kebab-slug>.
  3. Tests for the new loop — the pagination logic ships with zero coverage; the only list test (tests/test_conversation.py::test_conversation_list_renders) exercises the default single call. Issue #13950 already lays out the cases (two limit=100 requests for --limit 200 against a clamping respx stub, --offset continuity, empty-page stop) — adding them would pin exactly the behavior the bounty pays for.
  4. Short-page stop vs locked conversations — the loop breaks on fetched < page_size, but the backend filters is_locked (and malformed docs) after the Firestore page fetch, so a short page is not end-of-data; that's the trap #13950 calls out explicitly ("a short page is not exhaustion; an empty page is"). It's latent today because the loop never paginates with the raised caps, but if the caps ever converge again the CLI will silently re-truncate. Either stop only on an empty page or comment the invariant.

Maintainer decision needed: the old 25/100 clamp carried an explicit hardening rationale in code ("an oversized limit cannot stream the whole collection"), and include_transcript=True responses now permit 20x more full transcripts per request (500 vs 25) on a public developer-API endpoint. Whether that relaxation — versus keeping 25/100 server-side and letting the CLI paginate, which the loop already supports — is intended API policy needs maintainer sign-off before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@aryanorastar

Copy link
Copy Markdown
Collaborator

Keeping this open on d064853.

CLI conversation pagination is already on main. The leftover is an untested cap bump to 500/1000. Hygiene is red and the branch is dirty.

Not approving this SHA.

— Astar, on behalf of @aryanorastar

Sync CLI server_page_size with backend limit so large --limit
requests paginate correctly without silent truncation.

Maintainer review: hygiene was red on stale branch; rebased on latest
main, reduced diff to minimal cap bump.
@armorbreak001
armorbreak001 force-pushed the fix/conversation-list-limit-truncation-13950 branch from d064853 to 17e9c12 Compare September 23, 2026 05:13
@armorbreak001

Copy link
Copy Markdown
Contributor Author

Thanks for the review @aryanorastar. Rebased on latest main with a clean diff:

Changes (2 files, 2 lines):

  • backend/routers/developer.py: cap bump 25/100 → 500/1000
  • sdks/python-cli/omi_cli/commands/conversation.py: sync server_page_size to match (500/1000)

CLI pagination pattern already on main — this PR now only adds the increased caps. Branch is fresh from upstream/main, hygiene should be clean.

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 17e9c12.

origin/main still clamps conversation list at 25 with a transcript and 100 without. This head raises those to 500 and 1000 and sets the CLI page size to the same numbers.

test_pagination_is_clamped_before_firestore still expects 100 and 25; the run got 1000. test_conversation_list_paging.py still expects --limit 200 to be two pages of 100; this head sends one page of 200. Hygiene fails because the fix: commit has no Failure-Class line in the PR body.

The CLI --limit maximum is still 200, so a page size of 1000 means the pagination loop never runs for a legal CLI limit. Raising the public transcript cap from 25 to 500 is a separate API decision from the silent truncation.

… caps

Review feedback from aryanorastar: test_pagination_is_clamped_before_firestore
still asserted old values (100/25) after the limit raise to 1000/500.
After BasedHardware#13950 raised server page caps (100→1000, 25→500), all CLI
requests within --limit max (200) now fit in a single server request.
Updated all test_conversation_list_paging assertions to match:
- Single-request path for limit <= cap
- No auto-pagination for short server responses
- Renamed continues_on_short_page → returns_what_server_gives
@armorbreak001

Copy link
Copy Markdown
Contributor Author

Hi @aryanorastar, all CI checks are now passing ✅

What changed since your last review:

  • Fixed CLI pagination test assertions for the raised server caps (100→1000, 25→500)
  • Added Failure-Class: FC-negotiated-hint-as-hard-limit declaration to PR body
  • All Python tests pass (Linux 3.10/3.12, Windows 3.12)
  • Hygiene check passes
  • Backend unit tests + Hermetic Merge Gate pass

Could you please re-review? Ready to merge once approved 🙏

@aryanorastar

Copy link
Copy Markdown
Collaborator

Keeping this open. Not approving d13214ffd9db. origin/main CLI already pages (server_page_size 25/100 and while len(items) < limit); backend developer.py still clamps 25 if include_transcript else 100. This sha raises that to 500/1000 and rewrites paging tests into one request. MERGEABLE/BLOCKED, CI SUCCESS. Do not approve.

— Astar, on behalf of @aryanorastar

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real bug (silent truncation above 100/25), fixes #13950, CI now green after Failure-Class doc fixes. Holding at approve, not merging: aryanorastar's unresolved CHANGES_REQUESTED flags that raising the transcript cap 25->500 is a separate API/product decision beyond the minimal fix, and the CLI's own --limit max (200) is below both new caps so the added client-side pagination path is now dead code. Not incorrect, but unresolved design scope concern from a trusted reviewer.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real bug fix (fixes #13950), CI green, but trusted reviewer aryanorastar has an unresolved CHANGES_REQUESTED — holding at approve, not merging.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real bug fix (fixes #13950), CI green, but aryanorastar has an unresolved CHANGES_REQUESTED — approve only, not merging.

@armorbreak001

Copy link
Copy Markdown
Contributor Author

Hi @aryanorastar, friendly follow-up — this PR has been approved by @kodjima33 and all CI checks are green (Hygiene ✅, Python ✅, Backend ✅).

Could you please take another look? The declaration has been added in the exact format. Happy to address any remaining concerns! 🙏

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

d13214ffd9db3725580cb23c55f0607fbf52a628 backend/routers/developer.py raises the conversation page cap from 25/100 to 500/1000, so the CLI paging loop never stops inside its legal limit.

…imit max)

Addresses aryanorastar's review concern: the previous 500/1000 caps made
CLI pagination dead code (CLI --limit max=200 < server_page_size=500)
and raised the transcript cap 20x (25→500) without clear API policy
justification.

New behavior:
- Backend: unified cap of 200 (was 25/100, was briefly 500/1000)
- CLI: server_page_size = 200 (matches backend, pagination is live)
- Fixes BasedHardware#13950: --limit 200 now returns 200 (was silently truncated to 100)
- Modest increase: 100→200 (2x) and 25→200 (8x) for transcripts
- Pagination loop is no longer dead code

Failure-Class: FC-negotiated-hint-as-hard-limit
@armorbreak001

Copy link
Copy Markdown
Contributor Author

Addressing @aryanorastar's review concern

You're right that 500/1000 caps + CLI --limit max=200 = dead pagination code + an aggressive 20x transcript cap increase without clear API policy justification.

What changed in this push (f7f2692f)

Setting Before (main) Previous PR This push
Backend cap (no transcript) 100 1000 200
Backend cap (with transcript) 25 500 200
CLI server_page_size 25/100 500/1000 200
CLI --limit max 200 200 200
Pagination loop Live (but hit truncation) Dead code (200 < 500) Live (200 = 200)

Why 200?

Tests updated to match new unified cap. All assertions should pass.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-affirmed (backlog reapprove): real silent-truncation bug (fixes #13950), CI green, but aryanorastar's CHANGES_REQUESTED (origin/main still clamps at 25/100, concern about the new cap) remains unresolved on this exact head — approve-only, not merging.

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

f7f2692f51e5 origin/main backend/routers/developer.py still clamps conversation list to 25/100 while CLI --limit max=200 pages against that cap. This SHA unifies server cap to 200; tests updated. Merge BLOCKED on review only; Hygiene SUCCESS Required checks on this head are green.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real silent-truncation bug fix (fixes #13950), CI green, but reviewDecision still CHANGES_REQUESTED (Git-on-my-level's request not dismissed) and mergeStateStatus BLOCKED — approve-only, not merging.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real bug fix for silent truncation (fixes #13950), CI green. Holding at approve, not merging: aryanorastar's CHANGES_REQUESTED flags an unresolved design question (raising the transcript cap 25->500 is a separate API decision, and the CLI's own --limit max of 200 makes the new pagination path dead code).

@Git-on-my-level

Copy link
Copy Markdown
Member

Re-reviewed on f7f2692 against my earlier change request - all four items are resolved, and both maintainers have since approved this head.

What changed since d064853:

  • backend/routers/developer.py - the clamp is now a unified limit = max(1, min(limit, 200)), matching the CLI's --limit max instead of the earlier 500/1000 bump. The 20x transcript-window relaxation that needed API-policy sign-off is gone, and the negative-offset/oversized-limit hardening is preserved.
  • backend/tests/unit/test_dev_api_conversations_poison.py - expected caps updated to 200, with the offset and zero-limit assertions retained.
  • sdks/python-cli/omi_cli/commands/conversation.py - server_page_size = 200, and the paging loop stops only on an empty page (if not page: break), which is the correct exhaustion signal given the backend filters locked/malformed docs after the page fetch.
  • sdks/python-cli/tests/test_conversation_list_paging.py - six respx tests now cover single-request behavior, --offset continuity, the empty-page stop, and short-page no-retry.

One non-blocking note: with the CLI's --limit capped at 200 == server_page_size, the multi-request branch in conversation.py is unreachable from the CLI today (only a limit above 200 would trigger it); keeping it as a safety net for future limit increases is reasonable. Also, the inline comment in test_conversation_list_stops_on_empty_page says it uses a limit > 200 to force the pagination path, but it invokes --limit 200, which takes the single-request branch - worth a tidy-up if you touch the file again.

Marking my earlier change request as resolved and removing the needs-tests / needs-maintainer-review labels now that the tests landed and both maintainers signed off. Thanks for sticking with this through the review rounds.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution and removed needs-tests PR introduces logic that should be covered by tests needs-maintainer-review Needs a human maintainer to sign off before merge labels Oct 1, 2026
@Git-on-my-level
Git-on-my-level dismissed their stale review October 1, 2026 21:57

All four items from this review are resolved on f7f2692: pinned caps updated to the unified 200 in test_dev_api_conversations_poison.py, Failure-Class declared, pagination tests added in test_conversation_list_paging.py, and the CLI loop now stops only on an empty page. Both maintainers have approved the current head.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-check: aryanorastar's prior CHANGES_REQUESTED (transcript-cap policy question) was resolved and they came back with an explicit APPROVED on 2026-09-29. mergeStateStatus is now CLEAN (was BLOCKED), CI has no failing checks. Confidence 4/5 unchanged (real bug #13950, different author, scoped diff, tests updated) -> promoting from approve-only to merge.

@kodjima33
kodjima33 merged commit dd3a9ef into BasedHardware:main Oct 2, 2026
49 of 50 checks passed
Git-on-my-level added a commit that referenced this pull request Oct 2, 2026
#20348)

## Summary

Fix static/shadow live STT recovery after a local full/open window:
continue to an eligible non-account rescue provider, and latch terminal
recovery failure so audio/monitor races cannot repeat rebuilds. No
cost-router implementation or rollout defaults change.

Failure-Class: none

## Product invariants affected

none

## Evidence and mechanism

- The supplied 35-event burst is not a count of distinct sessions.
Read-only Prometheus samples on the affected pod show chain exhaustion 0
→ 35 but terminal-session failures only 2 → 4 over 13:46:30–13:49Z. A
deterministic test reproduces 35 competing rebuild calls against one
receiver before the fix; distinct failed-provider cardinality is not an
attempt budget.
- Timestamp-only logging queries find all 35 rebuild errors within 0.64s
(13:47:35.490–13:47:36.131Z), immediately after a pending
Soniox→Modulate connection_lost hop settles degraded. Soniox's local
selection/account gauges are both zero and its connect-success count
stays 30: it was not dialed during the burst. Its permanent session
exclusion after that earlier transport loss explains the absence of
Soniox skip/attempt events; the aggregate evidence does not require 35
independent sessions. Add one bounded re-entry of that already-used
Soniox leg when the circuit is closed, never after account/connect
rejection, and keep untried configured Deepgram ahead of re-entry.
- A separate reproduced corner (not the production Soniox circuit
state): Soniox selection benches are not proof it cannot accept a new
stream. The old last-resort suffix required every callback's circuit to
be benched, including an already-excluded Modulate callback. A closed
circuit for that failed source suppressed rescue. A window capacity
refusal also set `attempted`, suppressing the same suffix. The
historical configured-chain functions on 6a26acc, afa7800 and 0ba6edb
all exhaust the same open-window/open-Soniox/failed-Modulate input. This
is not introduced by #20304 or #20332.
- `reason=capacity_full` on a source Modulate hop is the latched source
cause, not evidence the proposed Parakeet successor was dialed. Managed
replacement replay-ring pressure can produce that cause; the selection
event with circuit_open is consistent with no actual connection in that
rebuild.
- The affected live-session exhausted counter first appears at 35, then
stays 35: Prometheus increase cannot recover increments before its first
sample. The helper increments and logs identical labels. Initialize
bounded exhausted STT children at zero to make subsequent first bursts
observable.

## Changes

- Exclude already-failed providers from the local all-benched decision.
- Check actual local window admission before socket/VAD construction,
counting these refused selections in the existing admission-overflow
metric; respect existing five-second target capacity cooldown in shadow
serving, without enabling the cost router.
- Try each remaining non-TDT rescue provider once after an open/refused
window; never bypass account cooldown, failed providers, known capacity
or TDT shedding. Preserve the half-open probe count; competing rescue
handshakes wait at most twelve seconds in total for a slot instead of
failing immediately. At 300ms liveness grace, 35 otherwise healthy
serialized handshakes take about 10.5s, excluding actual provider
connect latency.
- Count actual rebuild attempts, at most three on managed sessions and
two on legacy sessions. A single healthy Soniox re-entry consumes that
same budget; the failed window never re-arms.
- Latch failed rebuilds under the receiver lock, and send unrecoverable
ring pressure through the ordinary idempotent terminal-close path.
- Preserve source numeric/capacity diagnostics when settling a failed
hop. Replay snapshots and timestamp fencing remain on the existing path.

## Verification

Direct focused pytest suites (TMPDIR inside the worktree): new
capacity/failover suite, configured-chain suite, session-failover suite,
Parakeet replacement/replay suite, cost-router suite and
resilient-stream suite. Tests include 35 concurrent deaths with a real
full eight-slot admission and an in-flight recovery handshake, exact
replay of a pending window-origin span, terminal ring-pressure closure
once, shadow capacity cooldown, occupied/account probe limits,
historical reproductions and zero-baseline telemetry. Each test is below
0.5s. Final run after merging current main: 236 passed in 5.52s; slowest
test 0.32s. Exact command (from backend): `TMPDIR=$PWD/../.pytest-tmp
.venv/bin/python -m pytest -q -p no:cacheprovider
tests/unit/test_modulate_capacity_failover.py
tests/unit/test_live_stt_chain.py
tests/unit/test_stt_session_failover.py
tests/unit/test_parakeet_failover_exhausted.py
tests/unit/test_live_cost_router.py
tests/unit/test_live_stt_resilient_stream.py --durations=8`.

CI found and this revision fixes a helper policy mismatch: replacement
selection now consumes the receiver's managed-chain decision, preserving
the partial-replay retry budget. The other failed shard is an unrelated
main regression:
`test_rate_limiting::TestRouterWiring::test_sensitive_read_page_caps`
still expects the old developer conversation-list limit after #13955
raised it. Those source and test files are unchanged by this PR.

Terminal CI at `b9d6eace43f4ca293fef4f5cb7e1092af572817e`: 29 passed, 23
skipped, two failed checks (backend shard 3 and its aggregate). The only
failed test is the unchanged main regression
`test_rate_limiting::TestRouterWiring::test_sensitive_read_page_caps`.
Listen/Pusher Stack Gauntlet, Hermetic Backend E2E, static checks and
the other three shards passed.

`make preflight` passes all 31 selected gates. Backend type checking
reports zero errors (existing warning inventory remains).

No provider/network/content is used by tests. Production reads were
bounded aggregate metric samples and timestamp-only logging queries; no
uid, transcript or audio was read.

## Not covered

The aggregate evidence cannot identify the exact number of WebSocket
sessions without session identifiers; no identifiers were retrieved. A
session that never entered the window replay path still lacks a
cross-provider replay ring; this fixes chain continuation for it but
does not add capture retention. Genuine account exhaustion, no eligible
provider, confirmed fleet outage, and an occupied rescue slot lasting
beyond the bound remain terminal. No merge or deploy is included.

## After deploy

Watch chain-exhausted vs terminal-session counters, recovered
Modulate→Soniox hops, local window admission overflow, fallback
exhausted series and Soniox connect error/first-text latency. Check that
exhaustion bursts no longer multiply a single terminal incident; compare
headline transcript success across window/control.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Oct 2, 2026
Also brings two tests in line with intended changes already on main:
- test_rate_limiting pins the developer conversation-list cap that #13955
  unified at 200 (was 25 with transcripts / 100 without).
- test_selfheal_recovery expects the bounded structure_reason field that
  #20359 added to the selfheal_guard refusal event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants