Skip to content

test: replay seeded events before live ones in run state reconciliation tests - #2054

Merged
4pmtong merged 1 commit into
mainfrom
fix/run-reconciliation-test-cursor
Oct 14, 2026
Merged

4pmtong merged 1 commit into
mainfrom
fix/run-reconciliation-test-cursor

Conversation

@4pmtong

@4pmtong 4pmtong commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Related Issue

Description

Problem. Two tests in test/unit/service/runStateReconciliation.test.ts fail on main:

  • "keeps assistant.final distinct from Run completion and receives a later failure"
  • "finishes the terminal duration GET while React retires the companion stream"

CI did not catch it because the frontend job runs only the test files a pull request changes, and this file was not changed.

Cause. Since #1969, a Run's companion event stream resumes from the older of the timeline and the Run state it keeps in step with, so that both receive every event. In these tests the Run state comes from a summary, which carries no event sequence, so the stream starts from the beginning and the server would replay events 1 and 2 first. The tests still sent event 3 right away, which the stream correctly treats as a gap.

Fix. Test-only. Both tests now replay the seeded events 1 and 2 before event 3, as the server does, and a helper checks that the stream starts from the beginning. The app code is unchanged.

Testing Evidence (REQUIRED)

  • npx vitest run test/unit/service/runStateReconciliation.test.ts: 44 passed (2 failed before).

  • ESLint and Prettier pass on the changed file.

  • I have included human-verified testing evidence in this PR.

  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).

  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@4pmtong
4pmtong marked this pull request as ready for review October 14, 2026 08:04

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

Claude Code Review is paused for this repository because its GitHub organization is not linked to your Claude organization.

To turn it back on, one person needs both roles: owner of the GitHub organization (or the account owner, for a personal repository) and admin or owner of your Claude organization. If that is not you, pass this on to someone who is.

Open Organization settings, Git providers and click Link next to the GitHub organization's name. If it is not listed, click Enable GitHub integration or Connect your GitHub first, whichever the page shows.

New pull requests are then reviewed as before. To get a review on one that is already open, someone with write access can comment @claude review.

Tip: disable this comment in your organization's Code Review settings.

@4pmtong
4pmtong merged commit 98ce9fb into main Oct 14, 2026
10 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.

1 participant