Roo-Code/src
Roo Code 9e011a82fb Fix race condition causing user messages to disappear after AI edits
Fixes #5188

This commit resolves a race condition where user messages would sometimes
or always disappear after AI file edits, depending on whether the edit
succeeded or failed.

Root Cause:
The webview message handler was not properly awaiting the handleWebviewAskResponse
call, creating a race condition where subsequent user messages could be lost
if the AI was still processing or in an unstable state.

Solution:
1. Fixed webviewMessageHandler.ts to properly await handleWebviewAskResponse
   and added error handling to prevent message loss even during failures
2. Enhanced Task.ts to immediately save user feedback messages to chat history
   for messageResponse types, ensuring persistence regardless of timing

Changes:
- src/core/webview/webviewMessageHandler.ts: Added await and try-catch for askResponse handling
- src/core/task/Task.ts: Enhanced handleWebviewAskResponse to immediately save user feedback
- src/core/webview/__tests__/message-race-condition.test.ts: Added comprehensive test coverage

The fix ensures:
- Proper async handling prevents race conditions
- User messages are immediately persisted to chat history
- Graceful error handling prevents message loss during failures
- Both success and failure scenarios are properly handled
2025-06-30 08:44:28 +00:00
..
__mocks__ feature: add toggle for disable mcp server tool from prompt (#3551) 2025-06-20 19:14:59 -04:00
__tests__ Farewell jest (#4607) 2025-06-16 21:39:45 -07:00
activate fix terminal keyboard shortcut error when adding content to context (#5161) 2025-06-26 20:34:14 -04:00
api feat: add Gemini CLI provider for free access to Gemini models (#5134) (#5137) 2025-06-26 16:03:18 -04:00
assets PNPM + Turbo monorepo + Nightly releases (#3407) 2025-05-21 21:01:20 -07:00
core Fix race condition causing user messages to disappear after AI edits 2025-06-30 08:44:28 +00:00
extension Fix/4100 subtask completion mismatch (#4738) 2025-06-17 15:06:44 -04:00
i18n fix(i18n): correct gemini cli error translation paths (#5194) 2025-06-27 12:23:21 -04:00
integrations fix: Handle long Claude code messages (#5072) 2025-06-24 11:34:06 -04:00
services fix: restore JSON backwards compatibility for .roomodes files (#5199) 2025-06-27 15:04:17 -04:00
shared feat: add Gemini CLI provider for free access to Gemini models (#5134) (#5137) 2025-06-26 16:03:18 -04:00
utils fix: restore JSON backwards compatibility for .roomodes files (#5199) 2025-06-27 15:04:17 -04: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 feat: add LaTeX math equation rendering in chat window (#4258) (#4786) 2025-06-20 15:45:18 -04:00
esbuild.mjs Try to fix win32 esbuild (#4479) 2025-06-09 15:03:44 -07:00
eslint.config.mjs Fix linter errors (#3821) 2025-05-21 23:16:43 -07:00
extension.ts Support config policies that require use of cloud (#4762) 2025-06-16 18:31:22 -04:00
package.json Changeset version bump (#5196) 2025-06-27 15:45:28 -04:00
package.nls.ca.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.de.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.es.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.fr.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.hi.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.id.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.it.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.ja.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.ko.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.nl.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.pl.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.pt-BR.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.ru.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.tr.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.vi.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.zh-CN.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
package.nls.zh-TW.json feat: register importSettings as VSCode command (#5095) 2025-06-25 16:07:08 -04:00
tsconfig.json Farewell jest (#4607) 2025-06-16 21:39:45 -07: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