fix(session): backfill agent field when forking sessions with legacy messages#6962
Open
crayment wants to merge 1 commit intoanomalyco:devfrom
Open
fix(session): backfill agent field when forking sessions with legacy messages#6962crayment wants to merge 1 commit intoanomalyco:devfrom
crayment wants to merge 1 commit intoanomalyco:devfrom
Conversation
…messages Fixes session forking for sessions created before December 14, 2025. Commit 262d836 (Dec 14, 2025) added a required agent field to Assistant messages as part of the LLM cleanup PR. This broke the ability to fork sessions containing messages created before this change, as those messages only have the deprecated mode field. When forking a session, automatically backfill the agent field from mode for any assistant messages that lack it. This approach maintains type safety (agent remains required in the schema) and fixes the data at the point of migration (fork operation). Added comprehensive test coverage in test/session/fork.test.ts.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found. The search results show that PR #6962 (the one described in your file) is already in the system. The other PRs that appeared in the results are unrelated—they address different features like IDE integration, agent delegation, and UI interactions. This appears to be a new, unique PR with no existing duplicates addressing the same session forking and agent field backfilling issue. |
Contributor
Author
|
fixes #6855 |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
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.
Fixes session forking for sessions created before December 14, 2025.
Problem
Commit 262d836 (Dec 14, 2025) added a required
agentfield to Assistant messages as part of the "LLM cleanup" PR (#5462). This broke the ability to fork sessions containing messages created before this change, as those messages only have the deprecatedmodefield.Solution
When forking a session, automatically backfill the
agentfield frommodefor any assistant messages that lack it. This approach:Testing
Added comprehensive test coverage in
test/session/fork.test.ts:All tests pass ✅