Skip to content

The agent that grows with you

test(desktop-e2e): fix spec drift accrued while the lane was disabled

Tekniumeb1b14b9526e
diff --git a/apps/desktop/e2e/bot-mode-closed-chat-stays-closed.spec.ts b/apps/desktop/e2e/bot-mode-closed-chat-stays-closed.spec.ts
index edf39d5515f..da236ca6ff6 100644
--- a/apps/desktop/e2e/bot-mode-closed-chat-stays-closed.spec.ts
+++ b/apps/desktop/e2e/bot-mode-closed-chat-stays-closed.spec.ts
@@ -20,8 +20,13 @@ import { expect, test } from './test'
// on every bot switch, because nothing records a close (the plugin keeps no
// closed set; core's tile bucket only forgets). Now a bot whose workspace
// already holds tabs comes back to the one the user left; the forever-chat is
-// re-opened only by the explicit asks (row menu "Open Bot Chat", Bots home
-// "Open chat").
+// re-opened only by the explicit asks (row menu "Open Bot Chat").
+//
+// UI note (post design-system rework): the canonical Bot Chat opens INTO the
+// main workspace pane (`data-tree-tab="workspace"`), and a lone uncloseable
+// workspace pane renders chromeless — its "Bot Chat" tab only exists once a
+// second pane (e.g. a ⌘/Ctrl+T thread tile) shares the main zone. Assertions
+// about the lone open therefore read the transcript, not a tab.
type Page = MockBackendFixture['page']
@@ -76,7 +81,9 @@ async function snap(page: Page, name: string): Promise<void> {
}
}
-/** The session tabs on the main strip (the Bots home tab may sit beside them). */
+/** The session tabs on the main strip (the Bot Chat workspace tab may sit
+ * beside them). The strip itself auto-hides when the workspace pane is the
+ * only pane in the zone, so an empty result also covers "no strip at all". */
const mainTabs = (page: Page) =>
page.evaluate(() =>
[...document.querySelectorAll<HTMLElement>('[data-zone-tabstrip="grp-main"] [data-tree-tab]')]
@@ -89,7 +96,7 @@ const mainTabs = (page: Page) =>
* row (the plugin's canonical forever-chat, found by exact title) — keeps
* in-app creation and the intro turn it fires out of a scenario that is
* about the row click. With the row present, the click takes the open-as-
- * tab path; without it, it would mint the chat into the workspace pane. */
+ * workspace path; without it, it would mint the chat into the pane. */
async function seedBot(hermesHome: string, mockUrl: string, name: string): Promise<void> {
const dir = path.join(hermesHome, 'profiles', name)
fs.mkdirSync(dir, { recursive: true })
@@ -146,37 +153,47 @@ test('a bot row click returns to the open thread and does not re-open a closed B
await expect(alphaRow).toBeVisible({ timeout: 30_000 })
await expect(betaRow).toBeVisible({ timeout: 30_000 })
const botChatTab = page.getByRole('tab', { name: /Bot Chat/ }).filter({ visible: true })
+ // The seeded forever-chat's first turn — visible only while the Bot Chat
+ // transcript is on screen. This is how a chromeless lone open is observed.
+ const seededTurn = page.getByText('Hello alpha', { exact: true }).filter({ visible: true })
// The first click on a bot with nothing open lands on its canonical chat.
+ // It fills the lone main workspace pane, which renders without a tab strip.
await openUntil(
() => alphaRow.click(),
- () => expect(botChatTab.first()).toBeVisible({ timeout: 45_000 })
+ () => expect(seededTurn.first()).toBeVisible({ timeout: 45_000 })
)
await settle(page, 15_000)
await snap(page, '01-first-click-opens-bot-chat')
- // Close it, then start a fresh thread for Alpha (⌘/Ctrl+T — the strip's
- // "+" leaves with the zone's last tab).
- await botChatTab.first().hover()
- await botChatTab.first().getByRole('button', { name: 'Close' }).click({ force: true })
- await expect(botChatTab).toHaveCount(0)
-
+ // Start a fresh thread for Alpha (⌘/Ctrl+T). The thread tile joins the main
+ // zone beside the Bot Chat workspace pane, which mounts the tab strip — the
+ // "Bot Chat" tab exists now, and the close affordance with it.
await page.keyboard.press('Control+t')
+ await expect(botChatTab.first()).toBeVisible({ timeout: 15_000 })
+ await expect.poll(() => mainTabs(page), { timeout: 15_000 }).toHaveLength(1)
+
const composer = page.locator('[data-slot="composer-root"] [contenteditable="true"]').filter({ visible: true }).first()
await expect(composer).toBeVisible({ timeout: 15_000 })
await composer.click()
await composer.fill('hello alpha thread')
await page.keyboard.press('Enter')
await expect(page.getByText('hello alpha thread').filter({ visible: true }).first()).toBeVisible({ timeout: 15_000 })
- // The reply also becomes the tab's (clipped) title — match the visible copy.
await expect(page.getByText(MOCK_REPLY).filter({ visible: true }).first()).toBeVisible({ timeout: 60_000 })
- await snap(page, '02-closed-bot-chat-new-thread')
+ await snap(page, '02-new-thread-beside-bot-chat')
const threadTabs = await mainTabs(page)
expect(threadTabs).toHaveLength(1)
const [threadTab] = threadTabs
expect(threadTab).toMatch(/^session-tile:/)
+ // Close the Bot Chat. Its transcript leaves the screen; the thread stays.
+ await botChatTab.first().hover()
+ await botChatTab.first().getByRole('button', { name: 'Close' }).click({ force: true })
+ await expect(botChatTab).toHaveCount(0)
+ await expect(seededTurn).toHaveCount(0)
+ await snap(page, '03-bot-chat-closed-thread-stays')
+
// Switch to Beta: Alpha's thread leaves the strip (scoped away, not closed).
await betaRow.click()
await expect(page.locator(`[data-zone-tabstrip="grp-main"] [data-tree-tab="${threadTab}"]`)).toHaveCount(0, {
@@ -184,25 +201,27 @@ test('a bot row click returns to the open thread and does not re-open a closed B
})
await settle(page)
- // Back to Alpha: the thread is fronted, and the closed Bot Chat STAYS closed.
+ // Back to Alpha: the workspace comes back to what the user left, and the
+ // closed Bot Chat STAYS closed. The regression this pins re-opened the
+ // canonical chat beside the thread on every switch — two panes in the main
+ // zone, which mounts the tab strip and puts the "Bot Chat" tab back on
+ // screen. Its absence (with the transcript present, so the click landed) is
+ // the observable "stays closed".
await alphaRow.click()
- const threadTabLocator = page.locator(`[data-zone-tabstrip="grp-main"] [data-tree-tab="${threadTab}"]`)
- await expect(threadTabLocator).toBeVisible({ timeout: 30_000 })
- await expect(threadTabLocator).toHaveAttribute('aria-selected', 'true')
+ await expect(page.getByText(MOCK_REPLY).filter({ visible: true }).first()).toBeVisible({ timeout: 30_000 })
await page.waitForTimeout(3000)
await expect(botChatTab).toHaveCount(0)
- expect(await mainTabs(page)).toEqual([threadTab])
- await snap(page, '03-back-to-alpha-bot-chat-stays-closed')
+ await snap(page, '04-back-to-alpha-bot-chat-stays-closed')
- // The explicit ask still opens the forever-chat, beside the thread.
+ // The explicit ask still opens the forever-chat: its seeded first turn is
+ // back on screen. (As the surviving main-workspace pane it may render
+ // chromeless, so the transcript — not a tab — is the assertion.)
await openUntil(
async () => {
await alphaRow.click({ button: 'right' })
await page.getByRole('menuitem', { name: 'Open Bot Chat' }).click()
},
- () => expect(botChatTab.first()).toBeVisible({ timeout: 45_000 })
+ () => expect(seededTurn.first()).toBeVisible({ timeout: 45_000 })
)
- expect(await mainTabs(page)).toHaveLength(2)
- expect(await mainTabs(page)).toContain(threadTab)
- await snap(page, '04-explicit-open-bot-chat')
+ await snap(page, '05-explicit-open-bot-chat')
})
diff --git a/apps/desktop/e2e/chat.spec.ts b/apps/desktop/e2e/chat.spec.ts
index 9a55d9fc8ee..6850b505875 100644
--- a/apps/desktop/e2e/chat.spec.ts
+++ b/apps/desktop/e2e/chat.spec.ts
@@ -106,7 +106,10 @@ test.describe('chat interaction with mock backend', () => {
await composer.click()
await composer.type('please answer tersely')
- await expect(primary).toHaveAttribute('aria-label', /Steer/)
+ // Since "running is not busy" (3bc52fb9df) the primary keeps the Send
+ // affordance mid-turn — steer is routed through the submit engine, not a
+ // separate labeled button. Queue remains the explicit secondary action.
+ await expect(primary).toHaveAttribute('aria-label', 'Send')
await expect(dictation).toBeVisible()
await expect(speakReplies).toBeVisible()
await expect(queue).toBeVisible()
@@ -119,11 +122,9 @@ test.describe('chat interaction with mock backend', () => {
)
expect(controlLabels.indexOf('Voice dictation')).toBeLessThan(speakRepliesIndex)
expect(speakRepliesIndex).toBeLessThan(controlLabels.indexOf('Queue message'))
- expect(controlLabels.indexOf('Queue message')).toBeLessThan(
- controlLabels.findIndex(label => label?.startsWith('Steer'))
- )
+ expect(controlLabels.indexOf('Queue message')).toBeLessThan(controlLabels.indexOf('Send'))
await page.screenshot({ path: testInfo.outputPath('busy-composer-steer.png') })
- await expect(primary.locator('svg.tabler-icon-steering-wheel')).toBeVisible()
+ await expect(primary.locator('.codicon-arrow-up')).toBeVisible()
await queue.click()
await expect(primary).toHaveAttribute('aria-label', 'Stop')
diff --git a/apps/desktop/e2e/correction-session-switch.spec.ts b/apps/desktop/e2e/correction-session-switch.spec.ts
index dc435b1d538..99401949a5a 100644
--- a/apps/desktop/e2e/correction-session-switch.spec.ts
+++ b/apps/desktop/e2e/correction-session-switch.spec.ts
@@ -45,7 +45,9 @@ async function steer(page: Page, text: string): Promise<void> {
await composer.waitFor({ state: 'visible', timeout: 15_000 })
await composer.click()
await composer.type(text, { delay: 5 })
- await expect(primary).toHaveAttribute('aria-label', /Steer/)
+ // Since "running is not busy" (3bc52fb9df) the primary keeps the Send label
+ // mid-turn; the submit engine still routes a text payload to steer.
+ await expect(primary).toHaveAttribute('aria-label', 'Send')
await primary.click()
}
@@ -209,17 +211,36 @@ test.describe('correction session switch', () => {
// Reproduce the observed race: switch to another persisted session while
// the foreground tool is live, then return before its redirect settles.
- await openSidebarSession(page, MOCK_REPLY, OTHER_SESSION_PROMPT)
+ // Sidebar rows title by the session's first user prompt (auto-title is
+ // disabled in the e2e fixture config).
+ await openSidebarSession(page, OTHER_SESSION_PROMPT, OTHER_SESSION_PROMPT)
await reopenOriginalSession(page)
- await page.waitForTimeout(500)
+ // The warm resume first paints the persisted history and then reconciles
+ // the live turn (including a steer whose persistence may lag on a loaded
+ // runner) back in. Poll to the converged order instead of sampling one
+ // arbitrary mid-reconcile frame; the duplicate checks then pin the
+ // regression (the prompt/correction must appear exactly once).
+ await expect
+ .poll(async () => relevantOrder(await transcriptTextOrder(page)), {
+ message: 'correction should stay in place after the warm resume',
+ timeout: 30_000,
+ })
+ .toEqual(orderBeforeSwitch)
await page.screenshot({ path: testInfo.outputPath('correction-after-warm-resume.png') })
- expect(relevantOrder(await transcriptTextOrder(page))).toEqual(orderBeforeSwitch)
expect(await textNodeOccurrences(page, ORIGINAL_PROMPT)).toBe(1)
expect(await textNodeOccurrences(page, CORRECTION)).toBe(1)
await waitForTranscriptText(page, CORRECTED_REPLY)
- expect(steerTurnOrder(await transcriptMessageOrder(page))).toEqual([ORIGINAL_PROMPT, CORRECTION, CORRECTED_REPLY])
+ // The post-turn stored-history reconcile can momentarily repaint from a
+ // snapshot in which the steer's user row hasn't been folded back in yet —
+ // poll to the converged order instead of sampling one frame.
+ await expect
+ .poll(async () => steerTurnOrder(await transcriptMessageOrder(page)), {
+ message: 'steered turn should settle as prompt → correction → corrected reply',
+ timeout: 30_000,
+ })
+ .toEqual([ORIGINAL_PROMPT, CORRECTION, CORRECTED_REPLY])
})
test('keeps an inference-time correction visible through a warm session switch', async ({}, testInfo: TestInfo) => {
@@ -236,7 +257,7 @@ test.describe('correction session switch', () => {
await send(page, INFERENCE_CORRECTION)
await waitForTranscriptText(page, INFERENCE_CORRECTION)
- await openSidebarSession(page, MOCK_REPLY, OTHER_SESSION_PROMPT)
+ await openSidebarSession(page, OTHER_SESSION_PROMPT, OTHER_SESSION_PROMPT)
await reopenInferenceSession(page)
expect(await textNodeOccurrences(page, INFERENCE_PROMPT)).toBe(1)
diff --git a/apps/desktop/e2e/fixtures.ts b/apps/desktop/e2e/fixtures.ts
index 5e2774b2c0f..3d249fd1add 100644
--- a/apps/desktop/e2e/fixtures.ts
+++ b/apps/desktop/e2e/fixtures.ts
@@ -170,6 +170,17 @@ export function writeMockProviderConfig(
? `\ndisplay:\n${extraDisplayConfig}\n`
: ''
+ // Title generation rides the MAIN model since 87af576e60 (#83636), so every
+ // completed turn fires an extra background /v1/chat/completions at the mock.
+ // That request contains the whole conversation — trigger keywords included —
+ // which advances the mock's scripted-turn indices and trips hold-for-prompt
+ // matchers from a request no spec ever sent. Disable it by default (no e2e
+ // spec asserts on session titles); a test that passes its own `auxiliary:`
+ // section via extraConfig owns the whole section instead.
+ const autoTitleDefault = extraConfig?.includes('auxiliary:')
+ ? ''
+ : 'auxiliary:\n title_generation:\n enabled: false\n'
+
const config = `# Auto-generated by E2E test fixtures
model:
default: mock-model
@@ -183,7 +194,7 @@ ${modelContextLength ? ` context_length: ${modelContextLength}\n` : ''}provider
models:
mock-model: {}
context_length: 4096
-${displaySection}${extraConfig ? `\n${extraConfig.trim()}\n` : ''}`
+${autoTitleDefault}${displaySection}${extraConfig ? `\n${extraConfig.trim()}\n` : ''}`
fs.writeFileSync(configPath, config, 'utf8')
}
diff --git a/apps/desktop/e2e/glyph-spinner.spec.ts b/apps/desktop/e2e/glyph-spinner.spec.ts
index 9ef8790bd3c..8d2e97f552b 100644
--- a/apps/desktop/e2e/glyph-spinner.spec.ts
+++ b/apps/desktop/e2e/glyph-spinner.spec.ts
@@ -24,20 +24,46 @@ import { expect, type Page, test } from '@playwright/test'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
-const STRIP = '.glyph-spinner__strip'
+/* Scope to a spinner that is actually RUNNING. Turns from earlier tests in
+ * this file leave parked spinners mounted (kept-alive panes, swap overlays
+ * hold them with data-paused='true'), and document.querySelector returns the
+ * FIRST strip in the DOM — a stale parked one once two turns have run. */
+const STRIP = '.glyph-spinner:not([data-paused="true"]) .glyph-spinner__strip'
+
+/** Prompt the mock server holds open so the spinner runs for the whole file. */
+const SPINNER_PROMPT = 'E2E_GLYPH_SPINNER_HOLD'
/**
- * Send a message so a turn is in flight — the composer status stack mounts a
- * GlyphSpinner while the agent is working. Resolves once a frame strip is in
- * the DOM.
+ * Get a RUNNING frame strip into the DOM deterministically.
+ *
+ * A turn is sent so the app is genuinely busy (the mock server holds the
+ * stream open), but which surface mounts a spinner mid-turn is app policy
+ * that has changed before and will again — the transcript, status stack and
+ * swap overlay all park/unmount theirs at different moments, which made this
+ * spec racy. The contract under test is the STYLESHEET (steps() animation,
+ * layer promotion, the data-paused and global pause gates), and that CSS is
+ * driven entirely by the `data-paused` attribute — the same attribute the
+ * parked assertions below already toggle. So: wait for any mounted spinner
+ * (the ChatSwapOverlay keeps one mounted, parked, after boot), then unpark it
+ * and assert against the running animation.
*/
async function mountSpinner(page: Page): Promise<void> {
+ if (await page.locator(STRIP).count()) {
+ return
+ }
+
const composer = page.locator('[contenteditable="true"]').first()
await composer.waitFor({ state: 'visible', timeout: 10_000 })
await composer.click()
- await composer.type('hello from the glyph spinner spec', { delay: 10 })
+ await composer.type(SPINNER_PROMPT, { delay: 10 })
await page.keyboard.press('Enter')
+ await page.waitForSelector('.glyph-spinner__strip', { state: 'attached', timeout: 20_000 })
+ await page.evaluate(() => {
+ for (const el of document.querySelectorAll('.glyph-spinner[data-paused]')) {
+ el.removeAttribute('data-paused')
+ }
+ })
await page.waitForSelector(STRIP, { state: 'attached', timeout: 20_000 })
}
@@ -45,11 +71,14 @@ test.describe('GlyphSpinner (compositor animation)', () => {
let fixture: MockBackendFixture
test.beforeAll(async () => {
- fixture = await setupMockBackend()
+ fixture = await setupMockBackend({
+ mockServer: { holdFirstStreamForPrompt: SPINNER_PROMPT },
+ })
await waitForAppReady(fixture)
})
test.afterAll(async () => {
+ fixture?.mock.releaseHeldStream()
await fixture?.cleanup()
})
@@ -93,8 +122,10 @@ test.describe('GlyphSpinner (compositor animation)', () => {
// multiple of the frame count — not the single-frame interval.
expect(observed.durationMs).toBeGreaterThan(0)
// Length-typed travel, never a percentage: `translateY(-100%)` would keep
- // the animation off the compositor.
- expect(observed.travel).toContain('calc(')
+ // the animation off the compositor. Chromium has serialized the resolved
+ // keyframe both as the authored `calc(...)` and as an absolute `...px`
+ // length depending on version — accept any length, reject percentages.
+ expect(observed.travel).toMatch(/calc\(|px\)/)
expect(observed.travel).not.toContain('%')
})
diff --git a/apps/desktop/e2e/group-to-local-bot-handoff.spec.ts b/apps/desktop/e2e/group-to-local-bot-handoff.spec.ts
index 7d29753a5c0..f3710f6b0ab 100644
--- a/apps/desktop/e2e/group-to-local-bot-handoff.spec.ts
+++ b/apps/desktop/e2e/group-to-local-bot-handoff.spec.ts
@@ -32,7 +32,7 @@ test.afterAll(async () => {
})
test('local bot replaces an open group main workspace', async () => {
- test.setTimeout(180_000)
+ test.setTimeout(240_000)
const page = fixture!.page
await openBots(page)
@@ -60,11 +60,21 @@ test('local bot replaces an open group main workspace', async () => {
const programmer = page.getByRole('button', { name: /^Programmer\b/ }).filter({ visible: true }).first()
await programmer.click()
- const botChatTab = page.getByRole('tab', { name: /Bot Chat Close/ }).filter({ visible: true })
- await expect(botChatTab).toBeVisible({ timeout: 30_000 })
- await expect(botChatTab).toHaveAttribute('aria-selected', 'true')
+ // The bot's canonical chat opens INTO the main workspace pane (post
+ // design-system rework); as the lone pane in the zone it renders chromeless
+ // — no "Bot Chat" tab exists until a second pane joins the strip. The
+ // handoff is observed by the group surfaces leaving and the bot's chat
+ // (here a fresh one: its empty-state splash asks for a first message)
+ // taking the main workspace. The first open also spawns the bot's own
+ // backend, so give the "Loading session" phase a real chance to clear.
+ await expect(page.getByText('Say something to get started.').filter({ visible: true })).toBeVisible({
+ timeout: 120_000
+ })
await expect(groupTab).toHaveCount(0)
await expect(groupComposer).toHaveCount(0)
- await expect(page.getByText(/Waking up Programmer/i)).toHaveCount(0)
+ // No "Waking up…" assertion: the mock backend can keep a bot's wake notice
+ // around indefinitely (see bot-mode-closed-chat-stays-closed's settle()),
+ // so its presence no longer distinguishes a stranded handoff. The splash
+ // and composer above are the proof the bot's chat took the workspace.
await expect(page.locator('[data-slot="composer-root"] [contenteditable="true"]').filter({ visible: true }).first()).toBeVisible()
})
diff --git a/apps/desktop/e2e/hidden-history-messages.spec.ts b/apps/desktop/e2e/hidden-history-messages.spec.ts
index 23076f766e7..7756a07076c 100644
--- a/apps/desktop/e2e/hidden-history-messages.spec.ts
+++ b/apps/desktop/e2e/hidden-history-messages.spec.ts
@@ -9,13 +9,11 @@
import * as fs from 'node:fs'
import * as path from 'node:path'
-import { expect, test } from './test'
-
import {
- type MockBackendFixture,
buildAppEnv,
createSandbox,
launchDesktop,
+ type MockBackendFixture,
waitForAppReady,
writeEnvFile,
writeMockProviderConfig,
@@ -27,6 +25,7 @@ import {
VERIFICATION_STOP_TRIGGER,
} from './mock-server'
import { RealSessionBuilder } from './real-session-builder'
+import { expect, test } from './test'
const SESSION_TITLE = 'E2E Hidden History Messages'
const VISIBLE_USER_TEXT = 'E2E_VISIBLE_USER_HISTORY'
@@ -44,6 +43,7 @@ async function setupSeededMockBackend(): Promise<MockBackendFixture> {
)
writeEnvFile(sandbox.hermesHome)
const builder = await RealSessionBuilder.start(sandbox.hermesHome)
+
try {
await builder.createSession({
title: SESSION_TITLE,
@@ -83,6 +83,7 @@ test('resume hides real context-compaction handoffs', async ({}, testInfo) => {
.locator('[data-slot="sidebar"] button')
.filter({ hasText: SESSION_TITLE })
.first()
+
await sessionRow.click()
const transcript = page.locator('[data-slot="aui_thread-viewport"]')
@@ -110,8 +111,20 @@ test('live verify-on-stop continuations stay out of the transcript', async ({},
const mock = await startMockServer({ verificationWritePath: changedFile })
writeMockProviderConfig(sandbox.hermesHome, mock.url)
fs.appendFileSync(path.join(sandbox.hermesHome, 'config.yaml'), '\nagent:\n verify_on_stop: true\n', 'utf8')
+ // Auto session titling (feat f726090d48) fires an auxiliary title_generation
+ // LLM call whose user snippet CONTAINS the trigger keyword, so the mock's
+ // isVerificationStopTrigger matches it and the title call steals a scripted
+ // verify-on-stop turn (the transcript then ends on 'The code edit is
+ // complete.' instead of the exhausted-verifier final). Disable the
+ // model-backed title upgrade so script indices track real chat turns.
+ fs.appendFileSync(
+ path.join(sandbox.hermesHome, 'config.yaml'),
+ '\nauxiliary:\n title_generation:\n enabled: false\n',
+ 'utf8',
+ )
writeEnvFile(sandbox.hermesHome)
const { app, page } = await launchDesktop(buildAppEnv(sandbox))
+
const fixture: MockBackendFixture = {
app,
page,
diff --git a/apps/desktop/e2e/image-attachment-resume.spec.ts b/apps/desktop/e2e/image-attachment-resume.spec.ts
index a4f8da68e39..4449553ec94 100644
--- a/apps/desktop/e2e/image-attachment-resume.spec.ts
+++ b/apps/desktop/e2e/image-attachment-resume.spec.ts
@@ -27,8 +27,8 @@ import { type MockServer, startMockServer } from './mock-server'
import { RealSessionBuilder } from './real-session-builder'
import { type ElectronApplication, expect, type Page, test } from './test'
-// A seeded session has no generated title, so every label falls back to the
-// session preview — the first 60 characters of the first user message.
+// The builder-provided title now labels the sidebar row directly (seeded
+// sessions no longer fall back to the first-user-message preview).
const SESSION_TITLE = 'E2E attached image session'
const CAPTION = 'E2E attached image must survive a relaunch'
const IMAGE_DIR = 'Application Support/e2e shots'
@@ -90,7 +90,7 @@ async function setupSeededDesktop(): Promise<SeededFixture> {
}
function sessionRow(page: Page) {
- return page.locator('[data-slot="sidebar"] button').filter({ hasText: CAPTION }).first()
+ return page.locator('[data-slot="sidebar"] button').filter({ hasText: SESSION_TITLE }).first()
}
// Inactive tabs stay mounted under a data-pane-hidden ancestor. Match the
@@ -172,13 +172,15 @@ test.describe('attached image resume', () => {
fixture = await setupSeededDesktop()
await waitForAppReady(fixture, 120_000)
- // The sidebar labels a session by its preview, so the caption has to lead
- // the persisted turn — a leading directive reads as a truncated file path.
+ // The sidebar labels a seeded session by its title. Whatever the label
+ // source, an attachment directive must never leak into it as a file path.
const row = sessionRow(fixture.page)
await row.waitFor({ state: 'visible', timeout: 60_000 })
const label = (await row.textContent())?.trim() ?? ''
- expect(label.startsWith(CAPTION), `sidebar label should open with the caption: ${label}`).toBe(true)
+ expect(label.startsWith(SESSION_TITLE), `sidebar label should open with the title: ${label}`).toBe(true)
+ expect(label, `sidebar label should not leak the image path: ${label}`).not.toContain(IMAGE_NAME)
+ expect(label, `sidebar label should not render the directive: ${label}`).not.toContain('@image:')
await openSeededSession(fixture.page)
await assertRendersThumbnail(fixture.page, 'first open')
diff --git a/apps/desktop/e2e/interim-messages.spec.ts b/apps/desktop/e2e/interim-messages.spec.ts
index 2f6da013912..e213af68859 100644
--- a/apps/desktop/e2e/interim-messages.spec.ts
+++ b/apps/desktop/e2e/interim-messages.spec.ts
@@ -20,16 +20,24 @@
*
* display.interim_assistant_messages: true (default)
* → ALL interim texts AND the final text must be visible in the
- * transcript.
+ * settled transcript.
*
* display.interim_assistant_messages: false
- * → only the final text is visible (no message.interim events emitted,
- * so all streamed interim text is replaced at message.complete).
+ * → no message.interim events are emitted, so no sealed interim bubbles
+ * are created while streaming. Since the post-turn stored-history
+ * reconcile (sessions.changed → reconcileActiveTranscript, commit
+ * 1a2b0ca8cb) converges the visible transcript to the persisted
+ * transcript — which has ALWAYS contained the mid-turn commentary as
+ * real assistant rows (that is what a resume shows, flag or no flag) —
+ * the settled DOM shows the whole turn as ONE assistant message
+ * containing commentary + final. The flag governs live sealing only.
+ * The test pins that converged single-message shape: every text
+ * appears exactly once, inside a single assistant message root.
*
* 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,
@@ -40,6 +48,17 @@ import { INTERIM_TEXTS, restartMockServer } from './mock-server'
// ─── Helpers ──────────────────────────────────────────────────────────
+/**
+ * Auto session titling (feat f726090d48, 2026-08-08) issues an auxiliary
+ * `title_generation` LLM call against the SAME provider as the chat turn.
+ * The mock server counts every completion request as a script turn, so the
+ * title call races the chat turn and steals a scripted interim turn (the
+ * stolen turn's text then never streams to the transcript). Disable the
+ * model-backed title upgrade — the instant derived title needs no LLM call —
+ * so the mock's script indices line up with real chat turns again.
+ */
+const DISABLE_AUTO_TITLE = 'auxiliary:\n title_generation:\n enabled: false'
+
/** Unique trigger keyword the mock server detects to switch to the script. */
const TRIGGER = 'E2E_INTERIM_TRIGGER'
@@ -72,7 +91,7 @@ async function sendInterimMessage(page: Page): Promise<void> {
)
// Give the renderer a moment to settle any final state updates
- // (hydration, session refresh) before asserting.
+ // (hydration, stored-history reconcile, session refresh) before asserting.
await page.waitForTimeout(2000)
}
@@ -90,11 +109,13 @@ async function countTranscriptMessagesContaining(page: Page, text: string): Prom
return page.evaluate(
(search) => {
const viewport = document.querySelector('[data-slot="aui_thread-viewport"]')
+
if (!viewport) {
return 0
}
let count = 0
+
const walker = document.createTreeWalker(
viewport,
NodeFilter.SHOW_ELEMENT,
@@ -102,29 +123,46 @@ async function countTranscriptMessagesContaining(page: Page, text: string): Prom
acceptNode: (node) => {
const el = node as HTMLElement
const directText = el.textContent ?? ''
+
if (!directText.includes(search)) {
return NodeFilter.FILTER_SKIP
}
+
// Only count leaf-ish elements to avoid double-counting.
const hasChildWithText = Array.from(el.children).some(
(child) => (child.textContent ?? '').includes(search),
)
+
if (hasChildWithText) {
return NodeFilter.FILTER_SKIP
}
+
return NodeFilter.FILTER_ACCEPT
},
},
)
+
while (walker.nextNode()) {
count++
}
+
return count
},
text,
)
}
+/** Count assistant message roots in the settled transcript. */
+async function countAssistantMessageRoots(page: Page): Promise<number> {
+ return page.evaluate(() => {
+ const viewport = document.querySelector('[data-slot="aui_thread-viewport"]')
+
+ return viewport
+ ? viewport.querySelectorAll('[data-slot="aui_assistant-message-root"]').length
+ : 0
+ })
+}
+
// ─── Flag ON: interim_assistant_messages = true (default) ─────────────
test.describe('interim assistant messages — flag ON (default)', () => {
@@ -134,7 +172,7 @@ test.describe('interim assistant messages — flag ON (default)', () => {
test.beforeAll(async () => {
restartMockServer()
- fixture = await setupMockBackend()
+ fixture = await setupMockBackend({ extraConfig: DISABLE_AUTO_TITLE })
await waitForAppReady(fixture, 120_000)
})
@@ -147,8 +185,10 @@ test.describe('interim assistant messages — flag ON (default)', () => {
await sendInterimMessage(page)
// Every interim text (turns with visible text + tool calls) must be
- // present in the transcript as its own sealed message — NOT wiped by
- // message.complete.
+ // present in the settled transcript — NOT wiped by message.complete.
+ // (Live, each seals as its own bubble; the post-turn stored-history
+ // reconcile then converges the turn into one assistant message that
+ // still carries all of them.)
for (const interimText of INTERIM_TEXTS.interims) {
await expect
.poll(
@@ -165,6 +205,13 @@ test.describe('interim assistant messages — flag ON (default)', () => {
{ timeout: 15_000, message: 'final text should be visible' },
)
.toBeGreaterThanOrEqual(1)
+
+ // No duplicates: the reconcile must CONVERGE (replace the sealed live
+ // bubbles), never render a stored copy alongside a live one.
+ for (const text of [...INTERIM_TEXTS.interims, INTERIM_TEXTS.finalText]) {
+ const count = await countTranscriptMessagesContaining(page, text)
+ expect(count, `"${text}" must not be duplicated after reconcile`).toBe(1)
+ }
})
})
@@ -179,6 +226,7 @@ test.describe('interim assistant messages — flag OFF', () => {
restartMockServer()
fixture = await setupMockBackend({
extraDisplayConfig: ' interim_assistant_messages: false',
+ extraConfig: DISABLE_AUTO_TITLE,
})
await waitForAppReady(fixture, 120_000)
})
@@ -187,7 +235,7 @@ test.describe('interim assistant messages — flag OFF', () => {
await fixture?.cleanup()
})
- test('only the final response is visible; all interim texts are wiped', async () => {
+ test('settled transcript converges to stored history as a single turn message', async () => {
const page = fixture.page
await sendInterimMessage(page)
@@ -199,17 +247,29 @@ test.describe('interim assistant messages — flag OFF', () => {
)
.toBeGreaterThanOrEqual(1)
- // NONE of the interim texts should be visible — with the flag off,
- // the tui_gateway never installs interim_assistant_callback, so no
- // message.interim events are emitted. All streamed interim text is
- // accumulated into the streaming bubble and replaced by
- // message.complete.
- for (const interimText of INTERIM_TEXTS.interims) {
- const count = await countTranscriptMessagesContaining(page, interimText)
- expect(
- count,
- `interim text "${interimText}" should NOT be visible when flag is off`,
- ).toBe(0)
+ // With the flag off, the tui_gateway never installs
+ // interim_assistant_callback, so no message.interim events fire and no
+ // sealed interim bubbles are created while streaming. After
+ // message.complete, the stored-history reconcile (sessions.changed →
+ // reconcileActiveTranscript) converges the view to the persisted
+ // transcript, which contains the mid-turn commentary as real assistant
+ // rows — exactly what a resume of this session would show. Pin that
+ // converged shape: ONE assistant message root for the whole turn…
+ await expect
+ .poll(
+ () => countAssistantMessageRoots(page),
+ { timeout: 15_000, message: 'the settled turn should render as one assistant message' },
+ )
+ .toBe(1)
+
+ // …containing every commentary text and the final text exactly once.
+ for (const text of [...INTERIM_TEXTS.interims, INTERIM_TEXTS.finalText]) {
+ await expect
+ .poll(
+ () => countTranscriptMessagesContaining(page, text),
+ { timeout: 15_000, message: `"${text}" should appear exactly once in the converged turn` },
+ )
+ .toBe(1)
}
})
})
diff --git a/apps/desktop/e2e/session-compression-and-queue-stop.spec.ts b/apps/desktop/e2e/session-compression-and-queue-stop.spec.ts
index e48c52cda2b..0bcabf236b0 100644
--- a/apps/desktop/e2e/session-compression-and-queue-stop.spec.ts
+++ b/apps/desktop/e2e/session-compression-and-queue-stop.spec.ts
@@ -57,6 +57,23 @@ test.describe('session compression', () => {
await send(page, 'E2E_COMPRESSION_THIRD')
await expect.poll(() => receivedUserTexts().filter(text => text === 'E2E_COMPRESSION_THIRD').length).toBe(1)
+ // The mock receiving the third prompt does not mean the TURN is over —
+ // /compress on a busy session errors with "session busy — /interrupt the
+ // current turn before /compress". Wait for the third reply to render and
+ // for the composer to leave its busy state (no Stop affordance) first.
+ await page.waitForFunction(
+ expected =>
+ ((document.querySelector('[data-slot="aui_thread-viewport"]')?.textContent ?? '').split(expected).length - 1) >= 3,
+ reply,
+ { timeout: 90_000 }
+ )
+ await expect
+ .poll(
+ () => page.locator('[data-slot="composer-root"] button[aria-label="Stop"]').count(),
+ { timeout: 30_000, message: 'turn should settle before /compress' }
+ )
+ .toBe(0)
+
// This test covers compression and continuation, not slash completion.
// Insert the complete command atomically and click Send so an async
// completion response cannot consume Enter as a picker acceptance.
@@ -89,6 +106,8 @@ test.describe('session compression in progress', () => {
protect_first_n: 0
protect_last_n: 1
auxiliary:
+ title_generation:
+ enabled: false
compression:
provider: custom
model: mock-model`,
@@ -124,7 +143,11 @@ auxiliary:
await expect(page.getByRole('status', { name: 'Summarizing thread' }).last()).toBeVisible()
const primary = page.locator('[data-slot="composer-root"] button[type="submit"]')
- await expect(primary).toHaveAttribute('aria-label', 'Queue message')
+ // Since "running is not busy" (3bc52fb9df) an empty composer mid-turn
+ // shows Stop — the Queue affordance appears once a payload is typed, and
+ // the Enter path below still queues instead of steering while compaction
+ // holds the turn.
+ await expect(primary).toHaveAttribute('aria-label', 'Stop')
await send(page, queued)
await expect(page.getByText('1 Queued')).toBeVisible()
diff --git a/apps/desktop/e2e/sidebar-states.spec.ts b/apps/desktop/e2e/sidebar-states.spec.ts
index 29e12debd2f..647a876b93c 100644
--- a/apps/desktop/e2e/sidebar-states.spec.ts
+++ b/apps/desktop/e2e/sidebar-states.spec.ts
@@ -30,6 +30,18 @@ const SESSION_RUNNING_DOT_LABEL = 'Session running'
/** Finished-unread dot aria-label. */
const UNREAD_DOT_LABEL = 'Finished — unread'
+/**
+ * The auto-title auxiliary call hits the SAME mock provider as the chat turn,
+ * and its request carries the user's message — trigger keyword included. The
+ * mock's trigger matching is text-based, so the title call consumes a script
+ * index: the real chat turn then gets turn 2 (final answer, NO tool calls),
+ * the background process is never spawned, and the bg dot never appears.
+ * Whether that happens depends on which request lands first — the CI flake
+ * these specs had. Disable auto-title so script indices line up with real
+ * chat turns (same fix as interim-messages.spec.ts).
+ */
+const DISABLE_AUTO_TITLE = 'auxiliary:\n title_generation:\n enabled: false'
+
/** Send a message and wait for the final response to appear. */
async function sendMessageAndWait(
page: Page,
@@ -67,7 +79,7 @@ test.describe('sidebar states — background process and subagent', () => {
test.beforeAll(async () => {
restartMockServer()
- fixture = await setupMockBackend()
+ fixture = await setupMockBackend({ extraConfig: DISABLE_AUTO_TITLE })
await waitForAppReady(fixture, 120_000)
})
@@ -120,22 +132,32 @@ test.describe('sidebar states — subagent and background dot coexist', () => {
test.describe.configure({ mode: 'serial' })
let fixture: MockBackendFixture
+ // Hold the background process open until the test releases it. Without the
+ // sentinel the process is a bare `sleep 5` racing the agent turn (two model
+ // trips + a real subagent spawn): on a loaded runner the turn outlives the
+ // sleep, the process is reaped mid-turn, and the dot never appears at all —
+ // the CI flake this spec had.
+ const bgRelease = createBackgroundReleaseHandle()
test.beforeAll(async () => {
restartMockServer()
- fixture = await setupMockBackend()
+ fixture = await setupMockBackend({
+ extraConfig: DISABLE_AUTO_TITLE,
+ mockServer: { backgroundReleasePath: bgRelease.path },
+ })
await waitForAppReady(fixture, 120_000)
})
test.afterAll(async () => {
+ bgRelease.release()
await fixture?.cleanup()
+ bgRelease.cleanup()
})
test('background dot visible while subagent runs', async () => {
const page = fixture.page
- // Start the turn but DON'T wait for the final answer yet — we want
- // to assert the background dot is visible WHILE the subagent runs.
+ // Start the turn — a held background process plus a real subagent.
const composer = page.locator('[contenteditable="true"]').first()
await composer.waitFor({ state: 'visible', timeout: 10_000 })
await composer.click()
@@ -149,29 +171,45 @@ test.describe('sidebar states — subagent and background dot coexist', () => {
{ timeout: 15_000 },
)
- // The background process (sleep 5) should show a "Background task
- // running" dot while the subagent is also running.
+ // While the turn is busy the dot-state priority paints the session as
+ // "working" ('Session running') — that claim OUTRANKS 'background', so
+ // polling for the bg dot mid-turn races the turn length against the poll
+ // budget. Wait for the turn to END (final text + running dot cleared),
+ // then assert the background dot as a stable, sentinel-held state.
+ await page.waitForFunction(
+ (text) => (document.body.textContent ?? '').includes(text),
+ SIDEBAR_CROSS_TEXTS.finalText,
+ { timeout: 90_000 },
+ )
+ await expect
+ .poll(
+ () => page.locator(`[aria-label="${SESSION_RUNNING_DOT_LABEL}"]`).count(),
+ { timeout: 30_000, message: 'session running dot should disappear after turn completes' },
+ )
+ .toBe(0)
+
+ // The background process is held open by the sentinel, so the bg dot is
+ // a stable state — poll only to absorb the event-driven flip landing a
+ // tick after the running dot clears.
await expect
.poll(
() => page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count(),
- { timeout: 30_000, message: 'background dot should appear while subagent runs' },
+ { timeout: 30_000, message: 'background dot should be visible after turn completes' },
)
.toBeGreaterThan(0)
- // Evidence: the background dot is visible while the subagent runs.
+ // Evidence: the background dot is visible while the process runs.
await page.screenshot({ path: 'test-results/bg-dot-while-subagent-runs.png' })
- // Now wait for the final answer to appear.
- await page.waitForFunction(
- (text) => (document.body.textContent ?? '').includes(text),
- SIDEBAR_CROSS_TEXTS.finalText,
- { timeout: 90_000 },
- )
-
- // After the turn + auto-dismiss, the background dot should be gone.
- await page.waitForTimeout(8000)
- const bgCount = await page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count()
- expect(bgCount, 'background dot should be gone after process exits').toBe(0)
+ // Release the process; the dot should clear on the completion event —
+ // event-driven, not a fixed sleep.
+ bgRelease.release()
+ await expect
+ .poll(
+ () => page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count(),
+ { timeout: 30_000, message: 'background dot should be gone after process exits' },
+ )
+ .toBe(0)
})
})
@@ -190,6 +228,7 @@ test.describe('sidebar states — cross-session dot transition', () => {
test.beforeAll(async () => {
restartMockServer()
fixture = await setupMockBackend({
+ extraConfig: DISABLE_AUTO_TITLE,
mockServer: { backgroundReleasePath: bgRelease.path },
})
await waitForAppReady(fixture, 120_000)
@@ -213,14 +252,13 @@ test.describe('sidebar states — cross-session dot transition', () => {
await composer.type('E2E_SIDEBAR_CROSS', { delay: 20 })
await page.keyboard.press('Enter')
- // Wait for the background dot to appear.
- await expect
- .poll(
- () => page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count(),
- { timeout: 30_000, message: 'background dot should appear' },
- )
- .toBeGreaterThan(0)
-
+ // While the turn is busy the dot-state priority paints the session as
+ // "working" ('Session running') — that claim OUTRANKS 'background', so
+ // polling for the bg dot mid-turn races the turn length (two model trips
+ // + a real subagent spawn) against the poll budget: the CI flake this
+ // spec had. Wait for the turn to END first, then assert the bg dot as a
+ // stable, sentinel-held state.
+ //
// The final answer text streams before message.complete, so text visibility
// alone is not a completion barrier. Wait for the foreground-running state
// to clear before asserting the background-process state.
@@ -236,11 +274,16 @@ test.describe('sidebar states — cross-session dot transition', () => {
)
.toBe(0)
- // The background dot must still be visible: the turn is done but the
+ // The background dot must be visible now: the turn is done but the
// process is held open by the sentinel, so this is a stable state rather
- // than a window we have to catch in time.
- const bgDuringTurn = await page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count()
- expect(bgDuringTurn, 'background dot should still be visible after turn completes').toBeGreaterThan(0)
+ // than a window we have to catch in time. Poll to absorb the event-driven
+ // flip landing a tick after the running dot clears.
+ await expect
+ .poll(
+ () => page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count(),
+ { timeout: 30_000, message: 'background dot should be visible after turn completes' },
+ )
+ .toBeGreaterThan(0)
// Evidence: bg dot visible on session A while its turn is done but the
// background process hasn't exited yet.
diff --git a/apps/desktop/e2e/tile-unread-bug.spec.ts b/apps/desktop/e2e/tile-unread-bug.spec.ts
index 7a676798f56..379abda9ad5 100644
--- a/apps/desktop/e2e/tile-unread-bug.spec.ts
+++ b/apps/desktop/e2e/tile-unread-bug.spec.ts
@@ -36,6 +36,18 @@ const BG_DOT_LABEL = 'Background task running'
/** Foreground turn-running dot aria-label. */
const SESSION_RUNNING_DOT_LABEL = 'Session running'
+/**
+ * The auto-title auxiliary call hits the SAME mock provider as the chat turn,
+ * and its request carries the user's message — trigger keyword included. The
+ * mock's trigger matching is text-based, so the title call consumes a script
+ * index: the real chat turn then gets turn 2 (final answer, NO tool calls),
+ * the background process is never spawned, and the bg dot never appears.
+ * Whether that happens depends on which request lands first — the CI flake
+ * this spec had. Disable auto-title so script indices line up with real chat
+ * turns (same fix as interim-messages.spec.ts).
+ */
+const DISABLE_AUTO_TITLE = 'auxiliary:\n title_generation:\n enabled: false'
+
/** Locate a session's sidebar row by its preview text. */
function sessionRow(page: import('@playwright/test').Page, text: string) {
return page.locator('[data-slot="sidebar"] button').filter({ hasText: text }).first()
@@ -59,13 +71,13 @@ async function startTurnAndSwitchAway(page: import('@playwright/test').Page) {
{ timeout: 15_000 },
)
- // Wait for the background dot — confirms the turn is running.
- await expect
- .poll(
- () => page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count(),
- { timeout: 30_000, message: 'background dot should appear' },
- )
- .toBeGreaterThan(0)
+ // NOTE: while the turn is busy the dot-state priority paints the session as
+ // "working" ('Session running'), which OUTRANKS the background claim — the
+ // 'Background task running' dot only appears once the turn completes while
+ // the (sentinel-held) process is still alive. Polling for the bg dot mid-turn
+ // races the turn length (two model trips + a real subagent spawn) against
+ // the poll budget, which is exactly the flake this spec had on CI. So: wait
+ // for the turn to END first, then assert the bg dot as a stable state.
// The final answer text streams before message.complete, so text visibility
// alone is not a completion barrier. Wait for the foreground-running state
@@ -82,11 +94,29 @@ async function startTurnAndSwitchAway(page: import('@playwright/test').Page) {
)
.toBe(0)
- // The background dot must still be visible: the turn is done but the
- // process is held open by the sentinel, so this is a stable state rather
- // than a window we have to catch in time.
- const bgDuringTurn = await page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count()
- expect(bgDuringTurn, 'background dot should still be visible after turn completes').toBeGreaterThan(0)
+ // The background dot must be visible now: the turn is done but the process
+ // is held open by the sentinel, so this is a stable state rather than a
+ // window we have to catch in time. Poll rather than sampling once — the
+ // dot flip is event-driven off the busy=false publish and can land a tick
+ // after the running dot clears.
+ await expect
+ .poll(
+ async () => {
+ const labels = await page.evaluate(() =>
+ Array.from(document.querySelectorAll('[role="status"],[aria-label]')).map(
+ el => `${el.tagName}:${el.getAttribute('aria-label')}`,
+ ),
+ )
+ console.log('DOT-DEBUG labels:', JSON.stringify(labels))
+ const sidebarText = await page.evaluate(
+ () => document.querySelector('[data-slot="sidebar"]')?.textContent?.slice(0, 300) ?? 'NO-SIDEBAR',
+ )
+ console.log('DOT-DEBUG sidebar:', JSON.stringify(sidebarText))
+ return page.locator(`[aria-label="${BG_DOT_LABEL}"]`).count()
+ },
+ { timeout: 30_000, message: 'background dot should be visible after turn completes' },
+ )
+ .toBeGreaterThan(0)
// Switch to a new session — session A is no longer $selectedStoredSessionId.
// This is required: openSessionTile bails if the session is already selected.
@@ -121,6 +151,7 @@ test.describe('sidebar states — tab (hidden) unread is correct', () => {
test.beforeAll(async () => {
restartMockServer()
fixture = await setupMockBackend({
+ extraConfig: DISABLE_AUTO_TITLE,
mockServer: { backgroundReleasePath: bgRelease.path },
})
await waitForAppReady(fixture, 120_000)
@@ -142,7 +173,10 @@ test.describe('sidebar states — tab (hidden) unread is correct', () => {
// ⌃-click opens the session as a TAB (center dock = stacked, not visible
// unless it's the active tab). The session is NOT on screen.
- const row = sessionRow(page, SIDEBAR_CROSS_TEXTS.finalText)
+ //
+ // With auto-title disabled the sidebar row is titled by the user's
+ // message (the trigger keyword), not the assistant's final text.
+ const row = sessionRow(page, 'E2E_SIDEBAR_CROSS')
await row.click({ modifiers: ['Control'] })
await page.waitForTimeout(2000)
@@ -182,6 +216,7 @@ test.describe.skip('sidebar states — split (visible) unread bug (RED)', () =>
test.beforeAll(async () => {
restartMockServer()
fixture = await setupMockBackend({
+ extraConfig: DISABLE_AUTO_TITLE,
mockServer: { backgroundReleasePath: bgRelease.path },
})
await waitForAppReady(fixture, 120_000)
@@ -204,7 +239,8 @@ test.describe.skip('sidebar states — split (visible) unread bug (RED)', () =>
// Drag the session row from the sidebar to the right edge of the workspace
// zone to create a SPLIT (side-by-side) tile. This triggers the real
// startSessionDrag → onCommit → openSessionTile(id, 'right', anchor) path.
- const row = sessionRow(page, SIDEBAR_CROSS_TEXTS.finalText)
+ // With auto-title disabled the sidebar row is titled by the user's message.
+ const row = sessionRow(page, 'E2E_SIDEBAR_CROSS')
const rowBox = await row.boundingBox()
expect(rowBox, 'session row must be visible').not.toBeNull()
diff --git a/apps/desktop/e2e/warm-resume-jitter.spec.ts b/apps/desktop/e2e/warm-resume-jitter.spec.ts
index dbc0fe5dd11..3d3f558d617 100644
--- a/apps/desktop/e2e/warm-resume-jitter.spec.ts
+++ b/apps/desktop/e2e/warm-resume-jitter.spec.ts
@@ -10,7 +10,7 @@
* `syncSessionStateToView` to fire a second `setMessages` — a visual
* flicker as the transcript DOM was updated.
*
- * This test pre-seeds a 32-message session into state.db, boots the app,
+ * This test pre-seeds a session into state.db, boots the app,
* clicks the session (cold resume — populates the warm cache), navigates
* away to a new chat, then clicks back (warm resume). Two detectors run:
*
@@ -50,8 +50,16 @@ const SESSION_TITLE = 'E2E Warm Resume Jitter Test'
// renderer's keep-alive visibility policy instead of relying on DOM order.
const SURFACE = '[data-composer-target]:not([data-pane-hidden] [data-composer-target])'
const ALL_SURFACES = '[data-composer-target]'
-/** 32 messages (16 user/assistant pairs) — enough DOM churn for detection. */
-const MESSAGE_COUNT = 32
+/**
+ * 16 messages (8 user/assistant pairs) — enough DOM churn for detection while
+ * still fitting a hot-hidden pane's retention budget. A kept-alive pane keeps
+ * only its live tail (HIDDEN_TRANSCRIPT_RENDER_BUDGET = 40 weight units in
+ * thread/list.tsx); 16 short messages ≈ 32 units, so the whole transcript
+ * survives hiding. Above the budget, reveal legitimately backfills trimmed
+ * turns (additive DOM bursts) — that is paging, not the repaint bug this
+ * suite hunts, and it would drown the detectors.
+ */
+const MESSAGE_COUNT = 16
/** Seeded PRNG so the generated content is deterministic across runs. */
const RNG_SEED = 42
@@ -174,7 +182,16 @@ async function installRenderCounter(
: surfaces.at(-1)
const viewport = surface?.querySelector('[data-slot="aui_thread-viewport"]')
if (!viewport) {
- throw new Error('Thread viewport not found before warm resume')
+ const diag = [...document.querySelectorAll(allSelector)].map(s => ({
+ hidden: Boolean(s.closest('[data-pane-hidden]')),
+ target: s.getAttribute('data-composer-target'),
+ hasViewport: Boolean(s.querySelector('[data-slot="aui_thread-viewport"]')),
+ textLen: (s.querySelector('[data-slot="aui_thread-viewport"]')?.textContent ?? '').length,
+ head: (s.querySelector('[data-slot="aui_thread-viewport"]')?.textContent ?? '').slice(0, 80),
+ tail: (s.querySelector('[data-slot="aui_thread-viewport"]')?.textContent ?? '').slice(-80),
+ includesExpected: expected ? (s.querySelector('[data-slot="aui_thread-viewport"]')?.textContent ?? '').includes(expected) : null,
+ }))
+ throw new Error('Thread viewport not found before warm resume DIAG=' + JSON.stringify(diag) + ' expected=' + expected)
}
const state = { bursts: 0, mutations: 0, timeline: [] as number[], stopped: false, reconciles: 0 }