Skip to content

Conversation

@crayment
Copy link
Contributor

@crayment crayment commented Jan 5, 2026

Fixes session forking for sessions created before December 14, 2025.

Problem

Commit 262d836 (Dec 14, 2025) added a required agent field 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 deprecated mode field.

Solution

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)
  • Fixes the data at the point of migration (fork operation)
  • Is self-contained and doesn't spread complexity
  • Provides a clean path for future data migrations

Testing

Added comprehensive test coverage in test/session/fork.test.ts:

  • Forking empty sessions
  • Backfilling agent from mode for legacy messages
  • Preserving existing agent values
  • Forking with messageID parameter

All tests pass ✅

…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.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

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.

@crayment
Copy link
Contributor Author

crayment commented Jan 5, 2026

fixes #6855

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