Skip to content

fix(home): older conversations load reliably on v3 Home; hidden runs are scanned, not downloaded - #26193

Merged
Git-on-my-level merged 7 commits into
mainfrom
lane/home-scroll
Nov 24, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
lane/home-scroll

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

What changed and why

On a v3 account, scrolling to the bottom of Home is slow and sometimes never loads older conversations. Two causes, both fixed here.

Measured (2026-11-24 02:47Z, one consenting v3 owner, read-only, counts only): of the newest 4,000 rows the Home query matches, 3,016 are hidden (1,199 raw recordings, 1,817 home_hidden windows). The first 50 visible rows span 1,487 storage rows; the next 50 span 962. Production request logs (10% sample): first page p50 2.7 s / p90 11.5 s, cursor pages p50 2.3 s / p90 11.5 s.

App: paging survives refreshes

  • A newest-page read (fetchConversations, _fetchNewConversations) under the same filters now waits for an older page in flight to settle (bounded at 35 s, past the server's 30 s cutoff). Before, it bumped the fetch revision and the older page was dropped when it returned.
  • A full fetch keeps a deeper paging position. Before, it reset the cursor to the end of page one while the older rows stayed on screen, so the next load-more re-read pages the reader already had. A filter change still restarts from its own first page.
  • After a page lands with the reader still within two viewports of the end, Home asks for the next page, up to four in a row per scroll. A page shortened by hidden rows no longer waits for another scroll.
  • The 15 s v3 re-read only runs for a row that went to transcribing or writing within the last hour (David's ruling, 2026-11-24). An older stuck row updates on pull-to-refresh and on reopen.
  • That re-read, and the two capture-event re-reads, now ask only for recent rows (start_date = the earliest recent pending row, at most a day back) through the new refreshRecentConversations. They no longer read the whole newest page or touch the paging position.

Backend: a hidden run is scanned, not downloaded

  • _PageFill refills (which only happen once a page met hidden rows) now stream four fields per row (created_at, recording, home_hidden, deleted). Only rows that pass that first look are read in full and put through the complete visibility predicate.
  • The first look can only say hidden for a row the full predicate also hides. Everything else is judged by the full predicate as before.
  • Billed reads: one per scanned row as before, plus one per refill row the first look cannot hide (rows returned, and the few the full predicate then hides). An owner with no hidden rows pays nothing extra (no refill, tested).
  • Refills go lean only when the three flags explain at least half of what the page's first window hid. A run hidden for reasons only the full predicate sees (pending bridges, dream duplicates) keeps full-document refills, so it never pays a second read per row.
  • A budget cut mid-refill rewinds to before the first candidate not yet read in full, so no visible row is skipped.
  • The 512 hidden-row cap, headers, cursor and offset semantics are unchanged. Released apps need nothing new.
  • Kill switch: OMI_LIST_LEAN_SKIP_ENABLED=false restores full-document refills. On by default.

Backend: read meter

GET /v1/conversations logs one line per request: documents read, storage rows consumed, hidden rows skipped, rows returned, read and total milliseconds. No owner id, no query. The existing list_read_* counters report zero for the serving backend, so this is the first production reading of reads per Home page.

Carried from #26188

main fails the feature-flag registry check as of 2026-11-24 (the OMI_INDEXED_LIST_READS_ENABLED row passed its grace). #26188 (SCA-3682) fixes that and is merged into this branch so its checks can run. The four flag-row changes and the matching registry doc rows in this diff are that PR's, unchanged; they leave this diff once #26188 lands on main. This PR's own registry change is the one new row, OMI_LIST_LEAN_SKIP_ENABLED.

Not in this PR

  • Reads per page stay about the same on a v3 account. Excluding hidden rows in the query needs a new stored field, an index and a backfill; that follows separately.
  • OMI_INDEXED_LIST_READS_ENABLED is unset in production, so visible rows are still read with their transcripts.

Product invariants affected

none

How it was verified

  • backend/.venv/bin/python -m pytest tests/unit/test_home_hidden_run_pagination.py tests/unit/test_fsr_wq4_cursor.py: 59 passed.
  • flutter test test/providers/conversation_home_paging_refresh_test.dart test/pages/conversations/home_v3_test.dart: 39 passed.
  • Read-only on real Firestore against one consenting v3 owner: old and new page reads returned the same rows, order and storage advance for pages 1 and 2 (531 vs 547 documents read on page 1).
  • Not verified on a device or against production. The production proof is the read meter line after deploy, and Home scroll on the TestFlight build.

Tests

  • backend/tests/unit/test_home_hidden_run_pagination.py: lean scan counts, no extra read without hidden rows, projection carries only visibility fields, a row only the full predicate hides, budget cut mid-refill, kill switch, cursor walk.
  • app/test/providers/conversation_home_paging_refresh_test.dart: deeper position kept across a full fetch, filter change restarts, refresh waits for an older page, bounded refresh window and removal, one-hour rule.

UI evidence

UI-Evidence: none -- no visual change; paging and refresh behaviour only

Line-count exceptions

Line-Count-Exception: app/lib/pages/conversations/conversations_page.dart | 1572 -> 1614 | the recent-rows re-read replaces three call sites that live in this page's v3 frame logic; splitting it is a separate refactor
Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2432 -> 2510 | paging-position state sits beside the fetch and load-more methods that own it; moving them is a separate refactor
Line-Count-Exception: backend/database/conversations.py | 5369 -> 5504 | the lean refill is a method of the existing page fill and shares its position accounting
Line-Count-Exception: backend/routers/conversations.py | 3085 -> 3103 | the read meter line belongs in the list route it measures

Failure class (fixes)

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 4 commits November 24, 2026 10:08
…are scanned, not downloaded

App: a newest-page read waits for an older page in flight instead of
discarding it, a full fetch keeps a deeper paging position, Home asks for
the next page when one lands short, and the v3 periodic and capture-event
re-reads ask only for recent rows (one-hour rule for pending rows).

Backend: page refills through a hidden run stream four visibility fields
per row and read in full only rows that may be visible. Kill switch
OMI_LIST_LEAN_SKIP_ENABLED. GET /v1/conversations logs a per-request read
meter line (counts and timings only).

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T04:46:13.173829Z e7c80fe New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c917849dbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1113 to +1116
if (_conversationPagedDeeper && _conversationPagingKey == pagingKey) {
// Same filters, older pages already loaded and still on screen: keep the deeper position.
// Restarting at page two would re-read every page the reader already has before any new row.
_recordServerPageIds(result.items, result.storageCount);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Verify continuity before retaining the deeper paging position

If more than one page of new conversations arrives after the user has paged deeper, the refreshed first page no longer overlaps the previously loaded rows. Retaining the old cursor skips the intervening new conversations; if the user previously reached the end, retaining _conversationServerHasMore == false prevents any further paging at all. For example, after loading all 120 existing rows, receiving 60 newer rows and refreshing displays only the newest 50 plus the old 120, leaving 10 unreachable through scrolling or subsequent refreshes. Preserve the deeper position only after establishing continuity with the loaded range, or fetch the intervening pages before resuming it.

Useful? React with 👍 / 👎.

Comment on lines +431 to +435
return provider.refreshRecentConversations(ConversationsV3Provider.recentRefreshSince([
...touched,
for (final row in ConversationsV3Provider.recentlyMidPipeline(provider.conversations, now)) row.createdAt,
for (final row in provider.processingConversations) row.createdAt,
], now));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the manually finished live window in the refresh bound

When End is accepted for a live conversation created more than an hour ago, its derived successor can appear after the one-off full refresh in ProviderCaptureExternalActions.onManualFinishSettled. Once the recording leaves processingConversations, these periodic refreshes have no timestamp for that window and start only an hour back, excluding the successor. Manual finish also hides v3.live, and _afterV3Frame suppresses the closed-live refresh while finishRow exists, so neither path supplies the missing timestamp. The accepted finish cancels its expiry and waits for finishHasSuccessor, leaving the processing placeholder indefinitely until a manual refresh. Retain the finished live window's creation time and include it in the bound while awaiting its successor.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui c917849dbdb6d665cf356b0fa8815219b1947b20. A later head keeps the approval only when it adds commits on top with no UI changes; a UI change, rebase or force-push needs a fresh one. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

Git-on-my-level and others added 2 commits November 24, 2026 10:43
…atic page loads

A newest-page read now waits past the server's request cutoff for an
older page in flight (review F1). Follow-up pages asked for without a new
scroll stop at four (F4). Test for the filter fallback (F7); wording (F6, F8).

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

/approve-ui a095939

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a095939e81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

snapshots = {
snapshot.id: snapshot
for snapshot in budgeted_get_all(
db, [doc.reference for doc in pending], self.budget, field_paths=self.scout.hydrate_fields

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use the prescribed Firestore client seam for hydration

Whenever a hidden run triggers lean hydration, this new helper reads through the module-global db proxy. backend/AGENTS.md explicitly prohibits using that legacy proxy in new code and requires call-time get_firestore_client() resolution with an optional keyword-only firestore_client injection seam. Resolve and pass the client through the page-fill helpers so hydration can use an injected client without replacing module-global state.

AGENTS.md reference: backend/AGENTS.md:L180-L180

Useful? React with 👍 / 👎.

await fetchConversations();
return;
}
await _fetchNewConversations(restoreMergeWatches: false, since: since);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Publish recent-row completions to the Siri index

On iOS with Siri indexing enabled, a v3 conversation that completes during Home's periodic refresh now updates the displayed list without updating Spotlight/Siri. Previously, the watcher called fetchConversations(), which publishes accepted rows through queueReconcileConversations or queueUpsertConversations; _fetchNewConversations() and its reconciliation helpers do neither. Consequently, a completion discovered only by polling remains absent or stale in the native index until a separate full-list or owner-wide refresh. Publish accepted recent rows to Siri as well, using additive upserts or a reconciliation bounded to the actual covered window.

Useful? React with 👍 / 👎.

…; meter tolerates budget fakes

A run hidden for reasons only the full predicate sees made every scouted
row a candidate and paid a second read for each (CI: pending-bridge read
budget test). Refills now go lean only when the scout's flags explain at
least half of what the first window hid. The read meter reads the
document count defensively (CI: retired list projection test).

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

/approve-ui e7c80fe

@Git-on-my-level
Git-on-my-level merged commit 1c0f059 into main Nov 24, 2026
72 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/home-scroll branch November 24, 2026 05:14
Git-on-my-level added a commit that referenced this pull request Nov 24, 2026
…nges (#26201)

Multica: SCA-4136.

## What changed and why

When `backend/utils/other/list_budget.py` changes, put the
pending-bridge and retired-list regressions first in the focused
pre-push list. The existing import graph already selects both for CI.
The exact #26193 backend diff has more than 40 focused candidates, so
the mapping also gives these two tests priority within the cap.

## Product invariants affected

none

## How it was verified

- Ran the selector CLI with `--changed-files` and `--focused-output` for
the budget path alone and the full backend changed-file list from #26193
(`git diff --name-only 1c0f059^1 1c0f059 -- backend/`). Both
regressions were missing from pre-push before the fix and now occupy its
first two slots. The budget-only focused list has 16 files. CI's output
was identical before and after for both inputs.
- Ran the selector and import-graph suites plus both affected regression
files with the locked backend environment. All 54 tests passed.
- Ran `bash scripts/test-pre-push-backend-test-cap.sh`. The hook cap
tests passed.
- Ran `make preflight` with this PR body. All 38 checks passed.

## Tests

`test_list_budget_regressions_run_under_pre_push_cap` checks CI
selection and the first 40 focused entries for both inputs. Both cases
reproduced the local miss before the fix.

UI-Evidence: none -- selector tooling

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26201?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26201?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26201&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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