Skip to content

feat(app): show and filter conversations with linked tasks - #24727

Merged
aryanorastar merged 22 commits into
mainfrom
codex/20620-conversation-task-filter
Nov 6, 2026
Merged

aryanorastar merged 22 commits into
mainfrom
codex/20620-conversation-task-filter

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Home conversation rows now show an accessible task badge, and Search → Has tasks browses the full server result set with query/date/folder/star filters. Both surfaces use the same current, undeleted canonical task links; completed and manually linked tasks count, while stale summary suggestions do not.

Closes #20620. Source-conversation task-row links remain the separate scope of #19859.

The membership join and candidate scans are bounded and read-only. Signed cursors bind the account and filters and support sparse pages. Only selected task-bearing results can receive existing paid-access recovery. The change adds no task writes, recording-content writes, backfill or Firestore indexes. Backend deployment must precede the mobile release.

Reuses the shared stale-HTTP-error guards and regressions from #24182 (e53adc5fd0, 6fc6816804), retaining current main's newer streaming behavior. Existing task/conversation notifications invalidate badges; old-account responses cannot repaint or expire a replacement session. The architecture, checklist, release order and local rerun commands are in backend/docs/conversation-task-filter.md.

Product invariants affected

  • INV-DATA-1: first-party data routing/auth authority is preserved; native QA is loopback-only with synthetic identity and an isolated Firestore emulator.
  • INV-UI-1 / INV-UI-3: shared conversation rows, accessible localized badges and existing search/date controls; Back preserves the original Home/search route.
  • INV-PERF-1: mounted-row reads are batched/bounded; failures cannot create rebuild/retry loops, and the production performance shell is regenerated.

How it was verified

  • Native iPhone 17 Pro / iOS 26.5 simulator: production widgets and API decoders → real loopback FastAPI routes → real Firestore emulator. Passed Home badge, matches beyond loaded Home rows, starred intersection, injected 503/retry, 403 cached-result hiding/recovery, canonical deletion refresh and Back position restoration. Final screenshots were visually reviewed.
  • 3 real Firestore/HTTP integration cases passed; 11 focused backend filter regressions and 16 API-surface contract tests passed. Public, app-client and integration schema checks pass; the two new routes remain first-party only.
  • 611 query/contract tests passed; a separate compatibility/rate-limit batch passed 149 with one existing skip. These batches overlap and are not a unique-test total.
  • 34 focused Flutter regressions passed, including real provider notification binding, unchanged-selection no-op, per-row badge updates, old-account responses and error paths, access-refusal redaction, malformed responses, empty continuation, failed retry, search/date compatibility, discarded visibility preference and Android large-text/semantics checks.
  • All 31 selected hermetic mobile journeys passed (make mobile-verify ARGS="fast --paths ...").
  • Shared HTTP ownership regressions passed with the earlier focused batch; implementation is unchanged since that run.

Authentication, Redis and external search-provider I/O in local integration are synthetic. The native host reuses production conversation rows and the production filter page; it is not the full authenticated Home shell. No physical Android TalkBack run, production deployment, store release or customer confirmation is claimed. Android semantics/large text are exercised in Flutter widget tests. All 69 selected local repository preflight checks and all 27 production-shell performance checks passed. Keep draft until required current-commit CI passes.

Main reconciliation

Verified locally at 7c4941ff329aca0f4a046e2b39249aea90c3af6d. Merged current main, preserved every existing locale entry and both task-filter translations, and regenerated Dart localizations for all 49 locales. The Home regression now asserts the combined • 10m label rendered by the row.

  • 30 focused Flutter tests passed, including the previously failing Home case, task-filter rendering and routing, presence invalidation and stale-session HTTP guards.
  • 27 backend tests passed through backend/test.sh across the task filter and OpenAPI contracts.
  • python3 scripts/l10n.py check passed. The previously recorded simulator and Firestore checks cover the same feature behavior.

All 69 local preflight checks and the normal push gates passed.

Tests

backend/tests/unit/test_conversation_task_filter.py, backend/tests/integration/test_conversation_tasks_emulator.py, executable Firestore query drivers, app/test/unit/conversation_task_presence_test.dart, app/test/unit/backend/http/conversation_tasks_api_test.dart, app/test/widgets/conversations_with_tasks_test.dart, and app/integration_test/conversation_tasks_e2e_test.dart cover the new core and recovery paths. The local QA server rejects non-loopback emulators/cloud projects and never uses customer data.

UI evidence

Production conversation rows in the synthetic QA Home host, then the production Has tasks page; both on the iOS 26.5 simulator with local emulator data.

Home task badge
Has tasks results

Failure class (fixes)

Failure-Class: FC-raw-page-limit-before-visibility-filter

Android CI toolchain

The reconciliation CI exposed a shared runner mismatch. The Android compile and JVM test jobs now set Java 21 before Flutter setup, matching the existing emulator job. Gradle 8.14.2 ran successfully with Java 21 in a local smoke probe. Actionlint, five infrastructure guard tests and the CI budget refresh passed.

CI follow-up source: 5503c2dcd8ab20c10bf3989d7077370b9e64d5f6. Product source and the tested reconciliation are unchanged by the workflow-only follow-up.

Account and pagination follow-up

Owner checks fence 401 refresh and replay across account switches. Task search advances through raw index pages while public search retains visible-result pagination. Task browse and search read candidates without restoring access until the result page is selected. The 120/hour task-presence cap remains effective under the production rate multiplier.

  • 34 focused Flutter tests passed on a78454f41c, including account switches during 401 refresh and replay, new-owner badge reads while an old request is pending, invalid cursor recovery, large page decoding on the background worker and the episode navigation test.
  • 148 focused backend unit tests passed with one existing skip.
  • Five production HTTP and Firestore emulator tests passed. Browse and search unlocked only returned task-bearing conversations. Search advanced past a page of hidden, stale and malformed hits and preserved the public response's privacy. The next page unlocked its own returned row.
  • The production widgets and loopback Firestore flow passed again on the dedicated iPhone 17 Pro / iOS 26.5 simulator at 241c23c540. Coverage includes the Home badge, global results, injected 503 and 403 responses, deletion refresh and return to the original Home position. The new backend regressions use synthetic auth, entitlement and search inputs.

Line-Count-Exception: backend/routers/conversations.py | 2539 -> 2574 | Share authoritative search hydration and exact-reference handling with task discovery. Keep public redaction and pagination separate from the read-only candidate path.

Five Firestore emulator tests passed again with synthetic auth. They cover the document cap across search hydration and retention of folder-curated conversations. All 57 affected backend unit and inventory tests passed.

@mintlify

mintlify Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 6, 2026, 8:11 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@Git-on-my-level

Copy link
Copy Markdown
Member

The engineering here is solid — clean, well-bounded, and honestly degradable; it needs green CI and a product sign-off, not a rework.

What I verified on this head:

  • backend/utils/conversations/task_filter.py: HMAC-signed cursors (compare_digest, 1h expiry, scope binds owner + all filters); budget exhaustion returns a signed partial page only when raw progress was proven, else a retryable 503 — no skipped or duplicated rows across sparse pages.
  • backend/database/conversation_task_links.py: presence reads only conversation_id/deleted from canonical action_items (≤100 IDs, 30-ID chunks, 15s version-keyed cache); locked/deleted/foreign parents disclose nothing. No migration, projection, or new index, as claimed.
  • backend/routers/conversation_tasks.py: 400 on bad cursor, 503 on budget/infra errors, redaction before return; with-tasks reuses the real search owner instead of a parallel path.
  • backend/models/conversation_tasks.py: strict id/date/limit validation.
  • Route policy + OpenAPI: both routes registered first-party and excluded from the Developer API contract, locked by a regression test in test_openapi_contract.py.
  • App side (conversation_task_presence_provider.dart, conversations_with_tasks_page.dart, conversation_list_item.dart, main.dart, global_search.dart): bounded batched badge reader that is account-fenced and treats failures as unknown; server-paged browse; typed decoders with no empty-success fallback.

Notes on material dimensions:

  • Performance: /v1/conversations/with-tasks/page is a server-side scan-and-filter — it walks 50-row raw pages until limit task-bearing rows are found, so sparse-task accounts can consume much of the read budget in one request and surface partial continuations or 503s. Bounded and honest; worth watching p95 after rollout. Presence is cheap (≤100 IDs, 15s cache, 120/hr limit).
  • Security: no task text crosses the wire — membership booleans only; cursors are signed and owner-bound; both routes are first-party-only.
  • Blast radius: app/lib/backend/http/shared.dart changes the shared HTTP transport for every API call (ensureCurrentOwner before 401 refresh/replay, beforeExpire on the deletion fence). The change looks correct and is well covered by the new fence tests in account_deletion_fence_test.dart, but it is a global behavior change riding in a feature PR — maintainers should eyeball that hunks specifically.
  • Agent-behavior docs: backend/docs/conversation-task-filter.md and the regenerated app-client OpenAPI will be ingested by AI coding agents working in this repo. I checked the doc's core claims against the code on this head (membership authority, cursor signing/expiry, first-party route exclusion) and they are accurate — the guidance is safe, no escalation needed on that front.

USER IMPACT: once released (backend first), conversations with linked tasks show a "Has linked tasks" badge on Home, and Search gains a "Has tasks" filter that browses all matching conversations with query/date/folder/star filters — not just the rows already loaded on Home.

Before this can progress: Dart Analyze & Tests and Mobile Release Eligibility are both red on this head — get them green, keep the backend-before-mobile deploy order, then mark ready for review. Source-row task links (#19859) correctly stay out of scope here.

This adds a new first-party API surface and a user-facing product surface for #20620 — leaving for human maintainer review on the product/API-contract direction rather than implementation correctness.

Feedback generated by AI on behalf of the maintainers.


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 the needs-maintainer-review Needs a human maintainer to sign off before merge label Nov 5, 2026
Preserve both sets of localization keys, regenerate Dart localizations and assert the combined Home duration label.
The hosted default Java 25 fails during Gradle 8.14.2 build-script analysis. Match the emulator job pin and protect the JVM and compile jobs with the existing infrastructure contract.
@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 09:03
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T12:30:29.480333Z 0c65cb6 Draft marked ready
ℹ️ 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.

@cubic-dev-ai cubic-dev-ai 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.

7 issues found across 140 files

Confidence score: 4/5

  • The search and emulator coverage is weaker than it looks: task_filter_qa_server.py does not send textual search through the real emulator, and test_conversation_task_filter.py uses a fake that ignores the query. Make the fixture filter on query and route the search path through the emulator.
  • test_conversation_tasks_emulator.py does not verify privacy for a task linked to a foreign conversation because the seed data never creates that link. Add a foreign-linked task to the test.
  • The new labels need a localization pass: app_fa.arb uses a different term for tasks than the rest of the Persian locale, and the standalone labels in app_fi.arb and app_ms.arb are awkward. Use the established Persian term and the suggested natural Finnish and Malay phrasing.
  • conversations_with_tasks_page.dart uses FilterChip instead of the shared OmiFilterChip, so the starred filter may not match the other search filters’ styling, semantics, or 44-point target. Use OmiFilterChip.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/lib/l10n/app_fa.arb">

<violation number="1" location="app/lib/l10n/app_fa.arb:12195">
P2: These labels translate the product’s task concept as `کار` (work/job), while the Persian locale consistently uses `وظیفه` for tasks. Use the established terminology so the badge and filter clearly refer to Omi tasks.</violation>
</file>

<file name="app/lib/l10n/app_fi.arb">

<violation number="1" location="app/lib/l10n/app_fi.arb:4639">
P3: `Tehtäviä sisältävät` is an incomplete standalone label because it omits the noun being modified. Replace it with the natural standalone phrase `Sisältää tehtäviä` (or include an explicit noun such as `Tehtäviä sisältävät keskustelut`).</violation>
</file>

<file name="backend/tests/unit/test_conversation_task_filter.py">

<violation number="1" location="backend/tests/unit/test_conversation_task_filter.py:51">
P2: This parameterization does not test query filtering: the fake search owner ignores `query` and returns identical rows for `''` and `'invoice'`, so a broken Search → Has tasks query can pass. Make the fixture/query assertion distinguish matching and non-matching rows, or add an integration case through the real search owner.</violation>
</file>

<file name="app/lib/l10n/app_ms.arb">

<violation number="1" location="app/lib/l10n/app_ms.arb:4638">
P3: The Malay badge label is grammatically awkward because `dipautkan` needs a relative clause marker here. Change it to `Mempunyai tugas yang dipautkan` so the accessible announcement reads naturally.</violation>
</file>

<file name="backend/tests/integration/test_conversation_tasks_emulator.py">

<violation number="1" location="backend/tests/integration/test_conversation_tasks_emulator.py:119">
P3: This regression does not actually exercise foreign-task privacy: `seed()` never links an action item to `foreign`, so the false result only covers a missing parent. Add a synthetic task row with `conversation_id='foreign'` and keep the expected presence false to catch disclosure regressions.</violation>
</file>

<file name="backend/testing/e2e/task_filter_qa_server.py">

<violation number="1" location="backend/testing/e2e/task_filter_qa_server.py:32">
P2: This harness does not use the real emulator for the textual-search path it claims to exercise: only the task-link module is redirected, while the reused search owner resolves Firestore through the globally patched client and reads the empty in-memory fake. Inject the captured emulator client into the shared database client seam, or avoid patching Firestore construction for this fixture, before importing the production routes.</violation>
</file>

<file name="app/lib/pages/conversations/conversations_with_tasks_page.dart">

<violation number="1" location="app/lib/pages/conversations/conversations_with_tasks_page.dart:246">
P3: The new starred filter uses Material `FilterChip` instead of the shared `OmiFilterChip`. Replace it with `OmiFilterChip` so selected styling, semantics, and the 44-point target stay consistent with the other search filters.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/utils/rate_limit_config.py Resolved
Comment thread app/lib/backend/http/shared.dart Resolved
Comment thread app/lib/l10n/app_fa.arb
Comment on lines +12195 to +12196
"hasLinkedTasksLabel": "دارای کارهای مرتبط",
"hasTasksFilter": "دارای کار",

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: These labels translate the product’s task concept as کار (work/job), while the Persian locale consistently uses وظیفه for tasks. Use the established terminology so the badge and filter clearly refer to Omi tasks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/l10n/app_fa.arb, line 12195:

<comment>These labels translate the product’s task concept as `کار` (work/job), while the Persian locale consistently uses `وظیفه` for tasks. Use the established terminology so the badge and filter clearly refer to Omi tasks.</comment>

<file context>
@@ -12192,6 +12192,8 @@
     "referralClaimShort": "دریافت",
     "paymentDeclinedTitle": "کارت شما رد شد",
     "paymentDeclinedMessage": "برای بازگرداندن {plan} کارت را به‌روزرسانی کنید",
+    "hasLinkedTasksLabel": "دارای کارهای مرتبط",
+    "hasTasksFilter": "دارای کار",
     "firmwareUpdateNotInstalledMessage": "The update didn't install. Your pendant is still on {version}. Please try again.",
</file context>
Suggested change
"hasLinkedTasksLabel": "دارای کارهای مرتبط",
"hasTasksFilter": "دارای کار",
"hasLinkedTasksLabel": "دارای وظایف مرتبط",
"hasTasksFilter": "دارای وظایف",

Comment thread app/lib/l10n/app_fi.arb
"paymentDeclinedTitle": "Korttisi hylättiin",
"paymentDeclinedMessage": "Päivitä kortti saadaksesi {plan} takaisin",
"hasLinkedTasksLabel": "Sisältää liitettyjä tehtäviä",
"hasTasksFilter": "Tehtäviä sisältävät",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Tehtäviä sisältävät is an incomplete standalone label because it omits the noun being modified. Replace it with the natural standalone phrase Sisältää tehtäviä (or include an explicit noun such as Tehtäviä sisältävät keskustelut).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/l10n/app_fi.arb, line 4639:

<comment>`Tehtäviä sisältävät` is an incomplete standalone label because it omits the noun being modified. Replace it with the natural standalone phrase `Sisältää tehtäviä` (or include an explicit noun such as `Tehtäviä sisältävät keskustelut`).</comment>

<file context>
@@ -4635,6 +4635,8 @@
     "paymentDeclinedTitle": "Korttisi hylättiin",
     "paymentDeclinedMessage": "Päivitä kortti saadaksesi {plan} takaisin",
+    "hasLinkedTasksLabel": "Sisältää liitettyjä tehtäviä",
+    "hasTasksFilter": "Tehtäviä sisältävät",
     "firmwareUpdateNotInstalledMessage": "The update didn't install. Your pendant is still on {version}. Please try again.",
     "firmwareUpdateUnconfirmedMessage": "Couldn't confirm the update. Your pendant hasn't reconnected yet. Keep it nearby and check its firmware version before trying again.",
</file context>
Suggested change
"hasTasksFilter": "Tehtäviä sisältävät",
"hasTasksFilter": "Sisältää tehtäviä",

Comment thread app/lib/l10n/app_ms.arb
"referralClaimShort": "Tuntut",
"paymentDeclinedTitle": "Kad anda ditolak",
"paymentDeclinedMessage": "Kemas kini kad untuk mendapatkan semula {plan}",
"hasLinkedTasksLabel": "Mempunyai tugas dipautkan",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The Malay badge label is grammatically awkward because dipautkan needs a relative clause marker here. Change it to Mempunyai tugas yang dipautkan so the accessible announcement reads naturally.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/l10n/app_ms.arb, line 4638:

<comment>The Malay badge label is grammatically awkward because `dipautkan` needs a relative clause marker here. Change it to `Mempunyai tugas yang dipautkan` so the accessible announcement reads naturally.</comment>

<file context>
@@ -4635,6 +4635,8 @@
     "referralClaimShort": "Tuntut",
     "paymentDeclinedTitle": "Kad anda ditolak",
     "paymentDeclinedMessage": "Kemas kini kad untuk mendapatkan semula {plan}",
+    "hasLinkedTasksLabel": "Mempunyai tugas dipautkan",
+    "hasTasksFilter": "Dengan tugas",
     "firmwareUpdateNotInstalledMessage": "The update didn't install. Your pendant is still on {version}. Please try again.",
</file context>
Suggested change
"hasLinkedTasksLabel": "Mempunyai tugas dipautkan",
"hasLinkedTasksLabel": "Mempunyai tugas yang dipautkan",

def test_real_membership_follows_delete_relink_lock_and_duplicate_task_rows(store):
client, uid = store
user = seed(client, uid)
ids = ['c000', 'c001', 'c054', 'c055', 'c104', 'foreign']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This regression does not actually exercise foreign-task privacy: seed() never links an action item to foreign, so the false result only covers a missing parent. Add a synthetic task row with conversation_id='foreign' and keep the expected presence false to catch disclosure regressions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/integration/test_conversation_tasks_emulator.py, line 119:

<comment>This regression does not actually exercise foreign-task privacy: `seed()` never links an action item to `foreign`, so the false result only covers a missing parent. Add a synthetic task row with `conversation_id='foreign'` and keep the expected presence false to catch disclosure regressions.</comment>

<file context>
@@ -0,0 +1,167 @@
+def test_real_membership_follows_delete_relink_lock_and_duplicate_task_rows(store):
+    client, uid = store
+    user = seed(client, uid)
+    ids = ['c000', 'c001', 'c054', 'c055', 'c104', 'foreign']
+
+    def read():
</file context>

runSpacing: OmiSpacing.xs,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
FilterChip(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new starred filter uses Material FilterChip instead of the shared OmiFilterChip. Replace it with OmiFilterChip so selected styling, semantics, and the 44-point target stay consistent with the other search filters.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/pages/conversations/conversations_with_tasks_page.dart, line 246:

<comment>The new starred filter uses Material `FilterChip` instead of the shared `OmiFilterChip`. Replace it with `OmiFilterChip` so selected styling, semantics, and the 44-point target stay consistent with the other search filters.</comment>

<file context>
@@ -0,0 +1,328 @@
+                  runSpacing: OmiSpacing.xs,
+                  crossAxisAlignment: WrapCrossAlignment.center,
+                  children: [
+                    FilterChip(
+                        key: const ValueKey('tasks_filter_starred'),
+                        label: Text(l10n.starred),
</file context>
Suggested change
FilterChip(
OmiFilterChip(

@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 09:13

@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: 5503c2dcd8

ℹ️ 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 +68 to +73
Object _taskInputs(ActionItemsProvider source) => (
source.apiViewState,
source.actionItems.length,
source.isLoading,
source.isFetching,
);

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 Invalidate presence after a task delete commits

When a user deletes a task through the app’s undo flow, stageDeleteActionItem removes it and notifies immediately, so this key invalidates before the backend deletion. The ensuing refresh can still find the canonical task; commitStagedDelete does not notify on success, and this key has no acknowledged-write revision to trigger another refresh. The stale positive presence can therefore keep the conversation’s Home badge and Has Tasks result visible until an unrelated refresh. Invalidate on the acknowledged task mutation, including staged-delete commit.

Useful? React with 👍 / 👎.

Failure-Class: FC-raw-page-limit-before-visibility-filter
…lid cursors

Failure-Class: FC-raw-page-limit-before-visibility-filter
Failure-Class: FC-raw-page-limit-before-visibility-filter
@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 11:10

@cubic-dev-ai cubic-dev-ai 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.

8 issues found across 145 files

Confidence score: 3/5

  • conversations.py can drop transcript-only task matches after the first 100 results. Paginate transcript hits or return a clear continuation.
  • refreshAndReplayAfter401 can return a stale replay response after the owner guard is revoked. Restore the sessionChanged() check after replay.
  • conversations_with_tasks_page.dart ignores data.partial, so users can mistake budget-truncated results for a complete set. Show the partial-result notice and retry option.
  • conversation_task_presence_provider.dart can keep a stale task badge when a conversation is replaced in place. Track a content/version fingerprint or invalidate on every conversation update.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/test/widgets/conversations_with_tasks_test.dart">

<violation number="1" location="app/test/widgets/conversations_with_tasks_test.dart:113">
P2: This server-side filter test does not cover folder or date filters. Capture those arguments and exercise the corresponding controls so regressions in those advertised filters fail the test.</violation>
</file>

<file name="backend/tests/integration/test_conversation_tasks_emulator.py">

<violation number="1" location="backend/tests/integration/test_conversation_tasks_emulator.py:27">
P2: This emulator proof cannot run with the documented synthetic setup because the integration package's autouse Firebase fixture requires unrelated Application Default Credentials before `store` runs. Remove that credential requirement for this emulator test (or isolate it from the credentialed integration conftest) so AnonymousCredentials and the local emulator are sufficient.</violation>
</file>

<file name="app/lib/pages/conversations/conversations_with_tasks_page.dart">

<violation number="1" location="app/lib/pages/conversations/conversations_with_tasks_page.dart:161">
P2: `data.partial` is ignored, so budget-truncated pages look like ordinary pages. Preserve this flag and render the existing partial-result notice/retry alongside the continuation so users know the result set is incomplete.</violation>
</file>

<file name="backend/routers/conversation_tasks.py">

<violation number="1" location="backend/routers/conversation_tasks.py:14">
P3: This router imports another router to reuse an internal helper, violating the backend import hierarchy and coupling task-route startup to the full conversations router graph. Move candidate discovery into a shared `utils` or `database` module and have both routers depend on it.</violation>
</file>

<file name="backend/routers/conversations.py">

<violation number="1" location="backend/routers/conversations.py:2404">
P2: Task search drops transcript-only matches after the first 100 because this candidate response preserves Typesense pagination, which does not account for transcript-index results. Paginate transcript hits or return a continuation whenever the transcript search is capped.</violation>
</file>

<file name="app/lib/providers/conversation_task_presence_provider.dart">

<violation number="1" location="app/lib/providers/conversation_task_presence_provider.dart:67">
P2: This identity-and-length key misses in-place conversation replacements, allowing a stale task badge to survive a relevant conversation refresh. Track a content/version fingerprint or invalidate on every conversation update that can affect the badge.</violation>
</file>

<file name="app/lib/backend/http/shared.dart">

<violation number="1" location="app/lib/backend/http/shared.dart:594">
P2: `refreshAndReplayAfter401` no longer checks `canSend` after `await replay()`, so stale replay responses can reach callers after the owner guard is revoked. Restore the post-replay `sessionChanged()` check before classifying or returning the replay response.

(Based on your team's feedback about owner-scope fencing after awaits.) .</violation>
</file>

<file name="backend/docs/conversation-task-filter.md">

<violation number="1" location="backend/docs/conversation-task-filter.md:30">
P3: This presents the 120/hour exemption as unconditional, but `RATE_LIMIT_BOOST_EXEMPT` can intentionally remove it and multiply the limit. Document it as the default exemption, or state the override caveat so operators do not rely on a guarantee the configuration does not enforce.</violation>
</file>

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Turn on auto-fix | Re-trigger cubic

DateTime? endDate,
String? cursor,
bool Function()? canSend}) {
requests.add((query, starred, includeDiscarded));

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: This server-side filter test does not cover folder or date filters. Capture those arguments and exercise the corresponding controls so regressions in those advertised filters fail the test.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/test/widgets/conversations_with_tasks_test.dart, line 113:

<comment>This server-side filter test does not cover folder or date filters. Capture those arguments and exercise the corresponding controls so regressions in those advertised filters fail the test.</comment>

<file context>
@@ -0,0 +1,287 @@
+        DateTime? endDate,
+        String? cursor,
+        bool Function()? canSend}) {
+      requests.add((query, starred, includeDiscarded));
+      final result = Completer<ApiResult<TaskConversationPage>>();
+      pending.add(result);
</file context>



@pytest.fixture
def store(monkeypatch):

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: This emulator proof cannot run with the documented synthetic setup because the integration package's autouse Firebase fixture requires unrelated Application Default Credentials before store runs. Remove that credential requirement for this emulator test (or isolate it from the credentialed integration conftest) so AnonymousCredentials and the local emulator are sufficient.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/integration/test_conversation_tasks_emulator.py, line 27:

<comment>This emulator proof cannot run with the documented synthetic setup because the integration package's autouse Firebase fixture requires unrelated Application Default Credentials before `store` runs. Remove that credential requirement for this emulator test (or isolate it from the credentialed integration conftest) so AnonymousCredentials and the local emulator are sufficient.</comment>

<file context>
@@ -0,0 +1,248 @@
+
+
[email protected]
+def store(monkeypatch):
+    host = os.getenv('FIRESTORE_EMULATOR_HOST', '')
+    if not host:
</file context>

byId[row.id] = row;
}
_rows = byId.values.toList();
_cursor = data.nextCursor;

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: data.partial is ignored, so budget-truncated pages look like ordinary pages. Preserve this flag and render the existing partial-result notice/retry alongside the continuation so users know the result set is incomplete.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/pages/conversations/conversations_with_tasks_page.dart, line 161:

<comment>`data.partial` is ignored, so budget-truncated pages look like ordinary pages. Preserve this flag and render the existing partial-result notice/retry alongside the continuation so users know the result set is incomplete.</comment>

<file context>
@@ -0,0 +1,335 @@
+              byId[row.id] = row;
+            }
+            _rows = byId.values.toList();
+            _cursor = data.nextCursor;
+          });
+        case ApiFailure(:final problem):
</file context>

void _conversationChanged() {
final conversations = _conversations!;
final key = conversations._taskPresenceInputs;
if (key == _conversationKey) return;

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: This identity-and-length key misses in-place conversation replacements, allowing a stale task badge to survive a relevant conversation refresh. Track a content/version fingerprint or invalidate on every conversation update that can affect the badge.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/providers/conversation_task_presence_provider.dart, line 67:

<comment>This identity-and-length key misses in-place conversation replacements, allowing a stale task badge to survive a relevant conversation refresh. Track a content/version fingerprint or invalidate on every conversation update that can affect the badge.</comment>

<file context>
@@ -0,0 +1,176 @@
+  void _conversationChanged() {
+    final conversations = _conversations!;
+    final key = conversations._taskPresenceInputs;
+    if (key == _conversationKey) return;
+    _conversationKey = key;
+    invalidate();
</file context>

rethrow;
}
if (sessionChanged()) {
if (snapshotChanged()) {

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: refreshAndReplayAfter401 no longer checks canSend after await replay(), so stale replay responses can reach callers after the owner guard is revoked. Restore the post-replay sessionChanged() check before classifying or returning the replay response.

(Based on your team's feedback about owner-scope fencing after awaits.) .

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/backend/http/shared.dart, line 594:

<comment>`refreshAndReplayAfter401` no longer checks `canSend` after `await replay()`, so stale replay responses can reach callers after the owner guard is revoked. Restore the post-replay `sessionChanged()` check before classifying or returning the replay response.

(Based on your team's feedback about owner-scope fencing after awaits.) .</comment>

<file context>
@@ -577,7 +591,7 @@ Future<T> refreshAndReplayAfter401<T>({
         rethrow;
       }
-      if (sessionChanged()) {
+      if (snapshotChanged()) {
         service.recordAuthenticatedRequest401(recovered: false, outcome: 'session_changed');
         await (disposeStaleResponse ?? disposeUnauthorizedResponse)?.call(replayed);
</file context>
Suggested change
if (snapshotChanged()) {
if (sessionChanged()) {

Comment thread backend/routers/conversation_tasks.py Resolved
TaskConversationPageRequest,
TaskConversationPageResponse,
)
from routers.conversations import search_task_conversation_candidates

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This router imports another router to reuse an internal helper, violating the backend import hierarchy and coupling task-route startup to the full conversations router graph. Move candidate discovery into a shared utils or database module and have both routers depend on it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/routers/conversation_tasks.py, line 14:

<comment>This router imports another router to reuse an internal helper, violating the backend import hierarchy and coupling task-route startup to the full conversations router graph. Move candidate discovery into a shared `utils` or `database` module and have both routers depend on it.</comment>

<file context>
@@ -0,0 +1,104 @@
+    TaskConversationPageRequest,
+    TaskConversationPageResponse,
+)
+from routers.conversations import search_task_conversation_candidates
+from utils.conversations import paid_lock_recovery, transcribing_hold
+from utils.conversations.render import redact_conversations_for_list
</file context>

Sparse scans may return an empty intermediate page **with continuation**, which
the UI never labels “No results”. A budget failure without progress is retryable.
The presence read uses existing task version invalidation and a 15-second cache.
Its 120/hour limit is exempt from the global rate-limit multiplier.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This presents the 120/hour exemption as unconditional, but RATE_LIMIT_BOOST_EXEMPT can intentionally remove it and multiply the limit. Document it as the default exemption, or state the override caveat so operators do not rely on a guarantee the configuration does not enforce.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/conversation-task-filter.md, line 30:

<comment>This presents the 120/hour exemption as unconditional, but `RATE_LIMIT_BOOST_EXEMPT` can intentionally remove it and multiply the limit. Document it as the default exemption, or state the override caveat so operators do not rely on a guarantee the configuration does not enforce.</comment>

<file context>
@@ -0,0 +1,109 @@
+Sparse scans may return an empty intermediate page **with continuation**, which
+the UI never labels “No results”. A budget failure without progress is retryable.
+The presence read uses existing task version invalidation and a 15-second cache.
+Its 120/hour limit is exempt from the global rate-limit multiplier.
+No new composite-index deployment is required; runtime query guards verify this.
+
</file context>
Suggested change
Its 120/hour limit is exempt from the global rate-limit multiplier.
By default, its 120/hour limit is exempt from the global rate-limit multiplier; `RATE_LIMIT_BOOST_EXEMPT` can override that exemption.

@aryanorastar
aryanorastar marked this pull request as draft November 6, 2026 11:20
Failure-Class: FC-raw-page-limit-before-visibility-filter

@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: 94ee6f3e59

ℹ️ 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".

)

async def search(page):
return await search_task_conversation_candidates(

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 Forward the list budget into keyword-search hydration

When a non-empty query has sparse task matches, this callback can advance through many search pages, but their Firestore conversation snapshots are hydrated without the route’s ListReadBudget. Those reads are never charged, so the scan can exceed OMI_LIST_READ_MAX_DOCUMENTS while returning a supposedly budgeted partial page. Forward the budget into the candidate-search hydration path.

Useful? React with 👍 / 👎.

@aryanorastar
aryanorastar marked this pull request as ready for review November 6, 2026 12:11

@cubic-dev-ai cubic-dev-ai 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.

1 existing issue remains and 2 new issues found across 145 files

Confidence score: 3/5

  • conversations.py can return the same conversation twice when a transcript hit appears on a later Typesense page. Deduplicate candidate IDs across pages.
  • conversation_tasks.py may not return the refreshable 400 response for stale or malformed task cursors. Normalize browse-position ValueError to TaskFilterCursorError before the route boundary.
  • conversation_tasks now depends on search orchestration in conversations, coupling the routers. Move the shared helper into a service or utility module.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/routers/conversation_tasks.py">

<violation number="1" location="backend/routers/conversation_tasks.py:91">
P2: Normalize browse-position `ValueError` into `TaskFilterCursorError` before this route boundary so stale or malformed task cursors consistently return the refreshable 400 response.</violation>
</file>

<file name="backend/routers/conversations.py">

<violation number="1" location="backend/routers/conversations.py:2285">
P2: The task-filter search can return the same conversation twice when a transcript hit also appears on a later Typesense page. Deduplicate candidate IDs across raw pages, or use a cursor/search source that guarantees disjoint pages, before applying task membership pagination.</violation>
</file>

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Turn on auto-fix | Re-trigger cubic

can_recover_locked=recovery.can_recover,
)
await run_blocking(db_executor, recovery.heal, result['items'])
except TaskFilterCursorError as error:

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: Normalize browse-position ValueError into TaskFilterCursorError before this route boundary so stale or malformed task cursors consistently return the refreshable 400 response.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/routers/conversation_tasks.py, line 91:

<comment>Normalize browse-position `ValueError` into `TaskFilterCursorError` before this route boundary so stale or malformed task cursors consistently return the refreshable 400 response.</comment>

<file context>
@@ -0,0 +1,105 @@
+            can_recover_locked=recovery.can_recover,
+        )
+        await run_blocking(db_executor, recovery.heal, result['items'])
+    except TaskFilterCursorError as error:
+        raise HTTPException(status_code=400, detail='Invalid task-filter cursor. Refresh this list.') from error
+    except (
</file context>

search_request: SearchRequest, uid: str, *, budget: ListReadBudget
) -> Dict[str, Any]:
"""Internal task discovery, with raw pagination and no access writes."""
return await _search_conversation_page(search_request, uid, None, None, candidate_budget=budget)

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: The task-filter search can return the same conversation twice when a transcript hit also appears on a later Typesense page. Deduplicate candidate IDs across raw pages, or use a cursor/search source that guarantees disjoint pages, before applying task membership pagination.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/routers/conversations.py, line 2285:

<comment>The task-filter search can return the same conversation twice when a transcript hit also appears on a later Typesense page. Deduplicate candidate IDs across raw pages, or use a cursor/search source that guarantees disjoint pages, before applying task membership pagination.</comment>

<file context>
@@ -2268,6 +2275,25 @@ async def search_conversations_endpoint(
+    search_request: SearchRequest, uid: str, *, budget: ListReadBudget
+) -> Dict[str, Any]:
+    """Internal task discovery, with raw pagination and no access writes."""
+    return await _search_conversation_page(search_request, uid, None, None, candidate_budget=budget)
+
+
</file context>

@aryanorastar
aryanorastar merged commit 56a9291 into main Nov 6, 2026
66 checks passed
@aryanorastar
aryanorastar deleted the codex/20620-conversation-task-filter branch November 6, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(android): show and filter conversations that produced tasks

2 participants