Skip to content

fix(session): preserve live tail messages#1750

Merged
src-opn merged 1 commit into
devfrom
message-disappearing-bug
May 11, 2026
Merged

fix(session): preserve live tail messages#1750
src-opn merged 1 commit into
devfrom
message-disappearing-bug

Conversation

@src-opn
Copy link
Copy Markdown
Collaborator

@src-opn src-opn commented May 11, 2026

Summary

  • Always merge live-only transcript tail messages with the latest snapshot so newly sent turns stay visible even if the snapshot endpoint lags after session.idle.
  • Removes the streaming-only gate from rendered session message derivation.
  • Adds regression coverage for the stale-snapshot/live-tail race.

Closes #1747

Evidence

Build verification

  • bun test apps/app/scripts/session-render-state.test.ts -- passed: 8 tests, 12 assertions.
  • pnpm --filter @openwork/app build -- passed.
  • pnpm --filter @openwork/app typecheck -- failed on existing unrelated TypeScript errors in connection/settings/desktop files; no errors were reported in the changed session files.

API verification

  • No API changes.

UI verification

  • No screenshot captured; this is a session render-state race covered by the focused regression test.

Test instructions

  1. Open an existing chat thread.
  2. Send several messages until the backend has a stale snapshot while live SSE has the newest tail.
  3. Verify the last user/assistant turn remains visible after the run becomes idle, without switching threads.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment May 11, 2026 4:29pm
openwork-den Ready Ready Preview, Comment May 11, 2026 4:29pm
openwork-den-worker-proxy Ready Ready Preview, Comment May 11, 2026 4:29pm
openwork-landing Ready Ready Preview, Comment, Open in v0 May 11, 2026 4:29pm
openwork-share Ready Ready Preview, Comment May 11, 2026 4:29pm

@src-opn
Copy link
Copy Markdown
Collaborator Author

src-opn commented May 11, 2026

Verification

  • bun test apps/app/scripts/session-render-state.test.ts passed: 8 tests, 12 assertions.
  • pnpm --filter @openwork/app build passed.
  • pnpm --filter @openwork/app typecheck failed before completion on existing unrelated TypeScript errors in connection/settings/desktop code; no reported errors were in the changed session render files.

This PR specifically covers the race where live transcript messages contain the latest tail while the snapshot still only contains earlier history.

@src-opn src-opn force-pushed the message-disappearing-bug branch from ce8ed8d to 41199b2 Compare May 11, 2026 16:28
@src-opn
Copy link
Copy Markdown
Collaborator Author

src-opn commented May 11, 2026

Rebase Verification

Rebased this PR onto latest origin/dev and resolved the conflict in session-surface.tsx by keeping the updated dev behavior while relying on deriveRenderedSessionMessages to always preserve live-only tail messages.

Verification after rebase:

  • bun test apps/app/scripts/session-render-state.test.ts passed: 8 tests, 12 assertions.
  • pnpm --filter @openwork/app build passed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Last 2 messages disappear from chat thread (v0.13.4/0.13.5)

1 participant