Reduce typing latency in large busy workspaces
Summary
- suspend hidden terminal renderer work and bound hidden workspace mounting
- share process snapshots across port, memory, task, and agent scans; remove obsolete pane-memory polling
- batch mobile, focus-menu, and Git result invalidations
- single-flight Git snapshots and deduplicate pull-request refresh work
- add opt-in Release counters for process, Git, pull-request, and mobile owners, plus renderer signposts
Browser focus ownership is retained as correctness support for hidden browser view unmount/remount. It is not presented as a performance improvement.
Profile evidence
The one-minute Nightly typing capture contained 28 workspaces, 38 panes, and 55 surfaces:
- hidden or offscreen renderers contributed at least 178,711 samples, 86.36% of renderer activity
- the port scanner existed for 96.59% of the capture;
scanAgentPortsoccupied 29,368 samples and repeatedly invoked process enumeration andlsof - background Git work accumulated 34,694 samples; main-thread Git apply occupied 1,397 samples and PR scheduling was nested in 1,195 samples
- mobile workspace observation occupied 1,400 samples, 18.04% of active main-thread time
These captures identify owners and justify candidate fixes. They do not yet prove end-to-end improvement.
Scope audit
Removed after independent review because the captures did not justify them:
- scoped
report_pwdscheduling - remote orphan cleanup
- workspace-save snapshotting
- portal and Bonsplit geometry deduplication, whose isolated A/B was inconclusive overall
An independent audit classified all 167 paths in the then-current net diff and found no remaining unrelated implementation. The six paths added afterward are isolated Git/PR owner diagnostics and regression tests required by independent review, bringing the current net diff to 173 paths. The branch history still shows the reverted experiments above because several commits mix retained compile fixes with later-trimmed hunks; the final verified net diff should be squash-merged rather than rewritten across those red/green test pairs.
Verification status
- exact source-attested Release baseline exists for
mainate634825742; candidate source is frozen at pushed heada9033b4014pending an exact Xcode 26.3 / macOS SDK 26.2 Release build - 27 focused app tests across process, listener-scan, mobile, and focus batching owners pass; the process proof passes 23 focused tests and independent review
- Git passes 90/90 and sidebar Git passes 63/63 in both Debug and Release; control-socket policy passes 20/20
- Git/PR cancellation regressions are recorded as a failing-test commit followed by the fix; independent review repeated the six focused tests 50 times and approved the result
- the full macOS app test build passes with zero occurrences of the two branch-introduced sendability warnings
- the offline harness passes syntax checking, strict type checking, and poisoned self-tests that reject subprocess launches, invalid measurement epochs, empty process captures, all-zero Git/PR evidence, counter drift, and invalid Git/PR causal relationships
- invalid trials have been rejected for stale agent prompts, lost scrollback seed state, and excessive ambient CPU rather than counted as results
- no valid matched baseline/candidate latency result exists yet
- this Mac's Xcode 26.6 / SDK 26.5 environment is intentionally rejected for the candidate because the baseline uses Xcode 26.3 / SDK 26.2; the candidate must come from a verified matching cloud host
- the earlier profile's Settings-open hypothesis remains unresolved and is scheduled for a controlled Settings-closed versus Settings-open trace
Draft blockers
- pass six comb and six balanced matched Claude Code/Codex typing trials
- prove process sharing, Git/PR coalescing, mobile batching, and hidden-renderer suppression with counters and Instruments
- complete the Settings-open A/B and address it only if reproduced
- pass required checks, autoreview, independent artifact verification, tagged preflight, and human dogfood
This PR remains a draft until those gates pass.
Summary by CodeRabbit
- New Features
- Added opt-in terminal renderer profiling and performance metrics diagnostics.
- Added shared process and port snapshot handling to improve diagnostic and agent detection workflows.
- Added reliable background workspace priming and filesystem event processing.
- Preserved text-editor selection across panel remounts.
- Bug Fixes
- Improved browser address-bar focus ownership and WebView handoff behavior.
- Improved Git pull-request refresh consistency during branch and source changes.
- Reduced stale terminal surface updates and retained occlusion state across recreation.
- Settings
- Removed the Runaway Memory Guardrail settings from Terminal preferences.