Skip to content

Fix duplicate chunk handling in ChunkedMessage.join#6613

Merged
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/0d1a3983
Jul 25, 2026
Merged

Fix duplicate chunk handling in ChunkedMessage.join#6613
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/0d1a3983

Conversation

@tim-smart

@tim-smart tim-smart commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ignore duplicate chunk indexes before updating join bookkeeping
  • add a regression test for duplicate delivery followed by successful assembly
  • add a patch changeset for effect

Testing

  • pnpm lint-fix
  • pnpm test packages/effect/test/unstable/eventlog/EventLogMessage.test.ts --run
  • pnpm check

Closes EFF-42
Closes #6612

Summary by CodeRabbit

  • Bug Fixes

    • Prevented duplicate event log chunks from being counted or overwriting existing data.
    • Improved reliability when assembling event log messages from multiple chunks.
  • Tests

    • Added coverage for duplicate chunks and successful message assembly.

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 25, 2026
@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f52d245

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions Bot added the 4.0 label Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d975c7b-cb04-4b07-9c1f-70721099ead5

📥 Commits

Reviewing files that changed from the base of the PR and between 0e50ec7 and f52d245.

📒 Files selected for processing (3)
  • .changeset/fix-eventlog-duplicate-chunks.md
  • packages/effect/src/unstable/eventlog/EventLogMessage.ts
  • packages/effect/test/unstable/eventlog/EventLogMessage.test.ts

📝 Walkthrough

Walkthrough

ChunkedMessage.join now ignores duplicate chunk indexes without updating assembly counts or byte totals. Tests cover duplicate handling and successful combination of distinct parts, and a patch changeset documents the fix.

Changes

Event log chunk assembly

Layer / File(s) Summary
Duplicate chunk handling
packages/effect/src/unstable/eventlog/EventLogMessage.ts, packages/effect/test/unstable/eventlog/EventLogMessage.test.ts, .changeset/fix-eventlog-duplicate-chunks.md
ChunkedMessage.join returns early for already-populated indexes, tests duplicate and distinct chunk joins, and adds a patch release note.

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

Suggested labels: bug

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The fix matches #6612 by ignoring duplicate chunk indexes before count/byte updates, preventing premature assembly and the reported crash.
Out of Scope Changes check ✅ Passed The changes are scoped to the duplicate-chunk fix, its regression test, and the release changeset.

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

@coderabbitai coderabbitai Bot added the bug Something isn't working label Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.64 KB 6.64 KB 0.00 KB (0.00%)
batching.ts 9.42 KB 9.42 KB 0.00 KB (0.00%)
brand.ts 6.20 KB 6.20 KB 0.00 KB (0.00%)
cache.ts 10.13 KB 10.13 KB 0.00 KB (0.00%)
config.ts 19.08 KB 19.08 KB 0.00 KB (0.00%)
differ.ts 18.41 KB 18.41 KB 0.00 KB (0.00%)
http-client.ts 20.73 KB 20.73 KB 0.00 KB (0.00%)
logger.ts 10.30 KB 10.30 KB 0.00 KB (0.00%)
metric.ts 8.56 KB 8.56 KB 0.00 KB (0.00%)
optic.ts 7.41 KB 7.41 KB 0.00 KB (0.00%)
pubsub.ts 14.17 KB 14.17 KB 0.00 KB (0.00%)
queue.ts 11.10 KB 11.10 KB 0.00 KB (0.00%)
schedule.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
schema-class.ts 18.16 KB 18.16 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 27.31 KB 27.31 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 24.16 KB 24.16 KB 0.00 KB (0.00%)
schema-string-transformation.ts 12.68 KB 12.68 KB 0.00 KB (0.00%)
schema-string.ts 10.36 KB 10.36 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.38 KB 14.38 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 20.94 KB 20.94 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 23.42 KB 23.42 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.30 KB 18.30 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.01 KB 18.01 KB 0.00 KB (0.00%)
schema-toFormatter.ts 17.86 KB 17.86 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 21.49 KB 21.49 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 18.55 KB 18.55 KB 0.00 KB (0.00%)
schema.ts 17.43 KB 17.43 KB 0.00 KB (0.00%)
stm.ts 12.07 KB 12.07 KB 0.00 KB (0.00%)
stream.ts 9.36 KB 9.36 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit bc1f358 into main Jul 25, 2026
17 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/0d1a3983 branch July 25, 2026 08:39
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Duplicate chunks can crash ChunkedMessage.join

1 participant