Roo-Code/src
Daniel a5b143bb44
feat: add OpenAI context window error handling (#6967)
* feat: add OpenAI context window error handling

- Add comprehensive context window error detection for OpenAI, OpenRouter, Anthropic, and Cerebras
- Implement automatic retry with aggressive context truncation (25% reduction)
- Use proper profile settings for condensing operations
- Add robust error handling with try-catch blocks

Based on PR #5479 from cline/cline repository

* fix: address PR review comments

- Improved type safety by using Record<string, any> instead of direct any casts
- Enhanced Anthropic error detection with message pattern matching
- Added comprehensive unit tests for context-error-handling module
- Added named constant FORCED_CONTEXT_REDUCTION_PERCENT
- Added MAX_CONTEXT_WINDOW_RETRIES limit to prevent infinite loops
- Added logging for context window exceeded errors
- Extracted getCurrentProfileId helper method to reduce duplication
- All tests passing (3438 tests)

* fix: address PR review comments for context window error handling

- Improve Anthropic error detection with more specific patterns and error codes
- Add comprehensive unit tests for context-error-handling module
- Add logging for context window errors with detailed information
- Fix comment for FORCED_CONTEXT_REDUCTION_PERCENT constant
- Fix TypeScript error for untyped error parameter
- Maintain existing getCurrentProfileId helper method

---------

Co-authored-by: Roo Code <roomote@roocode.com>
2025-08-21 02:20:49 -07:00
..
__mocks__ feature: add toggle for disable mcp server tool from prompt (#3551) 2025-06-20 19:14:59 -04:00
__tests__ Skip interpolation for non-existent slash commands (#6475) 2025-07-31 01:21:19 -04:00
activate feat: focus chat input when clicking plus button in extension menu (#6689) 2025-08-07 09:33:25 -04:00
api fix: omit temperature parameter when not explicitly set for OpenAI Compatible providers (#7188) 2025-08-21 02:14:03 -07:00
assets PNPM + Turbo monorepo + Nightly releases (#3407) 2025-05-21 21:01:20 -07:00
core feat: add OpenAI context window error handling (#6967) 2025-08-21 02:20:49 -07:00
extension Add an API for resuming tasks by ID (#7122) 2025-08-15 12:03:58 -04:00
i18n feat: add "Installed" filter to Roo Marketplace (#7007) 2025-08-21 02:17:41 -07:00
integrations Fix terminal reuse logic (#7157) 2025-08-16 23:10:59 -07:00
services Move cloud types from @roo-code/types to @roo-code/cloud (#7038) 2025-08-13 00:10:29 -07:00
shared feat: Featherless provider (#7235) 2025-08-20 10:42:57 -07:00
utils refactor(storage): better fs check (#7164) 2025-08-21 02:15:52 -07:00
workers Count tokens worker (#3037) 2025-04-29 12:29:25 -07:00
.gitignore PNPM + Turbo monorepo + Nightly releases (#3407) 2025-05-21 21:01:20 -07:00
.prettierignore PNPM + Turbo monorepo + Nightly releases (#3407) 2025-05-21 21:01:20 -07:00
.vscodeignore debug: Add ErrorBoundary component for better error handling (#5085) 2025-07-23 08:45:35 -04:00
esbuild.mjs Revert "fix: optimize README for VS Code marketplace to prevent UI freezing" (#6303) 2025-07-28 14:31:01 -04:00
eslint.config.mjs Fix linter errors (#3821) 2025-05-21 23:16:43 -07:00
extension.ts Task metadata (#7092) 2025-08-14 03:14:17 -07:00
package.json feat: Featherless provider (#7235) 2025-08-20 10:42:57 -07:00
package.nls.ca.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.de.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.es.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.fr.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.hi.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.id.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.it.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.ja.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.ko.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.nl.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.pl.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.pt-BR.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.ru.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.tr.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.vi.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.zh-CN.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
package.nls.zh-TW.json fix: add i18n support for Account button title (#6978) 2025-08-12 22:59:01 -04:00
tsconfig.json Support linking to @roo-code/cloud in Roo-Code repo (#6799) 2025-08-07 01:09:21 -10:00
turbo.json Improve turbo task dependency declarations (#4323) 2025-06-04 09:32:27 -07:00
vitest.config.ts Fix #4958: Increase vitest timeout for Windows CI (#4959) 2025-06-20 17:14:42 -07:00
vitest.setup.ts Farewell jest (#4607) 2025-06-16 21:39:45 -07:00