Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 18, 2025

Fixes parser state inconsistencies when switching between models with different tool protocols (XML ↔ native).

Changes

  • Listen to ProviderProfileChanged event to update parser automatically
  • Only recreate parser when protocol actually changes (avoids unnecessary resets)
  • Clean up listener on task disposal to prevent memory leaks

Impact

  • XML tags no longer appear in chat when switching from native to XML models
  • Parser state stays synchronized with current model protocol
  • No performance impact: parser only updates when protocol changes

- Listen to ProviderProfileChanged event to update parser
- Only recreate parser when protocol actually changes (xml ↔ native)
- Prevent parser state inconsistencies when switching models
- Clean up listener on task disposal to prevent memory leaks
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Nov 18, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 18, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete - No issues found

This PR successfully fixes parser state inconsistencies when switching between models with different tool protocols. The implementation is clean, efficient, and properly handles memory management.

Key improvements:

  • Only recreates parser when protocol actually changes
  • Properly cleans up event listeners to prevent memory leaks
  • Handles edge cases like test mocks and protocol transitions

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

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 18, 2025
@mrubens mrubens merged commit f5d3ac0 into main Nov 18, 2025
20 checks passed
@mrubens mrubens deleted the fix/parser-state-on-profile-switch branch November 18, 2025 14:44
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 18, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 18, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 19, 2025
* fix: prevent MCP server restart when toggling tool permissions (RooCodeInc#8633)

* fix: prevent MCP server restart when toggling tool permissions

Add isProgrammaticUpdate flag to distinguish between programmatic config
updates and user-initiated file changes. Skip file watcher processing
during programmatic updates to prevent unnecessary server restarts.

* fix(mcp): prevent server reconnection when toggling disabled state

Fixed bug where MCP servers would reconnect instead of staying disabled when toggled off. The issue was that toggleServerDisabled() used stale in-memory config instead of reading the fresh config from disk after writing the disabled flag.

Changes:
Added readServerConfigFromFile() helper to read and validate server config from disk
Updated disable path to read fresh config before calling connectToServer()
Updated enable path to read fresh config before calling connectToServer()
This ensures the disabled: true flag is properly read, causing connectToServer() to create a disabled placeholder connection instead of actually connecting the server.

+ refactor(mcp): use safeWriteJson for atomic config writes

Replace JSON.stringify + fs.writeFile with safeWriteJson in McpHub.ts
to prevent data corruption through atomic writes with file locking.

* fix(mcp): prevent race condition in isProgrammaticUpdate flag

Replace multiple independent reset timers with a single timer that gets
cleared and rescheduled on each programmatic config update. This prevents
the flag from being reset prematurely when multiple rapid updates occur,
which could cause unwanted server restarts during the file watcher's
debounce period.

+ fix(mcp): ensure isProgrammaticUpdate flag cleanup with try-finally

Wrap safeWriteJson() calls in try-finally blocks to guarantee the
isProgrammaticUpdate flag is always reset, even if the write operation
fails. This prevents the flag from being stuck at true indefinitely,
which would cause subsequent user-initiated config changes to be
silently ignored.

* docs(readme): update readme images and image compression

* docs: replace inline base64 images with image file references

* Merge remote-tracking branch 'upstream/main' into roo-to-main

* feat(terminal): refactor execa command execution for shell handling

* Feat: Add Minimax Provider (fixes RooCodeInc#8818) (RooCodeInc#8820)

Co-authored-by: xiaose <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* Release v3.29.4 (RooCodeInc#8906)

* fix: Gate auth-driven Roo model refresh to active provider only (RooCodeInc#8915)

* feat: add zai-glm-4.6 model to Cerebras and set gpt-oss-120b as default (RooCodeInc#8920)

* feat: add zai-glm-4.6 model and update gpt-oss-120b for Cerebras

- Add zai-glm-4.6 with 128K context window and 40K max tokens
- Set zai-glm-4.6 as default Cerebras model
- Update gpt-oss-120b to 128K context and 40K max tokens

* feat: add zai-glm-4.6 model to Cerebras provider

- Add zai-glm-4.6 with 128K context window and 40K max tokens
- Set zai-glm-4.6 as default Cerebras model
- Model provides ~2000 tokens/s for general-purpose tasks

* add [SOON TO BE DEPRECATED] warning for Q3C

* chore: set gpt-oss-120b as default Cerebras model

* Fix cerebras test: update expected default model to gpt-oss-120b

* Apply suggestion from @mrubens

Co-authored-by: Matt Rubens <[email protected]>

---------

Co-authored-by: kevint-cerebras <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* roo provider: update session token on every request (RooCodeInc#8923)

* roo provider: update session token on every request

* Cleanup: remove unused imports

* Also refresh token before completePrompt()

* feat: add We're hiring link to announcement modal (RooCodeInc#8931)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* Fix: Enhanced codebase index recovery and reuse ('Start Indexing' button now reuses existing Qdrant index) (RooCodeInc#8588)

Co-authored-by: daniel-lxs <[email protected]>

* fix: make code index initialization non-blocking at activation (RooCodeInc#8933)

* fix(context): truncate type definition to match max read line (RooCodeInc#8509)

Co-authored-by: daniel-lxs <[email protected]>

* fix: prevent infinite loop when canceling during auto-retry (RooCodeInc#8902)

* fix: prevent infinite loop when canceling during auto-retry

- Add abort check after backoffAndAnnounce in first-chunk retry logic
- Add abort check after backoffAndAnnounce in mid-stream retry logic
- Properly handle task abortion to break retry loops

Fixes RooCodeInc#8901

* docs: add critical comments explaining abort checks

- Document the importance of abort checks after backoff
- Explain how these checks prevent infinite loops
- Add context for future maintainability

---------

Co-authored-by: Roo Code <[email protected]>

* feat: rename MCP Errors tab to Logs for mixed-level messages (RooCodeInc#8894)

- Update McpView.tsx to use "logs" tab ID instead of "errors"
- Rename translation key from tabs.errors to tabs.logs in all locales
- Change empty state message from "No errors found" to "No logs yet"

This better reflects that the tab shows all server messages (info, warnings, errors), not just errors.

Fixes RooCodeInc#8893

Co-authored-by: Roo Code <[email protected]>

* feat: improve @ file search for large projects (RooCodeInc#8805)

* feat: improve @ file search for large projects

- Increase default file limit from 5,000 to 10,000 (configurable up to 500,000)
- Respect VSCode search settings (useIgnoreFiles, useGlobalIgnoreFiles, useParentIgnoreFiles)
- Add 'maximumIndexedFilesForFileSearch' configuration setting
- Add tests for new functionality

Conservative default of 10k keeps memory usage low while still providing 2x
improvement. Users with large projects can opt-in to higher limits (up to 500k).

This is a simplified alternative to PR RooCodeInc#5723 that solves the same problem
without the complexity of caching. Ripgrep is already fast enough for
10k+ files, and the benefit of caching doesn't justify 2,200+ lines of
additional code and maintenance burden.

Fixes RooCodeInc#5721

* fix: add missing translations for maximumIndexedFilesForFileSearch setting

* test: improve file-search tests to verify configuration behavior

* fix: remove search_and_replace tool from codebase (RooCodeInc#8892)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: daniel-lxs <[email protected]>
Co-authored-by: Hannes Rudolph <[email protected]>

* Release v3.29.5 (RooCodeInc#8942)

* Changeset version bump (RooCodeInc#8907)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Fix cost and token tracking between provider styles (RooCodeInc#8954)

* web: Attempt at compliant, cookie-less anonymous tracking for the website (RooCodeInc#8957)

* Merge remote-tracking branch 'upstream/main' into roo-to-main

* fix: add keyword index for type field to fix Qdrant codebase_search error (RooCodeInc#8964)

Co-authored-by: Roo Code <[email protected]>

* chore: add changeset for v3.29.5 (RooCodeInc#8967)

* Changeset version bump (RooCodeInc#8968)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Capture the reasoning content in base-openai-compatible for GLM 4.6 (RooCodeInc#8976)

* feat: optimize router model fetching with single-provider filtering (RooCodeInc#8956)

* fix: prevent message loss during queue drain race condition (