Repository navigation
Perf: smooth the cold-start warm-up window (init ordering, quiet wiring, demand-mounted tabs) - #21364
Git-on-my-level wants to merge 19 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| unawaited(_initializeSupportIdentity(isSignedIn, SharedPreferencesUtil().uid)); | ||
| } | ||
|
|
||
| Future<void> _initializeSupportIdentity(bool isSignedIn, String uid) async { | ||
| final intercom = PlatformManager.instance.intercom; | ||
| try { | ||
| if (isSignedIn) { | ||
| await intercom.loginIdentifiedUser(uid); |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
Support identity login is now unawaited(_initializeSupportIdentity(...)), so loginIdentifiedUser(uid) can finish after the user signs out or another account signs in. The new SharedPreferencesUtil().uid != uid check only skips setUserAttributes(); it does not undo the Intercom session that the SDK call already mutated. Sign-out still does not log out of Intercom, and onboarding later fire-and-forgets loginIdentifiedUser for the successor. A delayed startup login for user A can complete last and leave Help Center identified as A while the app session is B.
Impact: On a shared device, the successor user can see the previous account's Intercom identity and support history, and their Help Center traffic can attach to the wrong person.
Reviewed by Cursor Security Reviewer for commit d799aad. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d799aad7c3
ℹ️ 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".
d799aad to
285a97c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 285a97cba2
ℹ️ 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".
285a97c to
897d57e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 897d57ebcc
ℹ️ 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".
897d57e to
1b96492
Compare
|
Round-3 review fixes pushed (
Verification: 30 focused tests across 10 suites green (incl. 4 new regressions), |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b964925d1
ℹ️ 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".
1b96492 to
042dadc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 042dadc5d7
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9112f49e09
ℹ️ 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".
|
Acknowledging the widget-freshness thread without a code change in this PR: the observation is correct — after the Tasks screen loads once, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7790d67906
ℹ️ 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".
7790d67 to
176117d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 176117dfbd
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09fa07d62b
ℹ️ 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".
|
Monitor run — round-4 review fixes pushed (
Local verification: |
09fa07d to
dfdd3a8
Compare
|
Monitor run — round-5 review fix pushed (
Re-scan after push: no new review threads; CI re-running on the new head. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfdd3a8f02
ℹ️ 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".
…e demand load Address review races in the demand-mounted Tasks workstream: - fetchActionItems: guard the typed projection, loading-flag retirement and final notify by session generation, so a fetch that started before sign-out cannot project error/locked state onto the next account or hide its shimmer. - createActionItem/_applyFetchedActionItems/_fetchHomeWidgetPreview: preserve optimistic creates across wholesale list replacement. Temp rows and rows that settled while a fetch was in flight survive exactly the replacements of fetches that predate them; later fetches stay authoritative. Temp rows are excluded from the Siri/Spotlight mirror while their final server identity is unknown. - UsageProvider.fetchSubscription: single-flight onto the real in-flight request so the unlimited deep link's _subscriptionReady await cannot pass while the fetch onboarding started is still unresolved (fail-open paywall flash). clearUserData detaches the in-flight future for the next account. Verified: dart analyze clean; new demand-load race tests (3), subscription single-flight tests (3), plus action_items/usage/siri suites all pass.
…fset, bounded waits - createActionItem: when a concurrent list response already observed the committed server row, replacing the temp row could leave a duplicate; the confirmed row now replaces both the temp row and any earlier copy. - loadMoreActionItems: offset counts server-backed rows only; preserved optimistic/shadowed creates stay out of the offset until a server page has contained them, so pagination never skips a server task. - Home widget freshness: admit the preview refresh after a bounded deadline even while repeating animations keep the scheduler busy; the timer no longer spins 4x/second indefinitely. - Quick actions: a failed shortcut publication now schedules a bounded delayed retry (still clearing the dedupe cache for natural republish), canceled by any successful publish or reset. - Conversation detail projection: replace full ServerConversation/App toJson encoding per notification with a cheap fingerprint of rendered fields (identity covers final heavy lists; structured title/overview and mutable catalog fields are included explicitly). Verified: dart analyze clean; demand-load race suite (now covering dedupe and pagination offset), quiet detail wiring, quick actions, and related action-items/usage/conversation-detail suites: 57/57 pass.
…ched creates - loadMoreActionItems only resets _isFetching and notifies for its owning session generation, so a sign-out-mid-flight load-more cannot clear the successor account's fetch state or admit overlapping pagination. - _settlePendingCreate no longer marks a create as offset-excluded when a concurrent fetch already placed its confirmed row in the visible list: a server page has contained it, so it is server-backed immediately instead of undercounting the pagination offset until some later page happens to retire it. Both paths have regression tests in the demand-load races suite.
…do preservation Codex review round 4 on the demand-load races: - fetchActionItems aborted (typed outage, sign-out discard, or throw) without running its _withPendingCreates replacement, but its finally only removed the ordinal from _wholesaleFetchesInFlight. The shadow kept excluding the server-confirmed row from _serverBackedRowCount forever, so pagination repeatedly re-requested overlapping pages. Prune the ordinal via _dropFetchShadowOrdinal exactly like the Home preview abort path. - _settlePendingCreate skipped registering fetch threats when the settled row was hidden by a staged delete. Undo restores the row, but the older in-flight response's replacement then dropped it from the list until the next refresh. Register the threats regardless of visibility and enforce deletion intent at replacement time instead: _withPendingCreates now skips preserving rows whose ids sit in _pendingDeletionIds, so committed/outright deletes are never resurrected while Undo re-arms preservation. Regression tests: aborted refresh releases its shadow; Undo before the fetch returns keeps the confirmed row; a committed staged delete stays deleted across the replacement.
…als, fold speaker-identity revision - Thread 1 (action_items): a concurrent fetch that observed the confirmed server row mid-toast admitted it into the visible lists because the tombstone still held only the temp id; the transfer branch now removes the observed row everywhere a fresh stageDeleteActionItem would, so the task cannot reappear during the Undo window or outlive a successful commit. - Thread 2 (action_items): clearUserData now clears _wholesaleFetchesInFlight so a stuck signed-out generation's ordinals cannot shadow a successor account's confirmed creates out of the pagination offset. - Thread 3 (conversation detail): applySpeakerPromptIdentities mutates transcript segments in place with no container-identity change; the conversation provider now bumps a speakerIdentityRevision and the detail fingerprint folds it in so owner answers re-render Speaker N rows. Regression tests for all three paths.
A settled complete/description/due-date mutation could be silently reverted when a wholesale list fetch that started earlier (the Home preview or the first Tasks demand load) applied its stale replacement: the response predates the mutation and restores the pre-edit server row, so a completed task showed incomplete until another refresh. Mirror the fetch-shadowed-create machinery for edits: record the server-confirmed row with the set of wholesale fetches still in flight when the mutation settles, and re-apply it over exactly those replacements. Fetches that started after the settle see the edit server-side and stay authoritative; aborted fetches and sign-out release their threat like create shadows.
- updateActionItemState now splices the settled server row back into the visible list, so a wholesale fetch that applies mid-mutation cannot leave the pre-completion row on screen (Codex PRRT NnpK). - Drag-reorder and indent changes are tracked as uncommitted layout and re-applied over wholesale replacements until their debounced batch write settles, with the same in-flight-ordinal threat semantics as edit shadows; failures retire so a later refresh restores server truth (Codex PRRT NnpR). - Bulk delete captures optimistic temp rows instead of sending temp ids to the bulk endpoint: the row hides behind a tombstone and the deletion completes with a follow-up single delete of the confirmed server id once the create settles; failed creates dissolve their capture and failed bulk requests roll back only the real rows (Codex PRRT Nnpu). - ensureHomeWidgetPreviewLoaded refreshes through refreshActionItems once the Tasks screen has loaded, restoring resume-time widget freshness behind the shared 30s cooldown (Codex PRRT sEMXt).
dfdd3a8 to
1ec65f7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ec65f7033
ℹ️ 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".
The settled-row splice and fetch-shadow introduced in round 4 could replace the visible row with a mutation echo that omits sort_order and indent_level (the wire schema defaults both to 0), flattening an indented task on complete/description/due-date settle — exactly what the upstream gesture contract (hub #4) forbids. Non-layout mutation echoes now merge the visible row's layout before splicing or shadow registration, so layout truth keeps flowing only from list fetches and layout mutations. - Partial bulk-delete rollback now filters captured temp rows like the null-response path: the bulk request never carried their ids, so a partial response cannot report them deleted and must not resurrect them (Codex PRRT sTqiZ). - Layout batch settlement is revision-aware: each debounced batch snapshots the per-id revisions it submitted, so an older batch response can no longer retire a newer edit the user staged while the request was in flight; the newer edit keeps protecting the visible rows until its own batch settles (Codex PRRT sTqip). - Regression tests for all three races in the demand-load race suite.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b34b35d42
ℹ️ 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".
…yout batch, shimmer join) - updateActionItemState now splices the confirmed server row when a wholesale fetch already applied mid-mutation, so a completion that settles after an intervening list response still lands (PRRT sNnpK). - Sort and indent share one debounce and one batch request: a drag that changes both commits atomically, and the shared layout revision can no longer be settled by whichever single-field flush finished first (PRRT sTqip, sZ2hW). - The Tasks screen joining a non-screen first load upgrades the presentation to the shimmer instead of flashing the false empty state (PRRT sZ2hf). - Regression tests for the atomic combined batch and the older-batch settle guard in action_items_demand_load_races_test.dart.
|
Round-5 review races addressed at 9df601a (all checks green):
All 8 Codex threads resolved as addressed. The |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9df601a192
ℹ️ 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".
- Generation-fence the joined-load shimmer cleanup so a stale completion from the signed-out account cannot clear the successor account's shimmer (Codex PRRT_kwDOLkKqys6sf5P1). - Track a per-item completion mutation revision: only the latest done/ undone attempt may settle its row, register its fetch shadow, revert the visible state on failure, or project to Siri/Apple Reminders, so out-of-order PATCH responses cannot resurrect superseded completion state (Codex PRRT_kwDOLkKqys6sf5P9). - Regression tests in the demand-load race suite (round 6).
|
Monitor run
Verification: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 995ce337de
ℹ️ 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".
…ters Codex review (round 7): after the Tasks screen loaded, resume-time widget freshness delegated to refreshActionItems(), whose fetch carries the screen's _startDate/_endDate and replaces _actionItems with only matching rows. HomeWidgetsPublisher derives Up Next and the open-in-all count from that list, so the iOS widget dropped tasks outside the screen filter until the filter cleared. - ensureHomeWidgetPreviewLoaded: with an active date-range filter, refresh a widget-only unfiltered snapshot instead (single-flight, shared 30s cooldown, generation-fenced, never replaces _actionItems); without a filter the authoritative screen refresh is already unfiltered and shared. - incompleteItems/todayPreviewTasks read the snapshot only while a filter is active, so the screen keeps its filtered list. - setDateRangeFilter/clearDateRangeFilter kick/invalidate the snapshot at the source-flip transition; clearUserData resets snapshot state. - Regression tests: round-7 group in action_items_demand_load_races_test.
|
Monitor run — round-7 review fix pushed ( Codex P2 — widget freshness inherited the Tasks screen filter (thread Fix: while a date-range filter is active, Verification: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f90501383d
ℹ️ 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".
| List<ActionItemWithMetadata> get incompleteItems { | ||
| final snapshot = _unfilteredWidgetSnapshot; | ||
| if (_widgetsReadFilteredList && snapshot != null) { | ||
| return snapshot.where((item) => item.completed == false).toList(); |
There was a problem hiding this comment.
Keep the widget snapshot synchronized with task mutations
When a date filter is active and this snapshot exists, every widget publication reads _unfilteredWidgetSnapshot instead of the live _actionItems. Completing, creating, editing, or deleting a task updates only the live lists, so the provider notification causes HomeWidgetsPublisher to republish the unchanged snapshot—for example, a completed filtered task remains in Up Next and the open count. The snapshot can remain stale indefinitely until a later resume-time refresh, so mutation paths need to update or invalidate it.
Useful? React with 👍 / 👎.
| _actionItems = _withPendingCreates( | ||
| _pendingDeletionIds.isEmpty | ||
| ? List.of(response.actionItems) | ||
| : response.actionItems.where((item) => !_pendingDeletionIds.contains(item.id)).toList(), | ||
| fetchOrdinal: fetchOrdinal, |
There was a problem hiding this comment.
Discard superseded list fetches before replacing filtered data
When Home's preview already contains rows, the first Tasks visit starts an unfiltered full fetch but keeps the list and its filter controls interactive. If the user applies a date filter before that request finishes, a second filtered fetch starts; when the filtered response arrives first and the older unfiltered response arrives afterward, this unconditional replacement displays all tasks while hasActiveFilter remains true. Fence list replacements by a request/filter revision so an older query cannot overwrite the current filter's result.
Useful? React with 👍 / 👎.
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
There was a problem hiding this comment.
19 issues found across 27 files
Confidence score: 3/5
- In
app/lib/core/app_shell.dart, a login started before an account switch can still replace the new user's Intercom identity; the later UID check only protects attributes. Serialize or generation-fence the identity operation. - In
app/lib/providers/action_items_provider.dart, overlapping task edits can overwrite each other's protection, and a slower old description or due-date response can replace a newer value. Track mutation revisions per field and apply or revert a response only while it still owns that field. - In
app/lib/pages/home/page.dart, the freshness timer fetches up to 100 tasks on Android even though widgets are a no-op there, adding unnecessary work to the demand-mounted Tasks flow. Guard the preview load withPlatform.isIOS. - In
app/lib/services/quick_actions_service.dart, a failed retry can replace the timer for a newer failed projection, leaving shortcuts unpublished if nothing else triggers an update. Check projection ownership before rescheduling.
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/integration_test/perf/perf_warmup_test.dart">
<violation number="1" location="app/integration_test/perf/perf_warmup_test.dart:95">
P2: A failed seed leaks the fixture because teardown only closes `world` after the full seed succeeds. Track resource initialization and always perform idempotent cleanup after seed starts, so setup failures cannot leave servers running or contaminate later tests.</violation>
<violation number="2" location="app/integration_test/perf/perf_warmup_test.dart:210">
P2: This ordering assertion is race-prone because backend probing and provider seeding run concurrently. Remove the ordering requirement or synchronize the probe before asserting it; otherwise host scheduling can fail valid warm-up runs.</violation>
</file>
<file name="app/lib/providers/conversation_provider.dart">
<violation number="1" location="app/lib/providers/conversation_provider.dart:1474">
P2: `applied` records a matching segment, not an actual change, so repeated identities still bump `_speakerIdentityRevision` and defeat the quiet fingerprint. Compare the existing fields before assigning and bump only for real changes.</violation>
<violation number="2" location="app/lib/providers/conversation_provider.dart:1479">
P3: This revision is global while detail fingerprints use it for one selected conversation, so labeling any other conversation rebuilds the open detail route. Key the revision by conversation ID.</violation>
</file>
<file name="app/lib/providers/usage_provider.dart">
<violation number="1" location="app/lib/providers/usage_provider.dart:230">
P2: Reserve `_subscriptionFetchInFlight` before the first `notifyListeners()`. `ChangeNotifier` invokes listeners synchronously, so a listener that starts a fetch or logs out during this notification can launch duplicate work or make the next session join the stale future.</violation>
</file>
<file name="app/lib/backend/preferences.dart">
<violation number="1" location="app/lib/backend/preferences.dart:1503">
P2: This invalidates the supposedly account-revision-keyed catalog snapshot on every token refresh, even when the UID is unchanged, causing repeated large JSON decodes and undermining the warm-up/steady-state performance improvement. Increment the revision only when the stored UID actually changes.</violation>
</file>
<file name="app/test/providers/quiet_detail_wiring_test.dart">
<violation number="1" location="app/test/providers/quiet_detail_wiring_test.dart:140">
P3: This assertion never exercises an unmatched prompt: it only re-runs `setProviders` after the prior matching update. Apply an answer with an unknown segment ID before asserting no notification, otherwise unconditional revision bumps remain undetected.</violation>
</file>
<file name="app/test/widgets/tasks_first_visit_shimmer_test.dart">
<violation number="1" location="app/test/widgets/tasks_first_visit_shimmer_test.dart:43">
P2: This test does not verify that the first Tasks visit starts its own load. Assert `requests == 2` after `pumpWidget`; otherwise a regression that omits the screen fetch still passes because the initial scheduled-load shimmer is rendered independently.</violation>
</file>
<file name="app/lib/pages/home/page.dart">
<violation number="1" location="app/lib/pages/home/page.dart:660">
P2: This freshness timer fetches up to 100 tasks on Android even though `HomeWidgetsService` is a no-op off iOS. Guard the preview load with `Platform.isIOS` so the demand-mounted Tasks optimization does not add an unnecessary network/parse cost on every Android launch and resume.</violation>
</file>
<file name="app/lib/providers/action_items_provider.dart">
<violation number="1" location="app/lib/providers/action_items_provider.dart:307">
P2: A task can have only one edit shadow, so overlapping mutations overwrite each other’s protection. Merge settled fields or retain independent per-mutation shadows; otherwise a pre-mutation list response can restore an earlier description, completion, or due date.</violation>
<violation number="2" location="app/lib/providers/action_items_provider.dart:714">
P2: Filtered Tasks widgets become stale after local task mutations because this snapshot is never updated when `_actionItems` changes. Keep the unfiltered widget snapshot synchronized with optimistic and settled creates, edits, completions, and deletes, or merge those mutations when reading it.</violation>
<violation number="3" location="app/lib/providers/action_items_provider.dart:1123">
P2: The latest-toggle fence does not cover notification cancellation or Siri completion donation. Guard those side effects with the latest completion attempt as well, otherwise an older completion response can leave an undone task without its notification and with a stale donation.</violation>
<violation number="4" location="app/lib/providers/action_items_provider.dart:1225">
P2: Description and due-date writes still accept stale responses, so a slower older edit can overwrite a newer edit for the same task. Add per-field mutation revisions and apply, shadow, or revert a response only when it is still the latest attempt.</violation>
<violation number="5" location="app/lib/providers/action_items_provider.dart:1868">
P2: A thrown layout batch leaves the optimistic layout permanently marked uncommitted after the pending maps are cleared. Catch request failures and settle or roll back the submitted revisions so later refreshes can restore server truth and a future edit can retry.</violation>
</file>
<file name=".agent-brief/round2-warmup-findings.md">
<violation number="1" location=".agent-brief/round2-warmup-findings.md:20">
P2: `first_home_frame_ms` is not a production Home frame: the warm-up test pumps a bare `Scaffold` and pushes `ConversationsPage` directly. Rename this milestone to the conversation-list frame, or mount the real Home page before using it as Home startup evidence.</violation>
</file>
<file name="app/lib/services/quick_actions_service.dart">
<violation number="1" location="app/lib/services/quick_actions_service.dart:127">
P2: A failed retry can overwrite the retry timer belonging to a newer failed projection. Guard this reschedule with the failed-projection ownership check, otherwise the newer shortcuts can remain unpublished when no later state change triggers another update.</violation>
</file>
<file name="app/lib/pages/conversation_detail/conversation_detail_provider.dart">
<violation number="1" location="app/lib/pages/conversation_detail/conversation_detail_provider.dart:909">
P2: This string fingerprint is not injective: catalog changes that move `~` or `|` across field boundaries can produce the same projection, so `setProviders` skips the notification. Encode the fields structurally or compare a collision-resistant per-field representation with unambiguous boundaries.</violation>
</file>
<file name="app/lib/providers/local_recordings_provider.dart">
<violation number="1" location="app/lib/providers/local_recordings_provider.dart:669">
P2: `refresh()` starts a short-lived worker for every uncached recording, and awaits each one serially. Batch uncached paths in one worker or reuse a worker so large recording backlogs do not pay isolate startup overhead repeatedly.</violation>
</file>
<file name="app/lib/core/app_shell.dart">
<violation number="1" location="app/lib/core/app_shell.dart:410">
P1: This untracked login can finish after an account switch and replace the successor’s native Intercom identity; the later UID check only guards attributes. Serialize or generation-fence the SDK identity operation itself.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| final intercom = PlatformManager.instance.intercom; | ||
| try { | ||
| if (isSignedIn) { | ||
| await intercom.loginIdentifiedUser(uid); |
There was a problem hiding this comment.
P1: This untracked login can finish after an account switch and replace the successor’s native Intercom identity; the later UID check only guards attributes. Serialize or generation-fence the SDK identity operation itself.
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/core/app_shell.dart, line 410:
<comment>This untracked login can finish after an account switch and replace the successor’s native Intercom identity; the later UID check only guards attributes. Serialize or generation-fence the SDK identity operation itself.</comment>
<file context>
@@ -383,30 +387,41 @@ class _AppShellState extends State<AppShell> {
+ final intercom = PlatformManager.instance.intercom;
+ try {
+ if (isSignedIn) {
+ await intercom.loginIdentifiedUser(uid);
+ } else if (!PlatformManager.instance.isAnalyticsSupported) {
+ await intercom.loginUnidentifiedUser();
</file context>
| 'complete': phases.length == 5, | ||
| }; | ||
| expect(phases.values.every((ms) => ms >= 0 && ms < 15000), isTrue); | ||
| expect(phases['fixture_backend_up_ms'], lessThanOrEqualTo(phases['providers_first_ready_ms']!)); |
There was a problem hiding this comment.
P2: This ordering assertion is race-prone because backend probing and provider seeding run concurrently. Remove the ordering requirement or synchronize the probe before asserting it; otherwise host scheduling can fail valid warm-up runs.
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/integration_test/perf/perf_warmup_test.dart, line 210:
<comment>This ordering assertion is race-prone because backend probing and provider seeding run concurrently. Remove the ordering requirement or synchronize the probe before asserting it; otherwise host scheduling can fail valid warm-up runs.</comment>
<file context>
@@ -0,0 +1,218 @@
+ 'complete': phases.length == 5,
+ };
+ expect(phases.values.every((ms) => ms >= 0 && ms < 15000), isTrue);
+ expect(phases['fixture_backend_up_ms'], lessThanOrEqualTo(phases['providers_first_ready_ms']!));
+ final directory = Directory(Platform.environment['PERF_SCORECARD_DIR'] ?? '/tmp/omi-perf')
+ ..createSync(recursive: true);
</file context>
| final phases = <String, double>{}; | ||
| final clock = Stopwatch(); | ||
| final collector = _WarmupInstrumentation(clock); | ||
| var seeded = false; |
There was a problem hiding this comment.
P2: A failed seed leaks the fixture because teardown only closes world after the full seed succeeds. Track resource initialization and always perform idempotent cleanup after seed starts, so setup failures cannot leave servers running or contaminate later tests.
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/integration_test/perf/perf_warmup_test.dart, line 95:
<comment>A failed seed leaks the fixture because teardown only closes `world` after the full seed succeeds. Track resource initialization and always perform idempotent cleanup after seed starts, so setup failures cannot leave servers running or contaminate later tests.</comment>
<file context>
@@ -0,0 +1,218 @@
+ final phases = <String, double>{};
+ final clock = Stopwatch();
+ final collector = _WarmupInstrumentation(clock);
+ var seeded = false;
+ addTearDown(() async {
+ if (collector.active) collector.stop(binding);
</file context>
| segment.isUser = identity.isUser; | ||
| segment.personId = identity.personId; | ||
| segment.speakerLabelSource = 'manual'; | ||
| applied = true; |
There was a problem hiding this comment.
P2: applied records a matching segment, not an actual change, so repeated identities still bump _speakerIdentityRevision and defeat the quiet fingerprint. Compare the existing fields before assigning and bump only for real changes.
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_provider.dart, line 1474:
<comment>`applied` records a matching segment, not an actual change, so repeated identities still bump `_speakerIdentityRevision` and defeat the quiet fingerprint. Compare the existing fields before assigning and bump only for real changes.</comment>
<file context>
@@ -1459,8 +1471,12 @@ class ConversationProvider extends ChangeNotifier {
segment.isUser = identity.isUser;
segment.personId = identity.personId;
segment.speakerLabelSource = 'manual';
+ applied = true;
}
}
</file context>
| fetch = _fetchSubscription(generation).whenComplete(() { | ||
| if (identical(_subscriptionFetchInFlight, fetch)) _subscriptionFetchInFlight = null; | ||
| }); | ||
| _subscriptionFetchInFlight = fetch; |
There was a problem hiding this comment.
P2: Reserve _subscriptionFetchInFlight before the first notifyListeners(). ChangeNotifier invokes listeners synchronously, so a listener that starts a fetch or logs out during this notification can launch duplicate work or make the next session join the stale future.
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/usage_provider.dart, line 230:
<comment>Reserve `_subscriptionFetchInFlight` before the first `notifyListeners()`. `ChangeNotifier` invokes listeners synchronously, so a listener that starts a fetch or logs out during this notification can launch duplicate work or make the next session join the stale future.</comment>
<file context>
@@ -209,14 +211,27 @@ class UsageProvider with ChangeNotifier {
+ fetch = _fetchSubscription(generation).whenComplete(() {
+ if (identical(_subscriptionFetchInFlight, fetch)) _subscriptionFetchInFlight = null;
+ });
+ _subscriptionFetchInFlight = fetch;
+ return fetch;
+ }
</file context>
| final response = await _fetchActionItemsPage(limit: 100, offset: 0, completed: false); | ||
| if (generation != _sessionGeneration) return; | ||
| if (response == null) return; | ||
| _unfilteredWidgetSnapshot = |
There was a problem hiding this comment.
P2: Filtered Tasks widgets become stale after local task mutations because this snapshot is never updated when _actionItems changes. Keep the unfiltered widget snapshot synchronized with optimistic and settled creates, edits, completions, and deletes, or merge those mutations when reading 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 app/lib/providers/action_items_provider.dart, line 714:
<comment>Filtered Tasks widgets become stale after local task mutations because this snapshot is never updated when `_actionItems` changes. Keep the unfiltered widget snapshot synchronized with optimistic and settled creates, edits, completions, and deletes, or merge those mutations when reading it.</comment>
<file context>
@@ -233,37 +623,153 @@ class ActionItemsProvider extends ChangeNotifier {
+ final response = await _fetchActionItemsPage(limit: 100, offset: 0, completed: false);
+ if (generation != _sessionGeneration) return;
+ if (response == null) return;
+ _unfilteredWidgetSnapshot =
+ response.actionItems.where((item) => !_pendingDeletionIds.contains(item.id)).take(100).toList();
+ _unfilteredWidgetRefreshedAt = DateTime.now();
</file context>
| notifyListeners(); | ||
| Logger.debug('Failed to update action item state on server'); | ||
| attempt.complete(ProductOutcome.failure, failure: ProductFailure.server); | ||
| if (isLatestCompletionAttempt()) { |
There was a problem hiding this comment.
P2: The latest-toggle fence does not cover notification cancellation or Siri completion donation. Guard those side effects with the latest completion attempt as well, otherwise an older completion response can leave an undone task without its notification and with a stale donation.
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/action_items_provider.dart, line 1123:
<comment>The latest-toggle fence does not cover notification cancellation or Siri completion donation. Guard those side effects with the latest completion attempt as well, otherwise an older completion response can leave an undone task without its notification and with a stale donation.</comment>
<file context>
@@ -526,20 +1110,54 @@ class ActionItemsProvider extends ChangeNotifier {
- notifyListeners();
- Logger.debug('Failed to update action item state on server');
- attempt.complete(ProductOutcome.failure, failure: ProductFailure.server);
+ if (isLatestCompletionAttempt()) {
+ _findAndUpdateItemState(item.id, !newState);
+ notifyListeners();
</file context>
| final index = _actionItems.indexWhere((i) => i.id == item.id); | ||
| if (index != -1) { | ||
| _actionItems[index] = updatedItem; | ||
| _actionItems[index] = _withVisibleLayout(updatedItem.id, updatedItem); |
There was a problem hiding this comment.
P2: Description and due-date writes still accept stale responses, so a slower older edit can overwrite a newer edit for the same task. Add per-field mutation revisions and apply, shadow, or revert a response only when it is still the latest attempt.
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/action_items_provider.dart, line 1225:
<comment>Description and due-date writes still accept stale responses, so a slower older edit can overwrite a newer edit for the same task. Add per-field mutation revisions and apply, shadow, or revert a response only when it is still the latest attempt.</comment>
<file context>
@@ -594,9 +1222,11 @@ class ActionItemsProvider extends ChangeNotifier {
final index = _actionItems.indexWhere((i) => i.id == item.id);
if (index != -1) {
- _actionItems[index] = updatedItem;
+ _actionItems[index] = _withVisibleLayout(updatedItem.id, updatedItem);
notifyListeners();
}
</file context>
| detail.setProviders(apps, conversations); | ||
| expect(notifications, 1, reason: 'speaker-identity edits must notify the detail projection'); | ||
|
|
||
| // A prompt answer that matches no segment of the selected conversation |
There was a problem hiding this comment.
P3: This assertion never exercises an unmatched prompt: it only re-runs setProviders after the prior matching update. Apply an answer with an unknown segment ID before asserting no notification, otherwise unconditional revision bumps remain undetected.
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/providers/quiet_detail_wiring_test.dart, line 140:
<comment>This assertion never exercises an unmatched prompt: it only re-runs `setProviders` after the prior matching update. Apply an answer with an unknown segment ID before asserting no notification, otherwise unconditional revision bumps remain undetected.</comment>
<file context>
@@ -0,0 +1,145 @@
+ detail.setProviders(apps, conversations);
+ expect(notifications, 1, reason: 'speaker-identity edits must notify the detail projection');
+
+ // A prompt answer that matches no segment of the selected conversation
+ // bumps nothing: no spurious notification.
+ detail.setProviders(apps, conversations);
</file context>
| } | ||
| // In-place segment edits change no container identity: bump the revision | ||
| // so cheap downstream fingerprints (conversation detail) still notify. | ||
| if (applied) _speakerIdentityRevision++; |
There was a problem hiding this comment.
P3: This revision is global while detail fingerprints use it for one selected conversation, so labeling any other conversation rebuilds the open detail route. Key the revision by conversation ID.
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_provider.dart, line 1479:
<comment>This revision is global while detail fingerprints use it for one selected conversation, so labeling any other conversation rebuilds the open detail route. Key the revision by conversation ID.</comment>
<file context>
@@ -1459,8 +1471,12 @@ class ConversationProvider extends ChangeNotifier {
}
+ // In-place segment edits change no container identity: bump the revision
+ // so cheap downstream fingerprints (conversation detail) still notify.
+ if (applied) _speakerIdentityRevision++;
notifyListeners();
}
</file context>
|
Folded into the survivor #24485 (head What carried over: the unfiltered iOS-widget snapshot (keeps Home widgets truthful while the Tasks screen shows a date-range filter, with the filter-transition refresh hook), the apps-list revision tracking with its app_provider cache invalidation, the quiet first-time external-actions binding (projection compare, now also covering mutated adapters), the scheduler-idle freshness gate in the home page, and the updated UI-Evidence posture for the touched screens. What main superseded, deliberately: this PR's optimistic-create/wholesale-fetch fencing and layout-revision batch-update machinery in |
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |




Summary
Round 2 of the mobile smoothness program: architecture fixes for the cold-start/warm-up window (user-visible: laggy scrolling/navigating for the first 10–15 seconds after launch, then smooth). Five workstreams, coordinated via a read-only idea hunt (astra) and implemented by parallel agents with disjoint file ownership, plus permanent warm-up instrumentation in the perf harness.
The warm-up signature (new instrumentation)
perf_warmup_test.dart(additive; steady-state gate untouched) measures wall-clock boot phases and frame health in 0–5s vs 5–15s windows: engine build p90 collapses from ~75 ms (early) to ~10 ms (late), jank 29–35% → 3%. The dominant interval is providers-ready → first home frame (~1.0–1.1 s of first construction + post-frame work). Fixes below target exactly this window.Fixes
be4467e602) — async directory/ownership enumeration; exact duration counting moved to acomputeworker (path-only argument). Verified probe: 44 MB / 1M-frame scan went from 1,349 UI-isolate callbacks (~21 ms callback time) to 2 callbacks (~0 ms); wall 52→16 ms. Parse/crash-tail/ownership semantics unchanged.80bd00949c) — removes Home's 350 ms offscreen-tab prewarm; hidden Tasks no longer constructs or fetches (Goals init, tasks/integrations reads) inside the first gesture. Visited tabs keep state; first visit uses the existing skeleton/shimmer. Home widgets read a bounded cached first-page snapshot with an idle-checked, single-flight, 30 s-cooldown freshness read. Probes prove zero ActionItemsPage mounts/Goals constructions before first visit and correct preview/full-read interplay.d4d967481b) — provider-owned decoded snapshot keyed by a preference revision; hydration, Chat init, and lookups reuse object identity instead of re-decoding JSON (verified: model identity retained across hydration/write/fallback paths with 1,000 persisted rows; invalidation on writes/UID change/clear).d4d967481b) — support-identity login runs as its own error-handled async task; message/catalog hydration and subscription/integration refreshes no longer wait on the support SDK; deep links wait on the product state they actually need.d799aad7c3) — Capture/Device/Detail reference binding notifies only when an observable projection actually changes; native shortcut publication is deduplicated by actual item state (connect/mute/locale). Notification-count regression tests assert wiring-only sequences produce zero device-state notifications and zero unchanged shortcut publications (before: unconditional).Behavior
Behavior-neutral: same screens, same data, same interactions after warm-up; shortcuts still publish on real state changes; Tasks works on first visit; offline/ownership/retention policies untouched. One pre-existing
print(err)in the detail reprocess error handler replaced with the file'sLogger.debugconvention (analyzer hygiene).Failure-Class
Failure-Class: none
UI-Evidence
UI-Evidence: none -- behavior-neutral performance and initialization-order work; no visual or interaction changes
Product invariants affected
INV-CAP-1 — capture_controller.dart changes are confined to dependency-binding notify behavior (stored projection comparison); capture state machine, uplink/socket lifecycle, retention and frame-durability paths are untouched. No phone-side power or scheduling policy changes.
Line-Count-Exception
Line-Count-Exception: app/lib/backend/preferences.dart | 1505 -> 1520 | catalog snapshot revision guard + invalidation hooks; extraction would churn the reviewed snapshot diff mid-sprint
Line-Count-Exception: app/lib/pages/conversation_detail/conversation_detail_provider.dart | 1514 -> 1576 | quiet detail-binding projection comparator + logger hygiene; split rejected to keep reviewed bytes
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4238 -> 4245 | stored-projection quiet-notify guard; extraction deferred to keep the reviewed diff minimal
Line-Count-Exception: app/lib/providers/action_items_provider.dart | 1315 -> 2307 | demand-load shadow/fence state, pagination guards, staged-delete transfer, round-4 races (settle splice, layout shadows, bulk-delete capture, widget freshness), round-5 races (echo layout merge, partial bulk rollback filter, revision-aware layout settle), round-6 races (joined-shimmer generation fence, completion mutation revisions), round-7 race (widget freshness stays unfiltered while the Tasks screen filters); extraction deferred to keep reviewed race fixes together
Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2098 -> 2114 | speaker-identity revision folded into the detail fingerprint; extraction deferred to keep the reviewed diff minimal
Test plan
cd app && bash test.sh— full suite green per workstream (5,344+ tests) and re-run at consolidation headbash integration_test/journeys/run_journeys.sh— 6/6 journeys at consolidation headcd app && flutter analyze --no-pub— clean on all changed filesbash scripts/pr-preflight --pr-body-file <body>— all checks at consolidation head