fix(mobile): throttle streaming thread visit updates - #9931
Conversation
|
Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies. |
3ffe845 to
9d459a6
Compare
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, isolated mobile fix that throttles redundant thread-visit writes while preserving immediate updates for navigation and completed runs. Its behavior matches the established web implementation and has no schema, infrastructure, security, billing, or default-setting impact. You can add or adjust custom eligibility rules. Learn more. |
…apping' into landing/pr-9931
There was a problem hiding this comment.
reviewed diff and relevant surrounding code at 5c4609f5eb0948f5c5e6c1d61834e240b958eee3. no blocking findings.
the effect keeps a trailing newest watermark, bypasses the throttle for unseen completion/thread changes, and cancels pending work when content hides. isolated execution of the actual effect callback passed initial dispatch, trailing update, completion, thread switch, hidden cleanup and dedupe checks with mocked clock/command. no code changes needed. this was not a mounted react or native-device test.
ci snapshot: no failing or pending checks; some checks are skipped. this is a comment review, not an approval or merge.
Every thread
updatedAtchange previously sent a visit command from React Native. Apply the web client’s ten-second trailing throttle, retaining the latest watermark. Navigation to another thread and an unseen completion still dispatch immediately; cleanup cancels a pending timer when selection changes or content hides.Measured at persisted
thread.visitedevents on one isolated iPhone 16 Pro simulator (iOS 26.5), with one burst per revision: 20 realthread.metadata.updatecommands at approximately 250 ms intervals over five seconds. Both runs used the same visible thread and disposable V2 server.ThreadDetailScreen.tsxfromb9fa1399c)9d459a6bb, integrated atfa6a1ab04)This measures write volume and dispatch spacing, not rendering speed. Title updates provide a controlled source of
updatedAtchanges; this was not a timed provider-token stream. The shared native Debug build exited 0; only the JavaScript bundle changed. The integrated candidate also includes #9929, explaining the visible file chip in the after recording.Before: clean recording · Before: annotated recording
After: clean recording · After: annotated recording
Recordings preserve original timing (before 29.53 s; after 53.63 s), with no idle trimming or speed changes. Captions report the stored-event measurements; the videos do not display a request counter. These caption-only recordings were visually inspected; the interaction-packet validator requires tap/swipe events and was not applicable.
Before/after stills
React Native typecheck and targeted lint passed in frozen integration verification. Android was not separately exercised. Targets Julius’s Orchestrator V2 branch in #2829; this changes only React Native.
A direct Claude Opus 5 high review attempt exited 1 because OAuth expired before model execution; no Claude review occurred. Implemented and verified with GPT-6 in Codex/T3.
Note
Low Risk
Scoped to mobile visit-dispatch timing and unread-marker behavior; reduces server write volume without changing auth or data models.
Overview
Mobile thread “visited” writes no longer fire on every
updatedAttick during streaming.ThreadDetailScreennow matches the web client’s 10-second trailing throttle, so rapid metadata updates coalesce into spaced visit commands while still persisting the latest watermark.Visit recording is skipped when thread content is hidden (
showContent). Immediate dispatch still happens when switching threads, when there is an unseen run completion (latestRun.completedAtafterlastVisitedAt), or when the throttle window has elapsed; otherwise a timer defers the write and clears on unmount or dependency changes (e.g. thread switch).Reviewed by Cursor Bugbot for commit 9d459a6. Bugbot is set up for automated code reviews on this repo. Configure here.
Current-base verification
Updated to exact V2 base
415ed0f73b97f1655b6282492f81d0b2bba3a9ccat headfd24ed3442c2d65721d08725b4da16201c31f58c. The original leaf plus this base synthesizes cleanly as tree707816c8e075d4d622f78e2163eba31ce2ef45f8; current V2 base still dispatches a visit for every eligibleupdatedAtchange, so the throttle is not superseded.ThreadDetailScreen.tsxpredate the visit-throttle hunk.The existing iPhone simulator write-volume evidence remains bound to the stated patch-identical revision. No fresh native run or Android measurement was performed; parent integration owns current-client proof. Fresh independent Claude review remains unavailable because OAuth is signed out; no Claude review is claimed. Refreshed by GPT-6 in the Codex harness.
Note
Throttle streaming thread visit updates in
ThreadDetailScreenThreadDetailScreennow only sends visit-watermark updates while screen content is shown.latestRunCompletionTimestampin ThreadDetailScreen.tsx.Macroscope summarized fd24ed3.