Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 18, 2025

Summary

Fixes a bug where the context condensing prompt (and mode prompts) would revert to a previous value when multiple VS Code windows are open. This occurred because each window had its own stale cache of the global state, and read-modify-write operations would overwrite newer values from other windows.

Changes

  • Add refreshGlobalStateKey() method to ContextProxy that reads fresh values directly from VS Code's globalState and updates the local cache
  • Update updateCondensingPrompt handler to use refreshGlobalStateKey() before modifying customSupportPrompts
  • Update updatePrompt handler to use refreshGlobalStateKey() before modifying customModePrompts
  • Add unit tests for the new refreshGlobalStateKey() method

Root Cause

Each VS Code window runs its own extension host process with a separate ContextProxy singleton. The cache was populated at initialization but never refreshed when other windows updated globalState. This caused stale values to be used in read-modify-write operations.


Important

Fixes stale cache issue in VS Code extension by adding refreshGlobalStateKey() to update cache from globalState, ensuring consistency across multiple windows.

  • Behavior:
    • Fixes stale cache issue in ContextProxy when editing prompts across multiple VS Code windows.
    • Introduces refreshGlobalStateKey() in ContextProxy to update cache from globalState.
    • Updates updateCondensingPrompt and updatePrompt handlers in webviewMessageHandler.ts to use refreshGlobalStateKey().
  • Tests:
    • Adds unit tests for refreshGlobalStateKey() in ContextProxy.spec.ts.

This description was created by Ellipsis for 33f8e58. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 18, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 18, 2025

Oroocle Clock   See task on Roo Cloud

Re-review complete. No issues flagged in the net-new diff.

  • No issues flagged in this review
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 18, 2025
Add refreshGlobalStateKey() method to ContextProxy that reads fresh values
from VS Code's globalState before performing read-modify-write operations.

This fixes a bug where editing the context condensing prompt or mode prompts
would revert to a previous value when multiple VS Code windows are open,
because each window had its own stale cache.
@hannesrudolph hannesrudolph force-pushed the fix/context-condensing-prompt-reversion branch from 813a909 to 33f8e58 Compare December 18, 2025 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

2 participants