Skip to content

Fix distill-replace creating new conversation entry in UI#174

Open
okottorika wants to merge 1 commit intoboldsoftware:mainfrom
okottorika:fix-distill-replace-ui
Open

Fix distill-replace creating new conversation entry in UI#174
okottorika wants to merge 1 commit intoboldsoftware:mainfrom
okottorika:fix-distill-replace-ui

Conversation

@okottorika
Copy link
Copy Markdown

Problem

The "Distill & Replace in Place" feature was creating a new conversation entry in the sidebar when initiated, which was confusing to users. The UI immediately navigated to the newly created conversation before the slug swap completed, resulting in a blank conversation appearing in the sidebar temporarily.

Solution

This PR fixes the issue by deferring navigation until the distill-replace operation completes:

Frontend Changes (ui/src/App.tsx)

  • Track active distill-replace operations: Added state to maintain a mapping of source conversation IDs to their replacement conversation IDs
  • Deferred navigation: Instead of immediately navigating to the new conversation, the UI now stays on the source conversation and waits for the SSE conversation list update indicating the source has been archived
  • Automatic navigation on completion: When the source conversation is archived (signaling the slug swap is complete), the UI automatically navigates to the new conversation, which now has the original slug

Test Improvements (server/distill_test.go)

  • Added proper waiting loops for asynchronous slug swap and archival operations in:
    • TestDistillReplaceConversation
    • TestDistillReplaceConversationNoSlug
    • TestDistillReplaceMultiPass

These tests were checking assertion results before the async operations completed, causing intermittent failures.

User Experience

Before: User clicks "Distill & Replace in Place" → New blank conversation appears in sidebar → Confusing intermediate state → Eventually gets correct conversation

After: User clicks "Distill & Replace in Place" → Stays on current conversation → Slug swap completes in background → Automatically navigates to the distilled conversation with the original slug

Testing

  • All existing distill-replace tests pass
  • TypeScript type checking passes
  • UI builds successfully
  • Manually verified the fix with a local Shelley instance

Fixes #158

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Apr 6, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Shelley Contributor.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@okottorika okottorika force-pushed the fix-distill-replace-ui branch from 4a8b079 to a751e76 Compare April 6, 2026 14:48
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Apr 6, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Shelley Contributor.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@okottorika okottorika force-pushed the fix-distill-replace-ui branch from a751e76 to e391ccd Compare April 6, 2026 14:54
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Apr 6, 2026

We require contributors to sign our Contributor License Agreement, and we don't have you on file. In order for us to review and merge your code, please contact @crawshaw at david@bold.dev to get yourself added.

@okottorika okottorika closed this Apr 6, 2026
@okottorika okottorika reopened this Apr 6, 2026
@okottorika okottorika force-pushed the fix-distill-replace-ui branch from e391ccd to 15c2118 Compare April 6, 2026 17:20
@cla-bot cla-bot bot added the cla-signed label Apr 6, 2026
The distill-replace feature was immediately navigating to the newly created
conversation before the slug swap completed, causing a confusing UX where a
blank/new conversation appeared in the sidebar.

Now the UI:
- Tracks active distill-replace operations (source ID -> new ID mapping)
- Stays on the source conversation after initiating distill-replace
- Waits for the SSE conversation list update showing the source was archived
- Only then navigates to the new conversation (which now has the original slug)

This ensures users see a smooth transition without intermediate confusing states.

Also fixed backend tests to properly wait for async slug swap and archival
operations to complete before asserting on their results.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@okottorika okottorika force-pushed the fix-distill-replace-ui branch from 15c2118 to 1f9ef54 Compare April 6, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix confusing new conversation creation in 'distill and replace in place'

1 participant