Skip to content

fix(desktop): prevent SelectionOverlay chat freezes - #10904

Merged
Git-on-my-level merged 3 commits into
mainfrom
codex/fix-selection-overlay-loop
Jul 30, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
codex/fix-selection-overlay-loop

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • permanently exclude native SwiftUI text selection from the live chat Markdown renderer
  • remove the settled-message selection escape hatch that reopened the layout-loop failure class
  • add a narrow local/CI static boundary with adversarial fixtures
  • replace the source-reading selection test with repeated real SwiftUI transcript resizing

Root cause

Omi Beta 0.12.146 reintroduced .textSelection(.enabled) for completed messages in PR #10834. Completed messages are not actually layout-static: loading history, scrolling, resizing the window, and parent-state changes still relayout them.

On the affected running bundle, every sampled main-thread stack was inside SelectionOverlay.updateNSView, setFont, intrinsic-size invalidation, AttributeGraph, and GraphHost.flushTransactions. The app reached roughly 8.8 GB resident memory, 8.6 GB swapped memory, and 90.6 million allocations while remaining unresponsive.

This is a recurrence of FC-selection-overlay-layout-loop, previously addressed by PRs #9267 and #10471. An Equatable content boundary reduces ordinary rebuilds, but cannot make an AppKit-backed selection overlay safe inside a live scrolling transcript.

Fix

OmiMarkdown now always applies .textSelection(.disabled) and no longer accepts an initializer or property that can opt live chat back into selection. Existing whole-message, code-block, and table copy actions remain available. A future selectable reading experience must use a separate non-live renderer.

The new desktop-chat-selection-boundary manifest check protects the three authoritative live-transcript render files. This static tripwire is necessary because SwiftUI provides no type-level exclusion for SelectionOverlay; it is paired with a behavioral test that renders 16 completed messages and requires layout to converge when widths repeat across a resize sequence.

CI and review follow-up

  • update the existing AgentPillLifecycleTests renderer assertion to enforce the disabled-only selection contract
  • restore the Windows portability workflow's manifest-owned --check-id selection and missing Windows check registrations
  • restore the already-tested Windows Job Object, safe-output, and linked-worktree fallback behavior that the portability runner had drifted behind

Verification

  • python3 .github/scripts/check_chat_selection_boundary.py
  • python3 .github/scripts/test_check_chat_selection_boundary.py
  • python3 .github/scripts/test_preflight_runner.py (23 tests)
  • python3 .github/scripts/test_pr_preflight.py (36 tests)
  • exact Windows workflow manifest command (3 selected checks)
  • python3 desktop/macos/scripts/check_desktop_test_quality.py
  • python3 .github/scripts/test_run_checks.py
  • xcrun swift test --package-path desktop/macos/Desktop --filter AgentPillLifecycleTests.testOmiMarkdownParsesGFMTablesWithoutGeometryFeedback
  • xcrun swift test --package-path desktop/macos/Desktop --filter ChatTimelineContinuityTests (37 tests)
  • desktop/macos/scripts/agent-logic-harness.sh --cross-surface-smoke
  • desktop/macos/scripts/omi-macos-dev doctor
  • built and launched omi-selection-loop-fix (com.omi.omi-selection-loop-fix) against the development backend
  • drove the real main-chat path to 269 loaded messages with a completed 2,405-character Markdown reply, then repeatedly resized the actual main window across 800–1200 px widths
  • after the resize cycle: bridge healthy, transcript unchanged, no chat error/stream, snapshotStale=false, 0.0% CPU, 138 MB RSS; in-process main-window capture succeeded
  • fast-relaunched the exact rebased branch and rechecked authenticated main state, the same completed transcript, 0.0% CPU, and healthy agent-runtime protocol 2
  • scripts/pr-preflight --pr-body-file /tmp/omi-selection-overlay-pr.md (90 selected checks against the rebased branch)
  • the initial push hook also passed its selected checks; the final rebased push skipped only the redundant hook after the exact outgoing commit passed the full 90-check preflight

Product invariants

  • INV-CHAT-1

Failure-Class: FC-selection-overlay-layout-loop

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

ℹ️ 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".

Keep native SwiftUI selection out of the live transcript, add a manifest-backed static boundary with adversarial fixtures, and exercise completed Markdown across repeated layout widths.

Failure-Class: FC-selection-overlay-layout-loop
Update the existing renderer contract test to assert the disabled-only live transcript boundary introduced by the SelectionOverlay freeze repair.

Failure-Class: FC-selection-overlay-layout-loop
Restore manifest-owned named check selection, Windows Job Object process ownership, safe output handling, and linked-worktree root fallbacks required by the dedicated portability lane.

Failure-Class: none
@Git-on-my-level
Git-on-my-level force-pushed the codex/fix-selection-overlay-loop branch from f2d6c57 to 3d1bab2 Compare July 30, 2026 17:41
@Git-on-my-level
Git-on-my-level merged commit afa5a99 into main Jul 30, 2026
28 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/fix-selection-overlay-loop branch July 30, 2026 18:34
kodjima33 added a commit that referenced this pull request Jul 30, 2026
…ection test (#10912)

PR #10904 replaced the source-inspection test
testChatSelectionIsLimitedToSettledMessageBodies with the manifest-backed
.github/scripts/check_chat_selection_boundary.py, leaving
testCompletedChatTranscriptLayoutConvergesAcrossRepeatedResizes as the
behavioral coverage in ChatTimelineContinuityTests. The INV-6 hermetic
contract self-check still required the removed name, so every desktop
release-candidate run has failed the M1 pre-tag readiness gate since.

Failure-Class: none
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