Skip to content

conversation compact and fork#8

Merged
DimitriGilbert merged 6 commits into
mainfrom
fokcompact
Jun 16, 2025
Merged

conversation compact and fork#8
DimitriGilbert merged 6 commits into
mainfrom
fokcompact

Conversation

@DimitriGilbert

Copy link
Copy Markdown
Owner

branch with typos, amarite ?

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Compaction UI Timing Issue

When compacting a conversation, the initial "Compacting..." interaction for the new conversation is added to the store before the UI switches to it. This causes the interaction to temporarily appear in the currently active conversation and can lead to race conditions or state inconsistencies upon the new conversation loading. Additionally, the subsequent wait for interactionEvent.loaded is unreliable, often defaulting to a 2-second timeout, as the event may not be emitted during conversation selection.

src/services/conversation.service.ts#L839-L865

await PersistenceService.saveInteraction(initialUserInteraction);
// Add the initial interaction to the current conversation's in-memory store before switching
// This ensures the "Compacting..." message appears immediately in the UI
const interactionStoreState = useInteractionStore.getState();
interactionStoreState._addInteractionToState(initialUserInteraction);
// FIRST: Select the new conversation so the interaction store is in the right context
await conversationStoreState.selectItem(newConversationId, "conversation");
// Wait for conversation selection and interaction loading to complete
await new Promise<void>((resolve) => {
const handleInteractionLoaded = (payload: any) => {
if (payload.conversationId === newConversationId) {
emitter.off(interactionEvent.loaded, handleInteractionLoaded);
resolve();
}
};
emitter.on(interactionEvent.loaded, handleInteractionLoaded);
// Fallback timeout in case event doesn't fire
setTimeout(() => {
emitter.off(interactionEvent.loaded, handleInteractionLoaded);
resolve();
}, 2000);
});

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@DimitriGilbert DimitriGilbert merged commit 68c7490 into main Jun 16, 2025
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