Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 16, 2026

This PR attempts to address Issue #10781.

Problem

When the selected condensing model has a smaller context window than the current conversation, the API throws an error that was previously unhandled. This caused the UI to hang with "Condensing Chat" forever, giving no feedback to the user.

Solution

Added error handling around the streaming API call in summarizeConversation() to:

  1. Catch API errors during the condensing process
  2. Detect context window exceeded errors using common error message patterns
  3. Return a user-friendly error message via the existing error display mechanism
  4. Handle other API errors with a generic error message that includes the original error details

Changes

  • src/core/condense/index.ts: Added try-catch around the streaming API call
  • src/i18n/locales/en/common.json: Added new translation key condense_context_window_exceeded
  • src/core/condense/__tests__/index.spec.ts: Added 3 test cases for error handling

Testing

  • All 47 tests in the condense module pass
  • Lint and type checks pass

Feedback and guidance are welcome!


Important

Adds error handling for context window exceeded errors in summarizeConversation() and updates translations and tests.

  • Behavior:
    • Adds error handling in summarizeConversation() to catch context window exceeded errors and return user-friendly messages.
    • Handles other API errors with a generic error message including original error details.
  • Files:
    • index.ts: Adds try-catch block around streaming API call in summarizeConversation().
    • index.spec.ts: Adds test cases for context window exceeded and generic API error handling.
    • common.json: Adds translation key condense_context_window_exceeded in multiple locales.
  • Testing:
    • All tests in the condense module pass.
    • Lint and type checks pass.

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

When the selected condensing model has a smaller context window than the
current conversation, the API throws an error that was previously unhandled.
This caused the UI to hang with "Condensing Chat" forever.

Changes:
- Add try-catch around the streaming API call in summarizeConversation()
- Detect context window exceeded errors and return user-friendly error message
- Add new translation key for context window exceeded error
- Add tests for error handling behavior

Fixes #10781
@roomote
Copy link
Contributor Author

roomote bot commented Jan 16, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly handles context window exceeded errors during context condensing by:

  • Wrapping the streaming API call in try-catch
  • Detecting context window errors using reasonable pattern matching
  • Returning user-friendly error messages via the existing error display mechanism
  • Preserving original messages on error
  • Including appropriate test coverage
  • Adding translations for the error message to all 17 non-English locales
Previous reviews

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

@DarkEden-coding
Copy link

This looks good to fix #10781

@DarkEden-coding
Copy link

@roomote you are missing translations of the error message, see failed check-translations check:

BACKEND - Checking 17 non-English locale(s): ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
Checking 5 translation file(s): common.json, embeddings.json, marketplace.json, mcp.json, tools.json

BACKEND Missing Translations Report:

📝 ca:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 de:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 es:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 fr:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 hi:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 id:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 it:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 ja:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 ko:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 nl:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 pl:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 pt-BR:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 ru:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 tr:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 vi:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 zh-CN:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

📝 zh-TW:
  - common.json: 1 missing translations
      errors.condense_context_window_exceeded: "The selected condensing model's context window is too small for the current conversation. Please select a model with a larger context window or manually reduce the conversation size first."

@roomote
Copy link
Contributor Author

roomote bot commented Jan 16, 2026

Fixaroo Clock   See task on Roo Cloud

Fixed the missing translations. Added errors.condense_context_window_exceeded to all 17 non-English locale files. Translation check passes.

View commit | Revert commit

…ror message

Added translations for errors.condense_context_window_exceeded to all 17 non-English locales:
ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants