Skip to content

Handle removed IconName variants in text thread deserialization#47624

Merged
MrSubidubi merged 3 commits intozed-industries:mainfrom
lex00:fix/41776-text-thread-icon-deserialization
Jan 26, 2026
Merged

Handle removed IconName variants in text thread deserialization#47624
MrSubidubi merged 3 commits intozed-industries:mainfrom
lex00:fix/41776-text-thread-icon-deserialization

Conversation

@lex00
Copy link
Contributor

@lex00 lex00 commented Jan 26, 2026

Fixes #41776

Problem

Old AI Text Thread sessions fail to open from History because the deserializer fails on unknown icon variants. When icons are removed or renamed in refactors, old saved threads become unloadable with errors like:

unknown variant `AtSign`, expected one of `Ai`, `AiAnthropic`...

Solution

Added a lenient deserializer for the icon field in SlashCommandOutputSection that falls back to IconName::Code for unknown variants.

This ensures old saved threads remain loadable even as icons are added/removed from the codebase.

Test Plan

  • Added unit test for valid icon deserialization
  • Added unit test for unknown icon fallback to Code
  • Added unit test for various unknown icon variants
  • Added unit test confirming serialization unchanged
  • All tests pass: cargo test -p assistant_slash_command

Release Notes:

  • Fixed old AI text thread sessions failing to open from History when they contain icons that were removed in previous updates.

🤖 Generated with Claude Code

@cla-bot
Copy link

cla-bot bot commented Jan 26, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @lex00 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jan 26, 2026
@lex00
Copy link
Contributor Author

lex00 commented Jan 26, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 26, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 26, 2026

The cla-bot has been summoned, and re-checked this pull request!

@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Jan 26, 2026
@maxdeviant maxdeviant changed the title fix: handle removed IconName variants in text thread deserialization Handle removed IconName variants in text thread deserialization Jan 26, 2026
@lex00
Copy link
Contributor Author

lex00 commented Jan 26, 2026

Full disclosure, this PR was built by an "intent automation" framework I am testing.

If the quality is satisfactory I would be willing to attempt to resolve more issues with it.

If there are some that you would like to see done sooner please send them to me, thank you.

@MrSubidubi MrSubidubi changed the title Handle removed IconName variants in text thread deserialization Handle removed IconName variants in text thread deserialization Jan 26, 2026
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Lets change this slightly so that we only handle the serde-case here and do not care about the strum-style. Otherwise looks good!

@MrSubidubi MrSubidubi self-assigned this Jan 26, 2026
@lex00 lex00 force-pushed the fix/41776-text-thread-icon-deserialization branch from b1cbfb7 to a37af15 Compare January 26, 2026 22:32
Fixes zed-industries#41776

Old AI Text Thread sessions fail to open from History because the
deserializer fails on unknown icon variants (e.g., icons that were
removed in refactors).

This adds a lenient deserializer for the `icon` field in
`SlashCommandOutputSection` that falls back to `IconName::Code` for
unknown variants.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@lex00 lex00 force-pushed the fix/41776-text-thread-icon-deserialization branch from a37af15 to be72006 Compare January 26, 2026 22:33
@lex00 lex00 requested a review from MrSubidubi January 26, 2026 22:37
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some minor last changes, but looks good now. Thank you for looking into this and congratulations to your first contribution! 🎉

@MrSubidubi MrSubidubi enabled auto-merge (squash) January 26, 2026 23:56
@MrSubidubi MrSubidubi merged commit 0db0cc6 into zed-industries:main Jan 26, 2026
27 checks passed
@lex00 lex00 deleted the fix/41776-text-thread-icon-deserialization branch March 1, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI: Unable to open older Text Thread sessions from History

3 participants