Repository navigation
fix(macOS): stabilize Markdown transcript layout - #10471
Conversation
Replace MarkdownUI-backed live chat rendering with the Omi-owned value renderer, remove resize measurement feedback from the transcript, and keep table row layout bounded and copyable. Tests: AgentPillLifecycleTests (79 passed); ChatTimelineContinuityTests (37 passed); agent-logic-harness --cross-surface-smoke; swift-test-suites (373/374 suites passed, unrelated origin/main OnboardingFlowTests string-interpolation tripwire failed). Failure-Class: FC-selection-overlay-layout-loop
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 777c9a4627
ℹ️ 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".
| OmiMarkdown(text: displayConversation.overview, sender: .ai) | ||
| .textSelection(.enabled) |
There was a problem hiding this comment.
Preserve selection for conversation summaries
When this renderer is used on the Conversation Detail summary, the following .textSelection(.enabled) no longer restores selection because OmiMarkdown applies .textSelection(.disabled) inside its own body. The existing copy button only copies the transcript, not displayConversation.overview, so users can no longer select/copy summary text from this non-chat surface; use a selectable mode or keep the old selectable renderer here.
Useful? React with 👍 / 👎.
| let codeBgColor: Color = | ||
| style == .user | ||
| ? .white.opacity(0.15) | ||
| : OmiColors.backgroundTertiary |
There was a problem hiding this comment.
Treat onboarding code spans as light-surface content
For onboarding user bubbles, .onboardingUser sets the base foreground to backgroundPrimary for the white bubble, but this decoration branch only treats .user as the light-on-dark variant. When a user types inline code such as `Slack`, the code span gets a dark backgroundTertiary chip while keeping the dark onboarding foreground, making that text effectively unreadable; handle .onboardingUser with a light chip/background or include it in the user branch.
Useful? React with 👍 / 👎.
| XCTAssertFalse(rendererSource.contains("MarkdownUI")) | ||
| XCTAssertFalse(rendererSource.contains("GeometryReader")) | ||
| XCTAssertFalse(rendererSource.contains("anchorPreference")) |
There was a problem hiding this comment.
Annotate new source-inspection tripwires
This new batch of rendererSource.contains(...) assertions is source inspection, but there is no local omi-test-quality: source-inspection reason explaining the static contract. desktop/macos/AGENTS.md requires new source-inspection tripwires to carry that local reason and to supplement, not replace, behavioral coverage, so add the annotation or convert the checks to behavioral assertions.
AGENTS.md reference: desktop/macos/AGENTS.md:L180-L186
Useful? React with 👍 / 👎.
## 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
## What changed and why Replace MarkdownUI-backed live chat content with a pure Omi-owned Markdown renderer and remove the transcript resize-measurement feedback loop that could pin the macOS main thread after rendering tables, scrolling, or resizing the window. Tables now use bounded Grid layout with full-height zebra row shading and retain explicit table, code-block, and message copy actions. ## Product invariants affected - INV-CHAT-1 ## How it was verified - Captured live stable, Beta, and named-bundle hangs. Samples consistently pinned the main thread in SwiftUI/AppKit text-selection or geometry/lazy-layout re-entry (`SelectionOverlay`, `GeometryReaderLayout`, and `LazyVStack`). - Built and launched `/Applications/omi-markdown-renderer.app` against development services. Its strict code signature passed, the automation bridge was owner-ready, and agent runtime protocol v2 was live. - The user confirmed the renderer-only build no longer froze while scrolling; a later resize repro exposed the remaining viewport-state feedback loop fixed by this commit. - `desktop/macos/scripts/agent-logic-harness.sh --cross-surface-smoke` passed its Swift, agent, and Rust contract gates. - `desktop/macos/scripts/swift-test-suites.sh` passed 373 of 374 isolated suites. The sole failure is the current `origin/main` `OnboardingFlowTests` source tripwire expecting a literal `\(title)` in `SBOnboardingView.swift`; this PR does not modify either file. - `desktop/macos/scripts/check_desktop_test_quality.py` passed. ## Tests - `AgentPillLifecycleTests`: 79 passed, including Omi Markdown parsing, streaming convergence, repeated 620–1100 pt transcript resizing, copy controls, and absence of geometry/selection feedback. - `ChatTimelineContinuityTests`: 37 passed, including the shared chat-selection boundary. ## Failure class (fixes) Failure-Class: FC-selection-overlay-layout-loop <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10471?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
What changed and why
Replace MarkdownUI-backed live chat content with a pure Omi-owned Markdown renderer and remove the transcript resize-measurement feedback loop that could pin the macOS main thread after rendering tables, scrolling, or resizing the window. Tables now use bounded Grid layout with full-height zebra row shading and retain explicit table, code-block, and message copy actions.
Product invariants affected
How it was verified
SelectionOverlay,GeometryReaderLayout, andLazyVStack)./Applications/omi-markdown-renderer.appagainst development services. Its strict code signature passed, the automation bridge was owner-ready, and agent runtime protocol v2 was live.desktop/macos/scripts/agent-logic-harness.sh --cross-surface-smokepassed its Swift, agent, and Rust contract gates.desktop/macos/scripts/swift-test-suites.shpassed 373 of 374 isolated suites. The sole failure is the currentorigin/mainOnboardingFlowTestssource tripwire expecting a literal\(title)inSBOnboardingView.swift; this PR does not modify either file.desktop/macos/scripts/check_desktop_test_quality.pypassed.Tests
AgentPillLifecycleTests: 79 passed, including Omi Markdown parsing, streaming convergence, repeated 620–1100 pt transcript resizing, copy controls, and absence of geometry/selection feedback.ChatTimelineContinuityTests: 37 passed, including the shared chat-selection boundary.Failure class (fixes)
Failure-Class: FC-selection-overlay-layout-loop