Repository navigation
fix(ios): chat stalls while typing and receiving background events - #187610
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR defers native model-menu construction and filters unrelated Gateway events before they enter iOS background listeners. Example: Typing a 97-character draft with 512 available models while five background sessions run agent turns.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this PR provides useful, distinct performance work with no actionable introduced defect found; exact-head CI remains in progress. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherShared SwiftUI composer controls turn the model catalog into menu choices, while iOS sidebar and operator listeners consume Gateway events to update sessions, settings, approvals, and Talk. flowchart LR
A[Model catalog] --> B[Deferred model menu]
B --> C[Composer controls]
D[Gateway events] --> E[Gateway actor filters]
E --> F[Sidebar listener]
E --> G[Operator listener]
Technical reviewBest possible solution: Retain this focused work reduction while treating broader physical-device transcript lag as separate work. Do we have a high-confidence way to reproduce the issue? The maintainer's alternating real-Gateway simulator runs reproduce eager grouping and unnecessary listener delivery on main; they do not establish a measurable typing-latency improvement. Is this the best way to solve the issue? The smallest complete repair reuses the existing deferred-view and filtered-subscription owners, preserves consumer contracts, and adds no cache or parallel rendering path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dec19a6acb83. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +37, Tests +100. Total +137 across 6 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 8, 2026, 11:01 AM ET / 16:01 UTC (Revision 2). |
|
Maintainer end-to-end check on an iPhone 17 simulator (iOS 27) against a real Gateway built from current Setup
Dropped frames and keystroke round-trip on the simulator were within run-to-run noise, so this doesn't claim a frame-rate gain. What it shows is that the work is gone: no model-list grouping per keystroke, and about 10× fewer frames reaching the main actor during background turns. Events a listener needs still arrive under load. I called Functional checks on this PR
Tests
Thanks @ben-milanko! pr-proof-typing-menu.mp4 |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…law#187610) Co-authored-by: ben-milanko <[email protected]>


Related: #124759
What Problem This Solves
Native chat can stall during typing and background session activity, including with an empty transcript or hidden tool activity.
User Impact
Removes unnecessary work competing with typing and scrolling while preserving model selection, sign-in, session refresh, settings, approvals and Talk behavior. This is a partial performance repair; it does not establish that all lag reported in #124759 is resolved.
Why This Change Was Made
Closed model menus eagerly group the full catalog while constructing composer controls. Their contents now use the existing deferred-content view. Sidebar and operator listeners filter their own event names on the Gateway actor before unrelated frames enter their bounded buffers or MainActor loops. Explicit cancellation releases replaced and stopped subscriptions; the sidebar's refresh-coordinator cleanup remains intact.
The original development-fork work also hoisted Home's alias lookup. That change is omitted here because #169197 already caches alias resolution on upstream. The port preserves current-main menu sign-in/disabled behavior and carries no development signing or build settings. One inherited empty-string assertion uses
isEmptyto pass the pinned lint check; the broader formatting-only changes from the fork are omitted.Evidence
Acceptance rule: constructing closed clean and full model pickers with 2,000 synthetic catalog entries must not observe projection-only favorites/recents; background subscriptions must retain their owner events after 500 unrelated frames exceed the 200-frame buffer. These are deterministic work/retention checks, with no wall-clock thresholds or inferred device speedup.
b367b1fd64d8daa5f91aa7a8a78b9a90f92d0df6, both new composer cases fail because changing favorites/recents invokes the observation callback. With the patch, both pass and the callback remains at zero. The candidate regression takes 0.121 seconds; no timing threshold is asserted.Prepared by Alder, Ben's AI assistant, on Ben's behalf.