Skip to content

fix(core): T9 concurrent-send test raced HTTP arrival order — pace off the expansion instead - #394

Merged
omridevk merged 3 commits into
mainfrom
fix/t9-same-tick-arrival-race
Aug 10, 2026
Merged

fix(core): T9 concurrent-send test raced HTTP arrival order — pace off the expansion instead#394
omridevk merged 3 commits into
mainfrom
fix/t9-same-tick-arrival-race

Conversation

@omridevk

@omridevk omridevk commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Found by PR #393's shard-3 red; RCA structurally exonerated that PR (no deadline-wrapped await exists in T9's path).

T9 fired two chat.sends from one tick over two independent HTTP requests and asserted transcript order — a property of which POST reached the server first, which nothing guarantees (liveRuns.serialize is FIFO by arrival; the CI runner's loopback can complete handshakes out of order). The rewrite waits for the first send to enter its slow expansion (new onSlowExpansion hook on the test's paced extension) before releasing the second, so the overlap invariant (peakLiveRuns === 1) and the #332 ordering guarantee are exercised deterministically.

Mutation-proof: with serialize broken the rewritten test fails with the exact CI diff — it does not pass vacuously. 20× idle + 20× under 32-way CPU load, all green; core suite 433 passed; fallow 0 introduced.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved coverage for messages sent while attachment expansion is in progress.
    • Added synchronization to verify both sends complete successfully, maintain message order, and avoid overlapping live runs.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@omridevk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dee7d585-e0d8-488b-96dc-fcc10e175184

📥 Commits

Reviewing files that changed from the base of the PR and between 3b58542 and a6ae846.

📒 Files selected for processing (57)
  • apps/conciv/tsconfig.json
  • apps/site/tsconfig.json
  • apps/storybook/tsconfig.json
  • e2e/harnesses/tsconfig.node.json
  • e2e/vite-preact-component/tsconfig.app.json
  • e2e/vite-preact-component/tsconfig.node.json
  • e2e/vite-react-component/tsconfig.app.json
  • e2e/vite-react-component/tsconfig.node.json
  • e2e/vite-react/tsconfig.app.json
  • e2e/vite-react/tsconfig.node.json
  • e2e/vite-solid-component/tsconfig.app.json
  • e2e/vite-solid-component/tsconfig.node.json
  • e2e/vite-solid/tsconfig.app.json
  • e2e/vite-solid/tsconfig.node.json
  • e2e/vite-vanilla/tsconfig.json
  • packages/bundle-size/tsconfig.json
  • packages/cli/tsconfig.json
  • packages/contract/tsconfig.json
  • packages/core/test/chat/concurrent-send.it.test.ts
  • packages/core/tsconfig.cards.json
  • packages/core/tsconfig.json
  • packages/extension-compiler/tsconfig.json
  • packages/extension-testkit/tsconfig.json
  • packages/extension/tsconfig.json
  • packages/extensions/ios/tsconfig.json
  • packages/extensions/page/test/tsconfig.json
  • packages/extensions/page/tsconfig.json
  • packages/extensions/page/tsconfig.refs.json
  • packages/extensions/tanstack/test/host/conciv/tsconfig.json
  • packages/extensions/tanstack/test/host/tsconfig.json
  • packages/extensions/test-runner/tsconfig.json
  • packages/extensions/try-it/tsconfig.json
  • packages/grab/tsconfig.json
  • packages/harness-init/tsconfig.json
  • packages/harness/tsconfig.json
  • packages/it/tsconfig.json
  • packages/mascot/tsconfig.json
  • packages/oxlint-plugin/tsconfig.json
  • packages/page/tsconfig.json
  • packages/plugin/tsconfig.json
  • packages/preact/tsconfig.json
  • packages/publish/tsconfig.json
  • packages/react/tsconfig.json
  • packages/serve/tsconfig.json
  • packages/solid-diffs/tsconfig.json
  • packages/solid-streamdown/tsconfig.json
  • packages/solid/tsconfig.json
  • packages/storage-history/tsconfig.json
  • packages/tools/tsconfig.cards.json
  • packages/tools/tsconfig.json
  • packages/ui-kit-chat-tools/tsconfig.json
  • packages/ui-kit-chat/tsconfig.json
  • packages/ui-kit-system/tsconfig.json
  • packages/ui-kit-tap/tsconfig.json
  • packages/uno-preset/tsconfig.json
  • packages/vitest-config/tsconfig.json
  • tsconfig.base.json
📝 Walkthrough

Walkthrough

The integration test now waits for slow attachment expansion before issuing the second send. It continues to verify that both sends complete without overlapping live runs and preserve message order.

Changes

Concurrent send timing test

Layer / File(s) Summary
Expansion entry synchronization
packages/core/test/chat/concurrent-send.it.test.ts
pacedExtension reports when slow expansion starts. The test waits for this event before sending the second message and validates the mid-expansion scenario.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the concurrent-send test race and the change to pace the expansion instead of HTTP arrival order.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/t9-same-tick-arrival-race

Comment @coderabbitai help to get the list of available commands.

T9's same-tick case fired both sends from one tick and then asserted the
transcript order. That order is an arrival property of two independent HTTP
requests, not one the server can promise: whichever POST reached the session
first entered the per-session serialize queue first. On a loaded CI runner the
fast second send won that race and the transcript came back as
['same tick second', 'same tick first'].

The second send now goes out once the first turn's attachment expander has been
entered, so it still lands while the first holds the serialize lock - the
overlap the test exists to rule out - while the order it asserts is the one the
server actually owns. Verified by mutation: dropping the tail chain from
liveRuns.serialize reproduces the exact CI diff, and the reworked test catches
it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omridevk
omridevk force-pushed the fix/t9-same-tick-arrival-race branch from 720e321 to 2d9cfca Compare August 10, 2026 18:32
omridevk and others added 2 commits August 10, 2026 22:33
…ling a flag

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ode 22 baseline)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omridevk
omridevk merged commit 792796a into main Aug 10, 2026
42 of 44 checks passed
@omridevk
omridevk deleted the fix/t9-same-tick-arrival-race branch August 10, 2026 21:18
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