Skip to content

test(ai-chat): add edge-case tests for assistant ID reconciliation#969

Merged
threepointone merged 1 commit into
mainfrom
test/assistant-reconciliation-edge-cases
Feb 21, 2026
Merged

test(ai-chat): add edge-case tests for assistant ID reconciliation#969
threepointone merged 1 commit into
mainfrom
test/assistant-reconciliation-edge-cases

Conversation

@threepointone

Copy link
Copy Markdown
Contributor

Summary

Adds two additional test cases for the assistant ID reconciliation logic introduced in #958:

  • "does not reconcile when assistant content differs at the same position" — verifies that content-based matching does not produce false positives when the assistant text is different, even if the message is at the same position in the history.
  • "skips tool-bearing assistant messages during reconciliation without breaking cursor" — verifies that tool-call assistant messages are correctly excluded from content-based reconciliation, and that the cursor still advances properly for subsequent plain-text assistant messages.

These were identified during review of #958 but the PR was merged before they could be pushed.

Test plan

  • All 6 tests in merge-server-state.test.ts pass
  • All 23 tests in client-tool-duplicate-message.test.ts pass (no regressions)
  • Full test suite passes (654 agents + 201 ai-chat)

Made with Cursor

Extend merge-server-state tests with two cases: (1) verify reconciliation is skipped when assistant content differs at the same position, preserving both server and client assistant messages; (2) ensure assistant messages containing tool-call parts are skipped during reconciliation without breaking the message cursor or ordering (tool-bearing message is preserved and text assistant remains correct). Changes are in packages/ai-chat/src/tests/merge-server-state.test.ts.
@changeset-bot

changeset-bot Bot commented Feb 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 66347f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Feb 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@969
npm i https://pkg.pr.new/cloudflare/agents/@cloudflare/ai-chat@969
npm i https://pkg.pr.new/cloudflare/agents/@cloudflare/codemode@969
npm i https://pkg.pr.new/cloudflare/agents/hono-agents@969

commit: 66347f9

@threepointone
threepointone merged commit 672e560 into main Feb 21, 2026
4 checks passed
@threepointone
threepointone deleted the test/assistant-reconciliation-edge-cases branch February 21, 2026 20:36
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.

1 participant