Repository navigation
fix(server): forks of compacted Claude threads keep their compaction - #27563
VendettaGhub wants to merge 2 commits into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The assessed change moves the SDK's release-age exemption to version 0.3.312 while keeping it restricted to one exact version. It does not directly change runtime defaults or disable static-analysis diagnostics. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
SDK update and fork transcript coverage apps/server/package.json, pnpm-workspace.yaml, apps/server/src/orchestration-v2/Adapters/ClaudeAgentSdkQueryRunner.test.ts |
The SDK version and release-age exclusion move from 0.3.276 to 0.3.312. The fork test adds compact-boundary fixture data and checks that preserved-message references use UUIDs from the copied transcript. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Issue 27552 describes the compact-boundary UUID defect in Claude forks. This pull request upgrades the SDK and adds regression coverage for remapped preserved-segment references.
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 453f0
-
No merge-blocking risk was identified in the SDK update or fork regression test.
Pre-merge checks: 
4
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Note Written by Verified in a real dev environmentverified unchanged head
live transcript inspection: Not verifiednative desktop/mobile shells, windows/macOS, remote relay/tunnel, and the original multi-day oversized-session compaction cascade. main reproduced the dangling-reference defect, but this smaller real conversation still answered without an auto-compaction cascade. no latency improvement claim. claude used the real local provider proxy and installed CLI |
|
Closing as superseded by #27577, which fixes #27552 by upgrading the Claude Agent SDK to 0.3.284 and adds a regression test for compaction references. This PR uses a newer SDK and checks the exact UUID-to-message mapping, but it doesn't provide a separate runtime fix. I won't pursue the additional test coverage here. Thanks to everyone who investigated and verified the fix! |



Problem
Forking a Claude thread that has been compacted makes the fork load the thread's full pre-compaction history. The fork's first message then sets off a chain of auto-compactions before Claude answers. In my case that was four compactions and about five minutes:
559K → 1.60M → 1.23M → 638K → 36.2K. Details and the investigation are in #27552.Cause: before 0.3.284,
forkSessionin@anthropic-ai/claude-agent-sdkgives copied messages new UUIDs but leaves the UUIDs inside each compaction boundary (compactMetadata.preservedSegmentandpreservedMessages) unchanged. In the fork they point at messages that don't exist, so Claude can't rebuild the compacted conversation. The server still pinned 0.3.276.Change
Raise the Agent SDK to
^0.3.312and update theminimumReleaseAgeExcludeentry and lockfile to match. 0.3.284 is the first release that remaps those references (bisected: 0.3.276–0.3.283 leave them dangling, 0.3.284 and later remap them). 0.3.312 is the newest version the release-age gate accepts today, and the lockfile resolves to it.The existing fork test in
ClaudeAgentSdkQueryRunner.test.tsnow writes a compaction boundary with preserved messages into its source transcript. It checks that every reference in the fork points at the forked copy of the right message.Scope and approval
Bug report: #27552. A very small fix of an obvious bug in an existing capability. Only the dependency version and one existing test change.
Verification
expected { …(3) } to deeply equal { …(3) }) and passes on 0.3.312.vp run --filter t3 typecheckpasses for the server on 0.3.312.ClaudeAgentSdkQueryRunner.test.ts: 7 passed, 3 skipped (POSIX-only) on Windows.ClaudeAdapterV2.test.tshas 13 failures on Windows. Unmodifiedmainwith 0.3.276 has the same 13, from Windows path escaping in the attachment tests and the win32 settings directory./compacts, then fork and resume: the first turn took 77,951 input tokens with 0.3.276 and 47,267 with 0.3.314.Not checked: a live fork from a running T3 build with this change. CI runs the Linux suites.
Made with Claude Opus 5.5 in Claude Code (T3 Code), reviewed by GPT-6.1 Terra and DeepSeek V4.1 Flash.