Skip to content

fix(app): stop the scheduler spinning behind Home's live dot after a conversation opens - #23076

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/scroll-jank
Oct 21, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/scroll-jank

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

P36: David reported Home scrolling "very laggy sometimes, like after opening a conversation"
(iPhone, TestFlight 1.0.571, 10-21 22:35 local).

Root cause: ConversationListItem._open queued the "conversation opened" analytics through
SchedulerBinding.scheduleTask(…, Priority.idle). Flutter's default scheduling strategy declines
an idle task while any ticker runs, and _runTasks then re-arms Timer.run every event-loop
turn until the task can run. Home's live episode row pulses its dot for as long as a capture is
live, so from the tap onward the UI isolate busy-looped: through the push, through a processing
conversation's indeterminate bar (the detail page animates, so the task still cannot run), and
again on Home after the pop, where the dot keeps it spinning indefinitely. The same shape OOMs a
widget test: the pump never returns and the tester grows to 34 GB.

  • conversation_list_item.dart: the analytics call is deferred with Timer.run instead; it
    still runs off the navigation frame and no longer depends on the scheduler's priority gate.
  • processing_capture.dart: the capture card's own 1-second ticker skips setState while the
    live episode row is drawing the capture (the card renders nothing then); a call still ticks.

Measured and left as is: one list identity replacement rebuilds each mounted row's shell once
(20 rows per update here; the per-row Selector keeps row content from rebuilding), and
ConversationDetailProvider.setProviders still notifies on every list-provider update (nothing on
Home listens to it, so no Home cost).

Product invariants affected

INV-PERF-1 (named because this adds a guard): no idle-priority scheduler task from a surface
that can animate.

Failure-Class: new

UI-Evidence: none -- no pixel changes: a deferred analytics call changes how it is scheduled, and the capture card skips a setState while it renders nothing; the Home render is unchanged.

How it was verified

app/test/perf/home_after_detail_perf_test.dart, hermetic: the real ConversationsPage with a
pushed ConversationDetailPage under the production provider wiring, a streaming capture with
the pulsing live row, 30 list projections, and a 1500-line hydration through the detail endpoint.

  • Opening a row consults the binding's scheduling strategy 0 times (the spy fails past 50; on
    the old code it fails at 51), and the open is still reported to analytics.
  • Five 1-second ticks rebuild only the live row's clock (LiveEpisodeClock: 5, no
    ConversationListItem, at most one page-shell rebuild); the old capture card ticked 5×.
  • Three open/close visits leave transientCallbackCount at baseline with the same tick profile.
  • Ten identity replacements cost at most one shell build per mounted row each; two flings build
    10 rows (bounded by the list length).

Both guards are red on origin/main and green with the fix. flutter test over test/perf,
test/pages/conversations, test/spine and the 14 widget tests that touch these files:
453 passed, 0 failed. flutter analyze on the changed files and
check_mobile_ui_isolate.py --report: clean. Layer: host widget tests; not measured on a device.

View guided diff Turn on auto-fix

…conversation opens

Opening a conversation queued its analytics through
SchedulerBinding.scheduleTask(…, Priority.idle). While any ticker runs the
default scheduling strategy declines an idle task, and SchedulerBinding
re-arms a zero-delay timer every event-loop turn until it can run; with a
capture live, Home's live dot pulses indefinitely, so the UI isolate
busy-looped from the tap onward, through a processing conversation's
indeterminate bar, and on Home again after the pop. The analytics call now
defers with Timer.run, and the capture card's own 1-second setState stops
while the episode row draws the capture.

Guards in app/test/perf/home_after_detail_perf_test.dart: the scheduling
strategy is consulted zero times on open and the open still reaches
analytics; five ticks rebuild only LiveEpisodeClock; three open/close visits
leave no ticker or rebuild behind; ten list identity replacements cost one
shell build per mounted row each.

Failure-Class: new
@chatgpt-codex-connector

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 🔄 Running since 2026-10-21T17:16:53.399492Z 1863634 PR opened
ℹ️ 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.

…ndow

Luna round 1 P2: the midnight rollover timer (armed from DateTime.now()) can
fire inside a measured 5-tick window on the fake clock, rebuilding the page
shell and with it the clock element, so the exact count of five could read six.
The clock now only has to tick each second; the shell bound (at most one
rebuild per window) carries the per-tick amplification guard.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Luna review round 1: SHIP (infra/rollout/bin/review.sh 23076).

  • P2 (fixed, 0bfe5a3): the tick guard required LiveEpisodeClock to rebuild exactly five times, but a midnight rollover (a real Timer armed from DateTime.now(), fired on the fake clock) landing in the window rebuilds the page shell and the clock element with it. The clock now only has to tick each second; the shell bound (≤ 1 rebuild per window) carries the per-tick amplification guard.
  • minor (deferred): the "no idle scheduleTask under a continuous animation" rule is in performance.md and the new failure class, not in check_mobile_ui_isolate.py. The widget test guards this Home path only. Adding a scheduleTask-below-Priority.animation hit to the ratchet is a small follow-up to the checker and its tests; kept out of this fix PR.

@Git-on-my-level
Git-on-my-level merged commit 6e6a8f2 into main Oct 21, 2026
44 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/scroll-jank branch October 21, 2026 18:03
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
## What changed and why

Home title rendering could stall long enough for iOS to terminate the
app during a scene update. Build 1.0.571 (1433), sourced from
`8015f02c`, reports `EXC_CRASH / SIGKILL`, FRONTBOARD `0x8BADF00D`,
after exhausting a 10-second scene-update allowance.

UUID-matched App.framework and Flutter.framework dSYMs resolve the
sampled stack to `CharacterRange::Canonicalize -> RegExpParser ->
String.replaceAll -> repairPass (note_citations.dart:106) ->
repairNoteCitations -> presentableNoteTitle -> conversationRowTitle ->
ConversationListItem` during `WidgetsBinding.drawFrame`. The native
timer is the engine frame/vsync timer. This snapshot does not show
`SchedulerBinding._runTasks`; #23076 fixes a separately reproduced
idle-task spin.

Citation repair now reuses fixed Unicode speaker patterns and skips
per-ID Unicode boundary pattern construction when the literal ID is
absent. Rendering an ordinary short title previously compiled patterns
for every ID in its transcript, even though none appeared in the title.
Citation output and stored data remain unchanged.

## Product invariants affected

INV-PERF-1: remove repeated Unicode regexp compilation from the
title-rendering path. The new shared contract regression covers a long
transcript on each row.

Failure-Class: new

UI-Evidence: none -- presentation utility optimization, with existing
title rendering and citation parity tests preserved; no widget layout or
visible copy change.

## Verification

- 88 targeted Flutter tests passed: citation contract, title/fallback
behavior, list-row isolation, and detail-title rendering. New cases
cover overlapping literal IDs, BMP/astral Unicode boundaries and Arabic
digits in speaker labels.
- Identical synthetic host workload (30 short titles, 1500 IDs each):
old implementation **9.915 seconds**, fixed implementation **11.4
milliseconds**. The old implementation fails the new 3-second coarse
watchdog-class budget; the fixed implementation passes. These are host
measurements, not iPhone frame times.
- Full citation contract fixtures, protected Markdown/code/link cases
and title bracket preservation remain green.
- Native evidence identifies the expensive sampled path; physical-device
acceptance of the new binary remains required. No backend/listen
deployment is needed.

Crash artifacts contain private device metadata and remain outside Git.
This PR includes no raw crash report, production account data, user
identifiers, or credentials. Crashlytics access used `ro-prod`;
discovery-verified filters and full report view returned no issue groups
for builds 1431–1434, while an unfiltered positive control returned 25
groups. ASC also had no ingested incident submission; the device report
arrived directly.

`make preflight`: all 25 selected checks passed. Analyzer: no issues on
both changed Dart files. Independent Luna round 1 via
`infra/rollout/bin/review.sh`: SHIP, no P0/P1. Exact reviewed head:
`edf3fd773309358618fe757b30904b4536f72d80`.
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Prepares App Store release notes for the next stable 1.0.571 build,
covering pendant audio continuity, scrolling/freezes/crashes,
catching-up status on the Device page, and the live recording timer.
Follows the existing 1.0.568 release JSON format and omits the
beta-gated episodes UI.

Store submission is separately gated on the processed TestFlight build
containing #23076, #23054, and #23044, green tests/CI and tester
eligibility. Submission will use MANUAL release with no phased release;
David controls release. Android rollout is unchanged.

Validation: mobile changelog schema and derived iOS notes passed; 14
preflight checks passed. Independent Luna review: SHIP, no P0/P1;
applied its suggested wording for catch-up details and the per-second
live-page timer. GitHub CI must finish green at the final head before
merge.

Product invariants: no production behavior changes (release-note data
only).
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