Skip to content

fix: refresh tool state during session sync#411

Merged
hsteude merged 1 commit into
mainfrom
rework-381-sync-pending
May 13, 2026
Merged

fix: refresh tool state during session sync#411
hsteude merged 1 commit into
mainfrom
rework-381-sync-pending

Conversation

@hsteude
Copy link
Copy Markdown
Contributor

@hsteude hsteude commented May 13, 2026

Summary

  • Replace the stale part-count session sync merge with a part-aware merge for loaded messages.
  • Allow full session sync to advance same-ID tool parts from pending/running to newer states while preserving newer SSE tool updates.
  • Preserve SSE-only messages and parts during full sync.

Testing

  • bun test tests/sync.test.ts
  • bun run build
  • bun run typecheck fails on existing project-wide TypeScript errors outside this change: src/app.tsx, src/context/server.tsx, src/context/theme.tsx, src/entry.tsx, src/pages/layout.tsx, and ../shared/proxy.ts.

Closes #379
Supersedes #381

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates session synchronization so full sync can refresh stale tool part states without discarding newer SSE-only updates.

Changes:

  • Adds part-aware message merging for session sync.
  • Ranks tool states to prefer newer progress while preserving newer local SSE updates.
  • Adds tests for stale pending tools, newer SSE tool updates, and SSE-only message/part preservation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app-prefixable/src/context/sync.tsx Introduces mergeSessionMessages and uses it during session sync.
app-prefixable/tests/sync.test.ts Adds coverage for tool-state merge behavior and SSE preservation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hsteude hsteude merged commit f3ea8b4 into main May 13, 2026
4 checks 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.

Fix tool call state getting stuck as pending after sync merge

2 participants