fix(agent-adapter): reconcile Claude messages on reseed - #240
Merged
Conversation
Greptile SummaryThis PR reconciles Claude live and historical messages using stable provider IDs. The main changes are:
Confidence Score: 5/5The change looks mergeable after guarding deltas that arrive without a matching message start. Provider IDs are applied consistently across the main reviewed paths. A resumed or partial stream can assign an early delta to stale message state. The issue is limited to streams that do not begin with the expected start frame.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant SDK as Claude SDK
participant Adapter as Claude adapter
participant Store as Conversation store
SDK->>Adapter: message_start(provider ID)
SDK->>Adapter: content deltas
Adapter->>Store: Live chunks keyed by provider ID
SDK->>Adapter: Historical assistant row
Adapter->>Store: History chunk keyed by provider ID
Store->>Store: Reconcile history and live chunks
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant SDK as Claude SDK
participant Adapter as Claude adapter
participant Store as Conversation store
SDK->>Adapter: message_start(provider ID)
SDK->>Adapter: content deltas
Adapter->>Store: Live chunks keyed by provider ID
SDK->>Adapter: Historical assistant row
Adapter->>Store: History chunk keyed by provider ID
Store->>Store: Reconcile history and live chunks
Reviews (1): Last reviewed commit: "fix(agent-adapter): reconcile Claude mes..." | Re-trigger Greptile |
AprilNEA
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
devenv shell -- pnpm check:cidevenv shell -- pnpm test— 222 files and 1,734 tests passed.Checklist
pnpm check:ciandpnpm testboth pass (no Rust changes)WIRE_PROTOCOL_VERSIONdoes not require a bump