fix(web): sync share metadata and active-turn availability (#1306)

* fix(web): align sharing with session state

* fix(web): keep share state in sync

* fix(web): fail closed for trimmed active turns

* fix(web): refresh prepared share images

* fix(web): preserve sharing during queued thinking

* fix: track a stable active turn boundary

* fix: anchor active turns to persisted messages

* fix(web): include Pi reasoning in share metadata

* fix(hub): refresh queued thinking grace on retry

* test(web): isolate mobile thread scroll setup

* fix(hub): advance queued turn boundaries

* fix(hub): guard queued boundary advancement

* perf(web): precompute running turn sharing

* fix(hub): use hub time for turn boundaries

* perf(web): pause closed share metadata timer
This commit is contained in:
Ananovo
2026-08-04 11:18:08 +08:00
committed by GitHub
parent c3bed919b8
commit a0c676818f
20 changed files with 565 additions and 57 deletions
+27 -1
View File
@@ -86,7 +86,7 @@ test('exports a text-only user fallback alongside assistant DOM', async ({ page
await page.getByRole('button', { name: 'Open share preview' }).click()
const dialog = page.getByRole('dialog')
await expect(dialog.getByText(/请导出这一轮复杂对话/)).toBeVisible()
await expect(dialog.getByText(/这个失败不用说吧/)).toBeVisible()
await expect(dialog.getByText('Complex response fixture')).toBeVisible()
await dialog.screenshot({ path: testInfo.outputPath('fallback-preview.png') })
@@ -139,6 +139,32 @@ test('localizes the share dialog actions in Chinese', async ({ page }) => {
await expect(dialog.getByRole('button', { name: '下载' })).toBeVisible()
})
test('matches configured session-header metadata in the share preview', async ({ page }) => {
await page.addInitScript(() => localStorage.setItem('hapi-session-header-metadata', JSON.stringify({
showLabels: false,
agent: false,
model: false,
reasoning: false,
fastMode: false,
machine: false,
lastActive: false,
createdAt: true,
updatedAt: true,
worktree: false,
})))
await page.goto('/e2e-fixtures/share-turn-fixture.html')
await page.getByRole('button', { name: 'Open share preview' }).click()
const dialog = page.getByRole('dialog')
await expect(dialog.getByText('Aug 2, 2026, 10:00 AM', { exact: true })).toBeVisible()
await expect(dialog.getByText('Aug 2, 2026, 10:30 AM', { exact: true })).toBeVisible()
await expect(dialog.getByText('Created:', { exact: false })).toHaveCount(0)
await expect(dialog.getByText('codex', { exact: true })).toHaveCount(0)
await expect(dialog.getByText('fixture-host', { exact: false })).toHaveCount(0)
await expect(dialog.getByText('gpt-5.6-sol', { exact: true })).toHaveCount(0)
await expect(dialog.getByText('feat/share-turn-polish', { exact: false })).toHaveCount(0)
})
test('keeps code and image controls interactive in preview', async ({ page }, testInfo) => {
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
await page.goto('/e2e-fixtures/share-turn-fixture.html')