Skip to content

Perf: smooth the cold-start warm-up window (init ordering, quiet wiring, demand-mounted tabs) - #21364

Closed
Git-on-my-level wants to merge 19 commits into
mainfrom
perf/smoothness-round2
Closed

Git-on-my-level wants to merge 19 commits into
mainfrom
perf/smoothness-round2

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

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

  1. Cold local-recording scans off the UI isolate (be4467e602) — async directory/ownership enumeration; exact duration counting moved to a compute worker (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.
  2. Demand-mounted Tasks tab (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.
  3. App catalog decoded once (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).
  4. Intercom off the hydration critical path (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.
  5. Quiet dependency wiring (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's Logger.debug convention (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 head
  • bash integration_test/journeys/run_journeys.sh — 6/6 journeys at consolidation head
  • cd app && flutter analyze --no-pub — clean on all changed files
  • bash scripts/pr-preflight --pr-body-file <body> — all checks at consolidation head
  • Warm-up harness: 2 proof runs green; steady-state scenarios + budget gate green

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-10-15T02:24:00.750215Z f905013 New commits
ℹ️ About Codex in GitHub

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

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

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

@cursor cursor 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.

Agentic security review of the cold-start warm-up changes found one medium issue: Intercom support identity login is now fire-and-forget, so an in-flight login can complete after sign-out or account switch and bind Help Center to the previous user.

Open in Web View Automation 

Sent by Cursor Security Agent: Security Reviewer

Comment on lines +403 to +410
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 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.

Fix in Cursor Fix in Web

Reviewed by Cursor Security Reviewer for commit d799aad. Configure here.

@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: 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".

Comment thread app/lib/core/app_shell.dart Resolved

@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: 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".

Comment thread app/lib/pages/home/page.dart Resolved

@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: 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".

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round-3 review fixes pushed (1b964925): all 12 Codex threads addressed and resolved.

  • Preserved-create retirement (r4bIZ): _withPendingCreates now retires _preservedCreateIds before the nothing-to-preserve early return, so a server-observed confirmed create rejoins the pagination offset instead of being excluded forever.
  • Shortcut retry (r3deu/r4bIe): failed publications are tracked separately from the dedupe cache the failure path clears, so the bounded 5s retry actually republishes; a successful retry restores the dedupe cache.
  • Screen vs preview readiness (r4bIl): new screenLoaded gates the Tasks first-load shimmer, so a completed zero-task Home preview can no longer flash the empty state on first visit.
  • Detail fingerprint (r3de7/r4bIt): the change fingerprint now includes app.description/app.getImageUrl() rendered by the attribution row, so catalog-only metadata edits notify while detail is open.
  • Threads from earlier rounds (fencing sign-out loads, optimistic-create preservation, subscription single-flight, dedupe on temp-row replacement, bounded animation wait, pagination offset exclusion) were verified in the previous commits and resolved as addressed.
  • PR body line-count exceptions updated for the two providers the race guards grow.

Verification: 30 focused tests across 10 suites green (incl. 4 new regressions), flutter analyze clean on touched files, desktop changelog gate N/A, full pre-push preflight passed (line-count ratchet, ui-evidence, manifest contract).

@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: 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".

@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: 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".

@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: 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".

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Acknowledging the widget-freshness thread without a code change in this PR: the observation is correct — after the Tasks screen loads once, ensureHomeWidgetPreviewLoaded early-returns and a resume no longer refreshes the widget snapshot. That early return is deliberate, though: the preview read replaces _actionItems wholesale, which is only safe before the Tasks screen owns pagination; after load-more pages have appended, a resume-time wholesale replace would regress the Tasks list (drop loaded pages mid-session). Making resume freshness work properly needs a separate widget snapshot store that never aliases _actionItems — a new workstream, out of scope for this warm-up-window PR. Filed as follow-up work rather than patched here.

@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: 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".

@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: 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".

@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: 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".

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — round-4 review fixes pushed (09fa07d6), 3 Codex threads addressed and resolved.

  • Staged-delete transfer vs concurrent fetch (action_items): the transfer branch now also removes the confirmed row from the visible lists when a concurrent fetch observed it mid-toast; it can no longer reappear during the Undo window or outlive commit. Regression test: a fetch observing the confirmed row mid-toast does not outlive the transferred staged delete.
  • Stale wholesale ordinals on account reset (action_items): clearUserData() now clears _wholesaleFetchesInFlight so a stuck signed-out fetch cannot shadow a successor account's confirmed create out of the pagination offset. Regression test: clearUserData releases wholesale fetches still in flight for the signed-out account.
  • In-place speaker-identity edits in the detail fingerprint (conversation detail): applySpeakerPromptIdentities now bumps a speakerIdentityRevision and the detail fingerprint folds it in, so owner answers re-render "Speaker N" rows without an unrelated detail change. Regression test in quiet_detail_wiring_test.dart.

Local verification: flutter test on both touched suites 19/19 green; analyzer ratchet passed; formatter clean at width 120. PR-body line-count exceptions updated to match the new totals (incl. a new entry for conversation_provider.dart).

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — round-5 review fix pushed (dfdd3a8f), 1 Codex thread addressed and resolved.

  • Preserve edits across wholesale list replacement (action_items_provider r4266767434): a settled complete/description/due-date mutation could be silently reverted when a wholesale list fetch that started earlier (Home preview or the first Tasks demand load) applied its stale replacement — a completed task showed incomplete until another refresh. Mirrors the fetch-shadowed-create machinery for edits: the server-confirmed row is recorded with the wholesale fetches still in flight at settle time and re-applied over exactly those replacements; later fetches see the edit server-side and stay authoritative, aborted fetches and sign-out release their threat. Two regression tests added (edit survives the stale demand load; shadow retires once a post-settle fetch applies). The line-count exception for the provider was updated to match.

Re-scan after push: no new review threads; CI re-running on the new head.

@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: 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".

Git-on-my-level and others added 7 commits October 14, 2026 17:51
…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).

@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: 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.

@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: 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.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round-5 review races addressed at 9df601a (all checks green):

  • Completion splice (sNnpK), pending reorder/indent preservation (sNnpR), bulk-delete intent transfer (sNnpu), partial-rollback capture filter (sTqiZ), revision-aware layout settle (sTqip): fixes completed and covered in action_items_demand_load_races_test.dart.
  • Sort and indent now share one debounce and one atomic batch request (sZ2hW): a drag changing both fields commits together; new regression test asserts a single batch carrying both fields.
  • Tasks screen joining a non-screen first load upgrades to the shimmer instead of the false empty state (sZ2hf).
  • Widget freshness after Tasks has loaded (sEMXt): already handled on the previous head via the refreshActionItems() route under the 30 s cooldown; verified by the existing "home widget freshness refreshes after the Tasks screen has loaded" test.

All 8 Codex threads resolved as addressed. The Line-Count-Exception for action_items_provider.dart was updated to match the final file size (1315 → 2177). No merge performed.

@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: 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).
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run 20261014T225838Z — addressed both unresolved Codex threads in action_items_provider.dart (commit 995ce33, preflight gate passed before push):

  • Joined shimmer cleanup fenced to its session generation (PRRT_kwDOLkKqys6sf5P1): the whenComplete on a Tasks-screen shimmer join now clears _isLoading only when the generation still matches, so a load started by a non-screen caller before sign-out can no longer clear the successor account's shimmer. Regression test: round 6 review races > a shimmer joined before sign-out cannot clear the successor account shimmer.
  • Completion mutation revisions (PRRT_kwDOLkKqys6sf5P9): updateActionItemState stamps a monotonic per-item revision; only the latest done/undone attempt may splice its settled row, register its fetch shadow, revert visible state on failure, or project to Siri/Apple Reminders. A delayed out-of-order PATCH response can no longer resurrect superseded completion state. Regression test: round 6 review races > an out-of-order completion response cannot resurrect a superseded state.

Verification: flutter analyze clean on both touched files; the full action_items_demand_load_races_test.dart suite (33 tests) plus nine neighboring provider/spine/contract suites (54 tests) pass; dart format unchanged. Both threads replied to and resolved. The line-count ledger exception in the PR body was updated to match the file's new size (1315 → 2212).

@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: 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.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — round-7 review fix pushed (f90501383d), 1 Codex thread addressed and resolved.

Codex P2 — widget freshness inherited the Tasks screen filter (thread …sjw29): 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 — shrinking the iOS widget's Up Next entries and "open in all" count to the filtered subset until the filter cleared.

Fix: while a date-range filter is active, ensureHomeWidgetPreviewLoaded() refreshes a widget-owned unfiltered snapshot instead (single-flight, shared 30 s cooldown, generation-fenced, never replaces the screen's list). incompleteItems/todayPreviewTasks() read the snapshot only while a filter is active; clearing the filter drops it and widgets read the live unfiltered screen list. Filter apply/clear transitions kick/invalidate the snapshot; clearUserData() resets it. Regression tests added (round-7 group, action_items_demand_load_races_test.dart).

Verification: dart analyze clean; 56 focused tests green across action_items_demand_load_races (incl. 2 new), action_items_home_today, c3_action_items_production_wiring, action_items_initial_load, home_widgets_payload; full pre-push gate green (ui-evidence via PR body; line-count exception updated 2212 → 2307 for the same file); CodeQL + all 8 Analyze checks pass on the pushed head. No merge performed.

@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: 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".

Comment on lines +573 to +576
List<ActionItemWithMetadata> get incompleteItems {
final snapshot = _unfilteredWidgetSnapshot;
if (_widgetsReadFilteredList && snapshot != null) {
return snapshot.where((item) => item.completed == false).toList();

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 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 👍 / 👎.

Comment on lines +976 to +980
_actionItems = _withPendingCreates(
_pendingDeletionIds.isEmpty
? List.of(response.actionItems)
: response.actionItems.where((item) => !_pendingDeletionIds.contains(item.id)).toList(),
fetchOrdinal: fetchOrdinal,

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 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 👍 / 👎.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui f90501383d71d12b2141e278217818373547302f. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@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.

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 with Platform.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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: 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']!));

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 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;

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: 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;

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: 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;

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: 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 =

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: 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()) {

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 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);

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: 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

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 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++;

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 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>

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Folded into the survivor #24485 (head d6ab3673d9e40b3612856348e40704f7663501d6, branch lane/action-reminders-1103) and closed in its favor — nothing merged to main from here.

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 action_items_provider.dart — main independently shipped newer race reconciliation for the same bug classes (read ordinals, deletion lifecycle, generation fencing in #94798e1e73/#e5bb1efdef), and the two mechanisms could not be layered. The three test files that only exercised the dropped machinery (action_items_demand_load_races_test.dart, tasks_first_visit_shimmer_test.dart, batch_frame_count_boundaries_test.dart, plus the perf probe using the removed frame counter) were removed with it; the demand-load and quiet-wiring contracts survive in the merged provider under main's architecture.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant