Skip to content

Desktop Swift lane: 3 suites SIGSEGV on CI only (AgentPill, ChatTimelineContinuity, MarkdownNestedScroll) — the remaining blocker after #11563 #11573

Closed

Description

@kodjima33

Three desktop Swift suites die with error: Exited with unexpected signal code 11 on the CI runner, and they are what keeps Desktop Swift Static & Test Contracts red after #11563's assertion failures are fixed:

  • AgentPillLifecycleTests
  • ChatTimelineContinuityTests
  • MarkdownNestedScrollTests

Identical on branches that share no commits: run 31795097198 (security/transport-egress), 31778872737 (#11553), 31779149249 (#11559), 31809160446 (#11571). So #11563 undercounted the lane: it is 7 failing suites, not 3 — four assertion suites (fixed in #11571) plus these three crashers, which predate all of it.

Two things say this is not an ordinary assertion bug:

  1. The crash point moves between runs. ChatTimelineContinuityTests died in testBackgroundAgentSummaryParsesLinkedAndLegacyCompletionText at 07:48 and 14:00, and in testCompletedChatTranscriptLayoutConvergesAcrossRepeatedResizes at 15:00. A deterministic bad pointer in one test would not wander.
  2. All three pass locally. Driving the built bundle directly — xcrun xctest -XCTest Omi_ComputerTests.MarkdownNestedScrollTests <bundle> — gives 2/2 passed, 0 failures, clean exit. Same for the other two.

All three are AppKit/rendering-heavy suites, and swift-test-suites.sh runs suites two at a time (Ran 603 Swift suites in isolation with 2 worker(s), 300s per-suite budget), so the first thing worth ruling out is contention or a windowserver/graphics resource limit on the runner rather than a defect in any one test.

What the next person needs and I could not get from the outside: the runner's crash report (~/Library/Logs/DiagnosticReports/*.ips for xctest) for one of these processes. The Actions log keeps only the signal, no backtrace, so there is nothing to diagnose from the log alone. Worth capturing that as a step in the lane on failure regardless — a crasher that only reproduces on CI is otherwise undebuggable.

Until this is resolved, no desktop PR can show a green lane, and #11571 (which takes the other four suites from 77 assertion failures to 0) is blocked behind it.

Activity

  1. added
    bug
    on Aug 14, 2026
  2. kodjima33 commented on Aug 14, 2026

    @kodjima33
    CollaboratorAuthor

    The crash point does not wander — it is the same three tests every run

    The "wandering" evidence is a log artifact. error: Exited with unexpected signal code 11 is SwiftPM's stderr, spliced into the middle of a buffered stdout line, so it lands next to whatever line happened to be flushing. In run 31809160446 you can see it cut a line in half:

    Test Case '-[...AgentPillLifecycleTests terror: Exited with unexpected signal code 11
    estHydratedPillUsesKernelProviderIdentityForRendering]' passed (0.002 seconds).
    

    That test passed. The real crash site is the last test that starts and never reports a result. Reconstructing that (match started against passed/failed) across the three runs cited in this issue — 31778872737 (kodjima33/idle-media-playback, 07:09Z), 31795097198 (security/transport-egress, 11:09Z), 31809160446 (#11571, 14:22Z) — gives an identical answer all three times:

    Suite Test the process dies in
    AgentPillLifecycleTests testOmiMarkdownLongTranscriptCanRepositionAcrossTables
    ChatTimelineContinuityTests testCompletedChatTranscriptLayoutConvergesAcrossRepeatedResizes
    MarkdownNestedScrollTests testWideMarkdownTableMountsAHorizontalScroller

    So this is deterministic, not a scheduling-dependent moving target — which rules out the 2-worker contention / windowserver-resource hypothesis this issue leads with.

    It is one crash, not three

    All three crash sites are the same shape: an NSHostingView rendering OmiMarkdown forced through AppKit layout (layoutSubtreeIfNeeded() / fittingSize) with a SwiftUI ScrollView inside.

    • testOmiMarkdownLongTranscriptCanRepositionAcrossTables — ScrollViewReader { ScrollView { LazyVStack { OmiMarkdown } } }, 8 resize/scroll iterations, fittingSize each time
    • testCompletedChatTranscriptLayoutConvergesAcrossRepeatedResizes — ScrollView { LazyVStack { OmiMarkdown } }, 6 widths, fittingSize each time
    • testWideMarkdownTableMountsAHorizontalScroller — OmiMarkdown table, whose own body is ScrollView(.horizontal) { Grid }, laid out in an ordered window

    Fix the one layout crash and all three suites come back.

    Why it "passes locally" — the toolchain differs, the code may not be fine

    CI is macos-15 with pinned Xcode 16.4 (swift-testing 124.4 in the log). Both maintainer machines here are macOS 26.4 / Xcode 26.4 (swift-testing 1743). I ran all three suites at 7d7ed62e57 on macOS 26.4:

    MarkdownNestedScrollTests     Executed  2 tests, 0 failures
    ChatTimelineContinuityTests   Executed 37 tests, 0 failures
    AgentPillLifecycleTests       Executed 84 tests, 1 failure  (testSharedChatMessagesOpenAndSendFollowLatest — an assertion, unrelated, and not seen on CI)
    

    No crash — but that is a different SwiftUI runtime, so it is not evidence the code is correct. There is no macOS 15 machine available here, so this cannot be reproduced or fixed locally; CI is currently the only environment that can prove a fix.

    Two things this changes

    1. This may be a live product crash, not a CI-only defect. A deterministic SIGSEGV laying out OmiMarkdown on macOS 15 means macOS 15 users could be crashing when chat renders a markdown table or a long transcript. Worth a Sentry check for SIGSEGV in SwiftUI layout on 15.x before anyone treats this as test-infra.
    2. Suspects are recent OmiMarkdown layout changes, not 15a51fb985 (which never touches markdown). Nearest candidates: 0b23924e23 "add half a line of space between chat lines" (2026-08-14 04:42Z — rewrote every markdown text path onto OmiMarkdownChatText and added lineSpacing / VStack spacing, including the table cell) and 00cc9ed9d6 "clickable source citations" (2026-08-13 22:41Z). I could not bisect this: every desktop-lane run I found older than those died at compile time before reaching the suites.

    The .ips capture asked for above is still the right next step — with the crash localised to three known tests, one run with ~/Library/Logs/DiagnosticReports/*.ips uploaded on failure should be enough to name the frame.

    🤖 automated by the hourly desktop watchdog — analysis only, no code change

  3. kodjima33 commented on Aug 14, 2026

    @kodjima33
    CollaboratorAuthor

    Follow-up on my earlier comment — two corrections and a severity downgrade, all from CI run 31809160446 plus the code at ce7a1efca9.

    1. It is not about tables. I previously described the three crash sites as one shape involving markdown tables. That is wrong for one of them: ChatTimelineContinuityTests/testCompletedChatTranscriptLayoutConvergesAcrossRepeatedResizes renders no table at all (bold text, inline code, a bullet list) and creates no NSWindow — it only sets host.frame. So neither "table" nor "ordered window" is the invariant.

    2. OmiMarkdown rendering alone does not crash — which largely exonerates 0b23924. OmiMarkdownLineSpacingTests ran in the same 603-suite pass and did not fail. It drives OmiMarkdown through the identical AppKit-forced measurement the crashers use — NSHostingView → layoutSubtreeIfNeeded() → fittingSize (OmiMarkdownLineSpacingTests.swift:36-44) — on the same macOS 15 / Xcode 16.4 runner. Its only structural difference from the three crashers is that there is no SwiftUI ScrollView in the hierarchy. Since that suite is the regression test 0b23924 shipped for its own rewritten text paths (OmiMarkdownChatText, the .lineSpacing additions), "the line-spacing commit changed the markdown text paths" is not sufficient to explain the SIGSEGV.

    3. What actually discriminates. Only five suites in the whole test tree put a SwiftUI ScrollView inside an NSHostingView: AgentPillLifecycleTests, ChatTimelineContinuityTests, MarkdownNestedScrollTests, ChatTranscriptGestureHarnessTests, QueryComposerTests. Three of those five are exactly the crashers. The two that pass either mount no OmiMarkdown in the scroller (QueryComposerTests) or carry an XCTSkip for the non-active-app CI environment (ChatTranscriptGestureHarnessTests.swift:464). So the working invariant is NSHostingView + SwiftUI ScrollView containing OmiMarkdown, driven through AppKit layout — not tables, not the text paths on their own.

    4. Severity: probably not a live user crash (UNVERIFIED). My earlier comment suggested checking Sentry because this might be a production macOS 15 crash. Reading the production sources, I now think that is unlikely: the only layoutSubtreeIfNeeded/fittingSize callers under Desktop/Sources are ViewExporter.swift:734 (the dev-only design PNG/PDF export, which sets an explicit frame) and DesktopAutomationBridge.swift:4409. Production chat hosts its ScrollView in a sized window and never asks AppKit to measure it. This is inference from code, not proof — I cannot run macOS 15 (both available machines are macOS 26.4) — so a Sentry query is still worth one minute from someone who has access; this host has no SENTRY_AUTH_TOKEN, and the desktop/scripts/sentry-*.sh helpers referenced in older notes do not exist in the repo.

    5. Next decisive experiment. A ~5-line repro — NSHostingView(rootView: ScrollView { OmiMarkdown(text:…) }) then layoutSubtreeIfNeeded() — should crash on macOS 15 / Xcode 16.4 and pass on macOS 26. PR #11585 landed workflow_dispatch on Desktop Swift CI, so this can now be bisected without an unrelated commit. I did not queue it this hour: the macos-15 pool is roughly four hours deep (run 31815707051, queued 15:41Z, was still in_progress at 19:35Z), and adding jobs would push the release train back further.

    🤖 hourly watchdog — analysis only, no code change.

  4. kodjima33 commented on Aug 14, 2026

    @kodjima33
    CollaboratorAuthor

    It is a stack overflow, not a bad pointer

    #11589 merged (9a4213ad00) and its first real run on macos-15 produced the artifact this issue has been asking for since it was filed — the runner's crash report, printed next to the failing suites in run 31841836995:

    Signal-killed Swift suites: AgentPillLifecycleTests ChatTimelineContinuityTests MarkdownNestedScrollTests
    --- CRASH REPORT: /Users/runner/Library/Logs/DiagnosticReports/xctest-2026-08-14-214006.ips ---
    

    The decisive fields:

    "exception": { "type": "EXC_BAD_ACCESS", "signal": "SIGSEGV",
                   "subtype": "KERN_PROTECTION_FAILURE at 0x000000016d5bbfb0",
                   "codes": "0x0000000000000002, 0x000000016d5bbfb0" },
    "faultingThread": 0,
    "vmRegionInfo": "0x16d5bbfb0 is in 0x169db8000-0x16d5bc000; bytes before end: 79
       ---> STACK GUARD  169db8000-16d5bc000  [56.0M] ---/rwx  stack guard for thread 0
            Stack        16d5bc000-16ddb8000  [8176K] rw-/rwx  thread 0"

    Read the addresses: thread 0's stack is 0x16d5bc000–0x16ddb8000 (8 MB, growing down). The faulting address 0x16d5bbfb0 is 80 bytes below the bottom of that stack, inside the guard region, and the access is a KERN_PROTECTION_FAILURE (code 0x2 = write to a protected page).

    That is not a wild pointer landing somewhere arbitrary — a corrupt pointer does not reliably land in the 80 bytes immediately past the stack limit on three different suites. The main thread ran out of stack. Unbounded (or near-unbounded) recursion in SwiftUI layout, on macOS 15.7.7 (24G720) / Xcode 16.4 xctest, VirtualMac2,1.

    What this rules out and what it points at

    • Ruled out: the 2-worker contention / windowserver resource-limit hypothesis this issue leads with, and the "dangling reference in a recently-changed OmiMarkdown text path" framing from my earlier comments. Neither produces a guard-page write on thread 0.
    • Consistent with the invariant established last hour: NSHostingView + a SwiftUI ScrollView containing OmiMarkdown, driven through AppKit layout (layoutSubtreeIfNeeded() / fittingSize). Asking AppKit to measure a host whose content is a ScrollView means resolving an ideal size for a view that is defined as unbounded in the scroll axis. On the macOS 15 SwiftUI runtime that measurement re-enters itself; on macOS 26 it does not, which is exactly why all three suites pass on both maintainer machines (26.4) and die only on CI.
    • OmiMarkdownLineSpacingTests remains the control: same NSHostingView → layoutSubtreeIfNeeded() → fittingSize path, same runner, no ScrollView, passes. The ScrollView is the recursion, not the markdown.

    So the fix direction is to break the layout recursion by bounding the proposal — give the host a concrete width (and, where the test is really asserting content height, measure the content rather than the scroller) — not to hunt a memory bug in OmiMarkdown.

    One gap, and how to close it

    The frames themselves are still missing: GitHub truncated the step log partway through the report, right after "faultingThread": 0 and before the threads array. That truncation is itself corroboration — a stack-overflow .ips carries thousands of recursive frames, which is what blew the log budget.

    The follow-up is small and obvious: dump_crash_reports() in desktop/macos/scripts/swift-test-suites.sh should print the report's exception / vmRegionInfo / faultingThread summary plus the first N unique frames instead of cat-ing the whole file. One repeating frame group is all anyone needs to name the recursion; the other 100k lines are the same frames over and over. I did not ship that this hour — the macos-15 pool is hours deep and I could not have verified it in-run, and the release train is already waiting on this lane.

    Why this still matters even though it is probably test-only

    The severity downgrade in my previous comment stands: production hosts chat in a sized window and never asks AppKit to measure the scroller (the only layoutSubtreeIfNeeded/fittingSize callers under Desktop/Sources are ViewExporter.swift:734 and DesktopAutomationBridge.swift:4409). But the lane is what wedges shipping: Build Desktop Release Candidate has failed on every hourly run today with

    Desktop candidate source gate blocked: required check Desktop Swift Build & Tests for exact source SHA 519cf00ba8… completed with failure.

    Seven suites are red on main — these three plus GlassSurfaceReviewRegressionTests, ProactiveLaneClientTests, RewindSurfaceLayoutTests, ShellModalScrimDismissTests (whose fixes were CI-proven in #11571 and never landed). No desktop release can be cut until all seven are green.

    🤖 hourly desktop watchdog — evidence from the merged CI capture; no product code changed.

  5. kodjima33 commented on Aug 15, 2026

    @kodjima33
    CollaboratorAuthor

    Root cause: a cycle in the static view-type graph — fix in #11596

    The backtrace was in the run log all along; gh run view --log truncates the .ips payload at "faultingThread": 0 and drops the threads array. Pulling the raw log archive (gh api .../actions/runs/31846400544/logs) recovers it. 511 frames, one repeating unit:

    static _ConditionalContent<>._viewListCount(inputs:)
    protocol witness for static View._viewListCount(inputs:) in conformance <> _ConditionalContent<A, B>
    static Group<A>._viewListCount(inputs:)
    protocol witness for static View._viewListCount(inputs:) in conformance <A> Group<A>
    static View._viewListCount(inputs:)
    protocol witness for static View._viewListCount(inputs:) in conformance OmiMarkdownContent
    ...
    protocol witness for static View._viewListCount(inputs:) in conformance OmiMarkdownCitationContent
    

    Frame counts across the captured window: _ConditionalContent 128, Group 64, OmiMarkdownContent 32, OmiMarkdownCitationContent 32.

    View._viewListCount(inputs:) is resolved statically, from view types, and never evaluates a body. So this is not a layout loop and not a value-dependent recursion — it is a cycle in the view-type graph:

    • OmiMarkdownContent.body reaches OmiMarkdownCitationContent through textView(_:) and through OmiMarkdownTableView.
    • OmiMarkdownCitationContent's mask-failure fallback named OmiMarkdownContent (OmiMarkdown.swift:1017).

    One back-edge, two cycles. Because the walk is type-driven, it recurses whether or not that fallback branch ever executes — which is why the bug survived every value-level hypothesis.

    Corrections to my earlier comments in this thread

    • "Probably not a live user crash" (2026-08-14T20:04Z) was wrong. I based that on fittingSize callers, but _viewListCount is not tied to fittingSize — it is driven by the container asking for a static count. ChatMessagesView.scrollContent is ScrollView -> VStack -> ChatBubble -> OmiMarkdown(citations:), the same shape. A macOS 15 user on a build carrying feat(desktop): add clickable source citations #11519 is exposed.
    • The 2-worker contention / windowserver hypothesis this issue leads with is dead. A guard-page write on thread 0 is a stack overflow, not resource contention.
    • 0b23924e23 (line spacing) is exonerated, as suspected last hour. The actual origin is 00cc9ed9d6 — "feat(desktop): add clickable source citations (feat(desktop): add clickable source citations #11519)" (David Zhang, 2026-08-13) — which introduced OmiMarkdownCitationContent and its fallback edge.
    • The "NSHostingView + ScrollView containing OmiMarkdown" invariant from last hour holds and is now explained: the scroll container is what forces the static count, which is why OmiMarkdownLineSpacingTests (same AppKit measurement, no ScrollView) never crashed.

    Fix

    #11596 erases the single back-edge with AnyView, which resolves its list count dynamically and terminates the static walk, leaving the graph acyclic.

    Verified locally by running the full 608-suite desktop set twice on 9a4213ad00, once with the fix and once with it stashed: identical failure sets (the same 7 pre-existing macOS-26 failures), so no regression. The crash itself does not reproduce on macOS 26, so the macos-15 lane on #11596 is the authority.

  6. undivisible commented on Aug 20, 2026

    @undivisible
    Collaborator

    Closing per automated triage (2026-08-20): verified fixed: #11596 OmiMarkdown view-type cycle broken. See /tmp/omi-issue-triage.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions