Skip to content

fix(desktop): unblock the Swift test lane — 77 failures on every desktop PR (#11563) - #11566

Closed
kodjima33 wants to merge 3 commits into
mainfrom
watchdog/issue-11563-desktop-swift-lane-red
Closed

kodjima33 wants to merge 3 commits into
mainfrom
watchdog/issue-11563-desktop-swift-lane-red

Conversation

@kodjima33

@kodjima33 kodjima33 commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Bug

Desktop Swift Static & Test Contracts has been red on every desktop PR since 15a51fb985 (2026-08-14 02:10 EDT), so no desktop change could reach main and the release train had no qualification signal. main reads green only because the lane is path-filtered: Detect Desktop Swift Changes skips the test job on every commit that does not touch desktop/macos/**, so the red only appears on desktop PRs. Filed as #11563.

The failing set, identical across CI runs 31778872737 and 31779149249:

Suite Failures
ShellModalScrimTests 74
GlassSurfaceReviewRegressionTests 1
ProactiveLaneClientTests 2
ChatCitationTests 1

Root causes

1. 75 of the 77 — the hit-region marker paints. InkGlassHitRegionReporter mounts a zero-drawing AppKit marker so a transparent window can tell visible content from air. ImageRenderer cannot rasterise an NSViewRepresentable and substitutes an opaque placeholder for it, so every pixel-truth test of a surface that mounts one measured the placeholder covering the marker's whole host: the modal dim read as painting to the window's edge — which on this window is the user's wallpaper — and the glass panel's rounded corner read as filled. Measured directly: Color.clear.background(InkGlassHitRegionReporter()) rendered at 40×40 came back fully opaque (centre RGBA 255,56,60,255), where Color.clear alone is 0,0,0,0.

2. testLaterShorterRetryWindowDoesNotShortenActiveCooldown (ff974901b6) was never reachable. It issued its two 429s sequentially, but an armed cooldown short-circuits the network before the second request is built (as testExtractionSkipsNetworkDuringQuotaCooldownThenResumesAfterDeadline asserts), so the shorter Retry-After was never parsed and requestCount could not reach the 2 it asserted.

3. testRewindCitationFocusIsOneShotAndPreservesExactScreenshotID depended on a leaked global. RewindCitationFocusState.request refuses an id when RewindCaptureOwnerSnapshot.capture() is nil, and the only thing that makes it nil is RewindCaptureOwnerGeneration's suspended flag — which is process-global and outlives whichever suite suspended it. Class execution order is not stable across machines, which is the whole of the local/CI divergence: this one passes locally and has failed on CI since #11519.

Fix

  • Mount the marker at zero opacity. The placeholder then contributes no pixels, while the AppKit view stays mounted, unhidden and registered: SwiftUI applies opacity to the host layer, not to the view's own alphaValue, which is what InkGlassHitRegions.containsPoint reads. New InkGlassHitRegionReporterTests pins both halves — dropping the reporter would satisfy the paint half and silently return the shell to passing clicks through its own modals.
  • Overlap the two 429s on a rendezvous, which is the only way a second Retry-After for one operation is ever observed, so the max-deadline preservation the test is named for is actually exercised.
  • Start the citation-focus test from a clean fence and assert an owner exists, so it fails on the handoff it is named for or not at all.

No production behaviour changes: the only non-test edit is where the marker's opacity is applied.

What I tested

  • The six affected suites: 44/44 pass (ShellModalScrimTests, GlassSurfaceReviewRegressionTests, ProactiveLaneClientTests, ChatCitationTests, InkGlassHitRegionReporterTests, ShellClickThroughPolicyTests) — was 77 failures.
  • Full package suite on this branch: 5085 tests, 0 failures attributable to this change. Two unrelated failures reproduce identically on unmodified main sources (KnowledgeGraphPaginationTests.testCatalogOnlyCanonicalAtlasIsRenderableAndActivationCached, verified by reverting only this diff, and a MemoryDetailPanelTests SQLite disk-I/O flake that passes in isolation). Neither fails on CI.
  • Root cause 3 reproduced under CI's precondition locally: with a suite that leaks the fence ahead of it, consume() returns nil exactly as CI reports without this change, and 42 with it.
  • Click-through unaffected: ShellClickThroughPolicyTests plus the new registration test confirm a surface mounting the marker still owns the pointer.
  • make preflight and the macOS-scoped manifest checks (swift-format lint, SwiftLint 1258 files / 0 violations) pass.

Labelled no-changelog-needed: nothing here changes what a user sees.

Fixes #11563.

Failure-Class: none

🤖 automated by hourly watchdog — tested and merged

Review in cubic

`Desktop Swift Static & Test Contracts` has been red on every desktop PR
since 15a51fb — 77 assertion failures — so no desktop change could
reach main. main reads green only because the lane is path-filtered: it
skips the test job on every commit that does not touch desktop/macos/**.

75 of the 77 are one cause. `InkGlassHitRegionReporter` mounts a
zero-drawing AppKit marker so a transparent window can tell visible
content from air. `ImageRenderer` cannot rasterise an
`NSViewRepresentable` and substitutes an opaque placeholder for it, so
every pixel-truth test of a surface that mounts one measured the
placeholder covering the marker's whole host: the modal dim read as
painting to the window's edge — which on this window is the user's
wallpaper — and the glass panel's rounded corner read as filled.

Mount the marker at zero opacity. The placeholder then contributes no
pixels, while the AppKit view stays mounted, unhidden and registered:
SwiftUI applies opacity to the host layer, not to the view's own
`alphaValue`, which is what `InkGlassHitRegions.containsPoint` reads.
Both halves are pinned by `InkGlassHitRegionReporterTests`, because
dropping the reporter would satisfy the paint half and silently return
the shell to passing clicks through its own modals.

The remaining 2, in
`testLaterShorterRetryWindowDoesNotShortenActiveCooldown` (ff97490),
were never reachable: the test issued its two 429s sequentially, but an
armed cooldown short-circuits the network before the second request is
built, so the shorter `Retry-After` was never parsed and the request
count could not reach the 2 it asserted. The two attempts now overlap on
a rendezvous — the only way a second window is ever observed — so the
max-deadline preservation it is named for is actually exercised.

Verification: `swift test` — the 5 affected suites go 77 failures -> 26/26
passing, and `ShellClickThroughPolicyTests` plus the new registration test
confirm a surface mounting the marker still owns the pointer.

Failure-Class: none
…ture fence

`ChatCitationTests.testRewindCitationFocusIsOneShotAndPreservesExactScreenshotID`
has failed on every CI run of the desktop lane since it landed in #11519,
while passing locally — the fourth failure keeping the lane red, and not
one of the three #11563 reproduced.

`RewindCitationFocusState.request` refuses an id when
`RewindCaptureOwnerSnapshot.capture()` is nil, and the only thing that
makes it nil is `RewindCaptureOwnerGeneration`'s suspended flag. That flag
is process-global and outlives whichever suite suspended it, so the id
never landed and the failure was reported against the citation contract
rather than against the leak. Class execution order is not stable across
machines, which is the whole of the local/CI divergence.

Start the test from a clean fence and assert an owner exists, so it fails
on the handoff it is named for or not at all.

Verification: reproduced CI's precondition locally with a suite that
leaks the fence ahead of it — the test fails exactly as CI reports
(consume() -> nil) without this change and passes with it. All six
affected suites: 44/44 pass.

Failure-Class: none
@kodjima33 kodjima33 added the no-changelog-needed Skip desktop changelog enforcement for internal-only changes label Aug 14, 2026

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 4 files

Confidence score: 4/5

  • In desktop/macos/Desktop/Tests/InkGlassHitRegionReporterTests.swift, the guard on renderer.cgImage can exit before any assertion runs, so the test can pass without actually validating the zero-opacity contract; this weakens regression protection for rendering behavior — force a test failure on the nil path (or construct deterministic image input) so the assertion is always exercised.
  • In desktop/macos/Desktop/Tests/ProactiveLaneClientTests.swift, RequestRendezvous only supports the configured arrival count and extra arrive() calls block indefinitely, so the guarded bug path causes a hang instead of a clear failure; this risks stuck CI and obscures root cause — add an explicit timeout/failure path or make rendezvous over-arrival fail fast.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="desktop/macos/Desktop/Tests/InkGlassHitRegionReporterTests.swift">

<violation number="1" location="desktop/macos/Desktop/Tests/InkGlassHitRegionReporterTests.swift:30">
P2: When `renderer.cgImage` returns nil, this `guard` returns without running the assertion, so the test passes even though the zero-opacity behavior it is meant to lock in was never verified. That failure path is realistic here — the PR itself is predicated on `ImageRenderer` failing to rasterize `NSViewRepresentable` content — so in heads/CI environments where the render yields no image, this regression guard silently stops being enforced while still reporting green. Fail loudly instead of silently returning.</violation>
</file>

<file name="desktop/macos/Desktop/Tests/ProactiveLaneClientTests.swift">

<violation number="1" location="desktop/macos/Desktop/Tests/ProactiveLaneClientTests.swift:296">
P2: When the bug this test guards is present, the test hangs forever instead of failing cleanly. `RequestRendezvous` is valid for exactly `count` (2) arrivals; any subsequent `arrive()` blocks on `withCheckedContinuation` and is never resumed. The shared `authorization` closure is reused by the final `completeExtraction` after `clock.advance(by: 70)`. That call only avoids a third `arrive()` because `checkQuotaCooldown` throws first when the longer 300s deadline is preserved. If the shorter 60s deadline wrongly wins (the regression under test), the cooldown expires at T+60, the gate lets the call through, `authorization()` calls `arrive()` as a third arrival, and the test hangs until CI timeouts instead of reaching `XCTFail("expected quota cooldown — longer deadline must be preserved")`. Make the rendezvous single-shot/consumable so the exact failure this test targets reports a normal assertion failure rather than an indefinite hang.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

.frame(width: size.width, height: size.height))
renderer.scale = 1

guard let image = renderer.cgImage else { return }

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: When renderer.cgImage returns nil, this guard returns without running the assertion, so the test passes even though the zero-opacity behavior it is meant to lock in was never verified. That failure path is realistic here — the PR itself is predicated on ImageRenderer failing to rasterize NSViewRepresentable content — so in heads/CI environments where the render yields no image, this regression guard silently stops being enforced while still reporting green. Fail loudly instead of silently returning.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Tests/InkGlassHitRegionReporterTests.swift, line 30:

<comment>When `renderer.cgImage` returns nil, this `guard` returns without running the assertion, so the test passes even though the zero-opacity behavior it is meant to lock in was never verified. That failure path is realistic here — the PR itself is predicated on `ImageRenderer` failing to rasterize `NSViewRepresentable` content — so in heads/CI environments where the render yields no image, this regression guard silently stops being enforced while still reporting green. Fail loudly instead of silently returning.</comment>

<file context>
@@ -0,0 +1,73 @@
+        .frame(width: size.width, height: size.height))
+    renderer.scale = 1
+
+    guard let image = renderer.cgImage else { return }
+    let width = image.width
+    let height = image.height
</file context>
Suggested change
guard let image = renderer.cgImage else { return }
guard let image = renderer.cgImage else {
return XCTFail("ImageRenderer produced no image; the paint assertion was never exercised")
}

baseURL: { "https://proactive.test" },
authorization: { "Bearer test" },
authorization: {
await bothPastTheGate.arrive()

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: When the bug this test guards is present, the test hangs forever instead of failing cleanly. RequestRendezvous is valid for exactly count (2) arrivals; any subsequent arrive() blocks on withCheckedContinuation and is never resumed. The shared authorization closure is reused by the final completeExtraction after clock.advance(by: 70). That call only avoids a third arrive() because checkQuotaCooldown throws first when the longer 300s deadline is preserved. If the shorter 60s deadline wrongly wins (the regression under test), the cooldown expires at T+60, the gate lets the call through, authorization() calls arrive() as a third arrival, and the test hangs until CI timeouts instead of reaching XCTFail("expected quota cooldown — longer deadline must be preserved"). Make the rendezvous single-shot/consumable so the exact failure this test targets reports a normal assertion failure rather than an indefinite hang.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Tests/ProactiveLaneClientTests.swift, line 296:

<comment>When the bug this test guards is present, the test hangs forever instead of failing cleanly. `RequestRendezvous` is valid for exactly `count` (2) arrivals; any subsequent `arrive()` blocks on `withCheckedContinuation` and is never resumed. The shared `authorization` closure is reused by the final `completeExtraction` after `clock.advance(by: 70)`. That call only avoids a third `arrive()` because `checkQuotaCooldown` throws first when the longer 300s deadline is preserved. If the shorter 60s deadline wrongly wins (the regression under test), the cooldown expires at T+60, the gate lets the call through, `authorization()` calls `arrive()` as a third arrival, and the test hangs until CI timeouts instead of reaching `XCTFail("expected quota cooldown — longer deadline must be preserved")`. Make the rendezvous single-shot/consumable so the exact failure this test targets reports a normal assertion failure rather than an indefinite hang.</comment>

<file context>
@@ -275,32 +275,48 @@ final class ProactiveLaneClientTests: XCTestCase {
       baseURL: { "https://proactive.test" },
-      authorization: { "Bearer test" },
+      authorization: {
+        await bothPastTheGate.arrive()
+        return "Bearer test"
+      },
</file context>

@kodjima33

Copy link
Copy Markdown
Collaborator Author

Closing this rather than leaving it open: it is verified but not mergeable, and the branch watchdog/issue-11563-desktop-swift-lane-red is ready to re-open the moment the last blocker below is resolved.

What CI proved. Run 31792619068 on this branch took Desktop Swift Static & Test Contracts from 77 failures to 1. ShellModalScrimTests (74), GlassSurfaceReviewRegressionTests (1) and ProactiveLaneClientTests (2) are all green on CI with these commits — the two fixes are confirmed, not just locally tested.

Why it cannot merge. ChatCitationTests.testRewindCitationFocusIsOneShotAndPreservesExactScreenshotID (from #11519) still fails, exactly as it has on every CI run of this lane since it landed. It is unrelated to this diff and it keeps the lane red, so nothing here unblocks desktop PRs on its own.

I tried one fix for it and CI disproved the hypothesis, so I reverted it (8e73f6a) rather than leave a wrong explanation in the tree. What is now known:

  • RewindCaptureOwnerSnapshot.capture() is non-nil on CI at that point (my added XCTAssertNotNil passed), so the suspended-capture-fence theory is dead.
  • The failure is therefore inside consume()'s remaining guards: either the owner scope captured by request no longer equals the one consume reads, or currentOwner.isCurrent() is false. Both are process-global owner identity/generation state that another suite mutates; class execution order is not stable across machines, which is the whole of the CI-red/local-green split.
  • I could not reproduce it locally, including by forcing an owner-id split between RewindDatabase.currentUserId and the persisted auth owner.

Its owner should either make it establish the owner identity it needs or delete it — a test that has never passed in CI is not guarding anything.

🤖 hourly desktop watchdog

@kodjima33 kodjima33 closed this Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @kodjima33 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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

Labels

no-changelog-needed Skip desktop changelog enforcement for internal-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop Swift test lane red on main: 77 failures across 3 suites block every desktop PR (scrim regression root-caused to 15a51fb985)

1 participant