Skip to content

The agent that grows with you

fix(desktop): idle renderer stops ticking once a decode placeholder resolves

teknium156af2bdf7e27
diff --git a/apps/desktop/src/components/gateway-connecting-overlay.tsx b/apps/desktop/src/components/gateway-connecting-overlay.tsx
index 462374bd7bc..b147d45e2be 100644
--- a/apps/desktop/src/components/gateway-connecting-overlay.tsx
+++ b/apps/desktop/src/components/gateway-connecting-overlay.tsx
@@ -163,6 +163,7 @@ export function GatewayConnectingOverlay() {
leaving ? 'translate-y-2 opacity-0 saturate-0' : 'translate-y-0 opacity-100 saturate-100'
)}
cursor
+ loop
prefix={4}
text={TEXT}
/>
diff --git a/apps/desktop/src/components/ui/decode-text.test.tsx b/apps/desktop/src/components/ui/decode-text.test.tsx
new file mode 100644
index 00000000000..ee30606a0d0
--- /dev/null
+++ b/apps/desktop/src/components/ui/decode-text.test.tsx
@@ -0,0 +1,52 @@
+// The decode scramble is decorative. Once a quiet-surface placeholder (empty
+// pane zone, contrib panes) has resolved and held, its interval must be gone:
+// a replaying default kept a 22 Hz setState ticker alive for as long as the
+// mark was on screen, holding an otherwise idle renderer at ~16 commits/s
+// (#98394). Only a caller that asks for `loop` (the boot overlay) replays.
+import { act, cleanup, render } from '@testing-library/react'
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+
+import { DecodeText } from './decode-text'
+
+const TICK_MS = 45
+// half a char per tick + the 16-tick hold, with slack for the final tick.
+const settleTicks = (text: string) => text.length * 2 + 16 + 4
+
+beforeEach(() => {
+ vi.useFakeTimers()
+ window.matchMedia = vi.fn().mockReturnValue({ addEventListener: vi.fn(), matches: false, removeEventListener: vi.fn() })
+})
+
+afterEach(() => {
+ cleanup()
+ vi.useRealTimers()
+})
+
+it('resolves once and stops ticking by default', () => {
+ const { container } = render(<DecodeText prefix={1} text="HERMES" />)
+
+ act(() => vi.advanceTimersByTime(settleTicks('HERMES') * TICK_MS))
+ expect(container.textContent).toBe('HERMES')
+
+ // Fully resolved and held: the timer must be gone, not replaying.
+ expect(vi.getTimerCount()).toBe(0)
+ act(() => vi.advanceTimersByTime(TICK_MS * 40))
+ expect(container.textContent).toBe('HERMES')
+})
+
+it('keeps replaying only when the caller asks for loop', () => {
+ const { container } = render(<DecodeText loop prefix={1} text="HERMES" />)
+
+ act(() => vi.advanceTimersByTime(settleTicks('HERMES') * TICK_MS))
+ expect(vi.getTimerCount()).toBe(1)
+
+ // The replay scrambles the tail again at some point after the hold.
+ const seen = new Set<string>()
+
+ for (let i = 0; i < 40; i++) {
+ act(() => vi.advanceTimersByTime(TICK_MS))
+ seen.add(container.textContent ?? '')
+ }
+
+ expect(seen.size).toBeGreaterThan(1)
+})
diff --git a/apps/desktop/src/components/ui/decode-text.tsx b/apps/desktop/src/components/ui/decode-text.tsx
index ac9be7d667b..f59f73c0bbd 100644
--- a/apps/desktop/src/components/ui/decode-text.tsx
+++ b/apps/desktop/src/components/ui/decode-text.tsx
@@ -37,7 +37,11 @@ export interface DecodeTextProps extends Omit<ComponentProps<'span'>, 'prefix'>
/** Run the decode. When false, renders the plain resolved text (used to
* freeze the word during exit choreography). */
active?: boolean
- /** Replay after the hold, or resolve once and stop. */
+ /** Replay after the hold (a progress surface such as the boot overlay), or
+ * resolve once and stop. Off by default: a quiet placeholder that replays
+ * forever is a 22 Hz setState ticker for as long as it is on screen — the
+ * empty-zone "HERMES" mark alone held the idle renderer at ~16 commits/s
+ * (#98394). */
loop?: boolean
/** Blinking dither-cursor square after the text. */
cursor?: boolean
@@ -47,7 +51,7 @@ export function DecodeText({
active = true,
className,
cursor = false,
- loop = true,
+ loop = false,
prefix = 0,
text,
...props