Roo-Code/src
Roo Code bbdcab393a fix: validate deserialized API messages to prevent undefined content errors
Root cause: JSON.parse() in readApiMessages() deserializes data with zero validation,
allowing corrupted or legacy data to violate type contracts (e.g., undefined content).

This causes downstream crashes in functions like filterNonAnthropicBlocks() that assume
message.content is always string | ContentBlock[] per the type system, but receive
undefined/null values from corrupted historical data.

Solution:
- Add validateApiMessage() to sanitize deserialized messages at the boundary
- Fix undefined/null/non-array content by converting to empty array
- Filter out malformed messages with invalid roles or non-object structure
- Filter out invalid content blocks missing the required type field
- Add comprehensive test coverage (12 tests covering all edge cases)

Fixes: https://www.reddit.com/r/RooCode/s/yUXVFMYu3P
Related to closed PR #10954 (which treated symptom, not cause)
2026-01-25 18:35:54 +00:00
..
__mocks__ Add timeout to OpenAI Compatible Provider Client (#9898) 2025-12-08 17:36:53 -08:00
__tests__ chore: remove diffEnabled and fuzzyMatchThreshold settings (#10298) 2026-01-23 16:39:08 -05:00
activate ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
api fix: truncate AWS Bedrock toolUseId to 64 characters (#10902) 2026-01-24 00:49:33 -05:00
assets Show the Roo provider on the welcome screen (#8317) 2025-09-25 16:13:04 -04:00
core fix: validate deserialized API messages to prevent undefined content errors 2026-01-25 18:35:54 +00:00
extension feat: streaming tool stats + token usage throttling (#9926) 2025-12-08 19:40:12 -08:00
i18n ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
integrations Skip thoughtSignature blocks during markdown export #10199 (#10932) 2026-01-23 19:18:58 -08:00
services feat: add wildcard support for MCP alwaysAllow configuration (#10948) 2026-01-24 22:42:47 -05:00
shared refactor: remove legacy XML tool calling code (getToolDescription) (#10929) 2026-01-23 19:13:55 -05:00
types feat(proxy): add debug-mode proxy routing (#10467) 2026-01-06 13:17:50 -07:00
utils Replace hyphen encoding with fuzzy matching for MCP tool names (#10775) 2026-01-24 00:49:13 -05: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 feat(proxy): add debug-mode proxy routing (#10467) 2026-01-06 13:17:50 -07:00
eslint.config.mjs Fix linter errors (#3821) 2025-05-21 23:16:43 -07:00
extension.ts feat: remove Claude Code provider (#10883) 2026-01-21 21:32:56 -05:00
package.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.ca.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.de.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.es.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.fr.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.hi.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.id.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.it.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.ja.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.ko.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.nl.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.pl.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.pt-BR.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.ru.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.tr.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.vi.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.zh-CN.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
package.nls.zh-TW.json ux: improve worktree selector and creation UX (#10940) 2026-01-24 22:06:37 +00:00
tsconfig.json Move @roo-code/cloud to the Roo-Code repo (#7503) 2025-08-28 11:18:45 -07:00
turbo.json Improve turbo task dependency declarations (#4323) 2025-06-04 09:32:27 -07:00
vitest.config.ts Show console logging in vitests when the --no-silent flag is set (#7467) 2025-08-28 12:51:21 -04:00
vitest.setup.ts Show console logging in vitests when the --no-silent flag is set (#7467) 2025-08-28 12:51:21 -04:00