Skip to content

The agent that grows with you

fix(desktop): order-independent selection guard, layer-hint scoping, honest compositor receipt

Royalaid76e0ca8826da
diff --git a/apps/desktop/e2e/glyph-spinner.spec.ts b/apps/desktop/e2e/glyph-spinner.spec.ts
index e920daa143b..9ef8790bd3c 100644
--- a/apps/desktop/e2e/glyph-spinner.spec.ts
+++ b/apps/desktop/e2e/glyph-spinner.spec.ts
@@ -20,7 +20,7 @@
* Prerequisite: `npm run build` must have been run so dist/ exists.
*/
-import { expect, test, type Page } from '@playwright/test'
+import { expect, type Page, test } from '@playwright/test'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
@@ -74,8 +74,12 @@ test.describe('GlyphSpinner (compositor animation)', () => {
durationMs: animations[0]?.effect?.getTiming().duration ?? null,
names: animations.map(a => (a as CSSAnimation).animationName),
// A percentage translate makes the animation layout-dependent, which
- // Chromium refuses to composite. The travel must resolve to a length.
- transform: style.transform
+ // Chromium refuses to composite. Read the engine's own keyframes: a
+ // revert to translateY(-100%) shows up here, while the computed
+ // `style.transform` always serializes to a matrix and can't tell.
+ travel: ((animations[0]?.effect as KeyframeEffect | undefined)?.getKeyframes() ?? [])
+ .map(k => String((k as Keyframe & { transform?: string }).transform ?? ''))
+ .join(' | ')
}
}, STRIP)
@@ -88,9 +92,10 @@ test.describe('GlyphSpinner (compositor animation)', () => {
// One full cycle is frames x interval, so the duration must be a positive
// multiple of the frame count — not the single-frame interval.
expect(observed.durationMs).toBeGreaterThan(0)
- // A resolved matrix, never a percentage: `translateY(-100%)` would keep
+ // Length-typed travel, never a percentage: `translateY(-100%)` would keep
// the animation off the compositor.
- expect(observed.transform).not.toContain('%')
+ expect(observed.travel).toContain('calc(')
+ expect(observed.travel).not.toContain('%')
})
test('is promoted to a layer while running, and neither animates nor holds a layer when parked', async () => {
@@ -119,6 +124,7 @@ test.describe('GlyphSpinner (compositor animation)', () => {
const previous = viewport.getAttribute('data-paused')
viewport.setAttribute('data-paused', 'true')
+
const state = {
playState: getComputedStyle(el).animationPlayState,
willChange: getComputedStyle(el).willChange
@@ -174,6 +180,7 @@ test.describe('GlyphSpinner (compositor animation)', () => {
const textAtStart = el.textContent
const deadline = performance.now() + duration
+
while (performance.now() < deadline) {
seen.add(getComputedStyle(el).transform)
await new Promise(resolve => requestAnimationFrame(() => resolve(null)))
diff --git a/apps/desktop/src/components/assistant-ui/thread/status-invalidation-scope.test.tsx b/apps/desktop/src/components/assistant-ui/thread/status-invalidation-scope.test.tsx
index 435fe9dee47..b6fc34ec1d1 100644
--- a/apps/desktop/src/components/assistant-ui/thread/status-invalidation-scope.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/status-invalidation-scope.test.tsx
@@ -16,12 +16,14 @@ import { AssistantRuntimeProvider, type ThreadMessage, useExternalStoreRuntime }
import { cleanup, render, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import type * as messageReactionsModule from '@/components/assistant-ui/thread/use-message-reactions'
+
import { Thread } from '.'
let rootRenders = 0
vi.mock('@/components/assistant-ui/thread/use-message-reactions', async importActual => {
- const actual = await importActual<typeof import('@/components/assistant-ui/thread/use-message-reactions')>()
+ const actual = await importActual<typeof messageReactionsModule>()
return {
...actual,
diff --git a/apps/desktop/src/components/ui/glyph-spinner.css b/apps/desktop/src/components/ui/glyph-spinner.css
index 4656074f108..12118ba0048 100644
--- a/apps/desktop/src/components/ui/glyph-spinner.css
+++ b/apps/desktop/src/components/ui/glyph-spinner.css
@@ -47,7 +47,9 @@
`[data-selectable-text='true'] *` rule carries the same (0,1,0) specificity,
so relying on inheritance would make the winner depend on stylesheet order. */
.glyph-spinner,
-.glyph-spinner * {
+.glyph-spinner *,
+[data-selectable-text='true'] .glyph-spinner,
+[data-selectable-text='true'] .glyph-spinner * {
-webkit-user-select: none;
user-select: none;
}
@@ -66,6 +68,18 @@
will-change: transform;
}
+/* The global renderer pause and the reduced-motion freeze stop the animation;
+ drop the layer hint there too, so parked spinners hold no compositor layer. */
+:root[data-renderer-animations-paused] .glyph-spinner__strip {
+ will-change: auto;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .glyph-spinner__strip {
+ will-change: auto;
+ }
+}
+
.glyph-spinner__frame {
display: block;
height: var(--glyph-spinner-frame-height, 1em);