Skip to content

fix(macOS): stabilize Markdown transcript layout - #10471

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/fix-macos-markdown-resize-freeze
Jul 24, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/fix-macos-markdown-resize-freeze

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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

Review in cubic

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
@Git-on-my-level
Git-on-my-level merged commit 2b387ca into main Jul 24, 2026
27 of 33 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/fix-macos-markdown-resize-freeze branch July 24, 2026 07:03

@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: 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".

Comment on lines +842 to 843
OmiMarkdown(text: displayConversation.overview, sender: .ai)
.textSelection(.enabled)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +169 to +172
let codeBgColor: Color =
style == .user
? .white.opacity(0.15)
: OmiColors.backgroundTertiary

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +1647 to +1649
XCTAssertFalse(rendererSource.contains("MarkdownUI"))
XCTAssertFalse(rendererSource.contains("GeometryReader"))
XCTAssertFalse(rendererSource.contains("anchorPreference"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Git-on-my-level added a commit that referenced this pull request Jul 30, 2026
## 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
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
## 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. -->
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