-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Refactor: Complete rewrite of AI message parsing system with streaming XML parser #4866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
StevenTCramer
wants to merge
71
commits into
RooCodeInc:main
from
TimeWarpEngineering:Cramer/2025-06-14/Logging
Closed
Changes from 52 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
138df6d
Add DONT_PROMPT_WSL_INSTALL to suppress VS Code WSL prompt and adjust…
StevenTCramer f4a9450
Update reconnection logic in useEventSource to prevent excessive retries
StevenTCramer f8a9d0f
remove troubleshooting stuff
StevenTCramer 341d6a8
1 sec backoff
StevenTCramer 13c02b6
remove more logging
StevenTCramer 7a3d203
Remove more debug code
StevenTCramer a25adf8
revert to main
StevenTCramer 814d07d
revert this too make PR easier.
StevenTCramer 2370385
DONT_PROMPT_WSL_INSTALL doesn't work here so remove. And no longer ne…
StevenTCramer a296dfb
Merge branch 'main' into Cramer/2025-06-12/evals
StevenTCramer 77d9dcd
Change exposed port to random generated one vs default 3000 to avoid …
StevenTCramer 2928dd3
refactor: rename AssistantMessageContent to Directive with type aliases
StevenTCramer 773075e
refactor: extract directive parsing into focused classes
StevenTCramer 1d97e1f
refactor: break handler classes into separate files
StevenTCramer 47c1dd7
Refactor type imports in parseAssistantMessage.ts for clarity
StevenTCramer 9e70691
Refactor assistant message parsing: rename classes and simplify metho…
StevenTCramer 2993a3a
Update DirectiveStreamingParser.ts to import from parsers/index.ts
StevenTCramer 1b9d9e6
refactor: Replace manual XML parsing with SAX parser in DirectiveStre…
StevenTCramer 439022f
fix: Complete DirectiveStreamingParser refactoring by adding log_mess…
StevenTCramer e3f673a
Refactor DirectiveStreamingParser for better modularity and fix test …
StevenTCramer 6d2b212
Reorganize assistant-message
StevenTCramer 31c51e3
Add index.ts to handlers directory for easier imports
StevenTCramer 8914d59
Update imports to use handlers index.ts and reduce exports to necessa…
StevenTCramer e633378
rename assistant-message to message-parsing
StevenTCramer d08b0d3
Rename ToolUse to ToolDirective
StevenTCramer d5ac159
Refactor: Move tool directives to individual files in tool-directives…
StevenTCramer 1bfc810
Remove duplicate tests file.
StevenTCramer bab0d65
removed unused import
StevenTCramer fda123e
Replace wildcard exports with explicit exports in handlers index.ts
StevenTCramer 9e6c124
Replace export * with explicit
StevenTCramer c46ce75
fix export
StevenTCramer bdc102c
encapsulate/scope logLevels better and remove unused Zod stuff.
StevenTCramer 4090116
Remove unused code
StevenTCramer 2202273
Update tools to use specific directive types for enhanced type safety
StevenTCramer 2550e85
Update newTaskTool.test.ts to use specific directive types directly
StevenTCramer 4a3f3eb
Update useMcpToolTool.test.ts to use specific directive types directly
StevenTCramer 5efd95a
Update writeToFileTool.test.ts to use specific directive types directly
StevenTCramer f10ab35
Add test case for directives inside triple backticks
StevenTCramer 5144039
WIP: Implement code block detection for DirectiveStreamingParser
StevenTCramer cc1a4df
Add test for `xml code block scenario
StevenTCramer 5ef1863
Fix log message parsing inside code blocks within tool parameters
StevenTCramer b879dd2
Fix DirectiveStreamingParser to prevent processing nested XML tags as…
StevenTCramer e7289bd
refactor: extract repeated code block detection logic into method
StevenTCramer d18e110
refactor: extract duplicated insideToolParameter logic into helper me…
StevenTCramer 7471bd5
Refine type for activeHandler in DirectiveStreamingParser
StevenTCramer 37dddeb
refactor: improve type safety in DirectiveStreamingParser
StevenTCramer 323d647
Remove temporary test file debug-test.js
StevenTCramer 7d880f1
Remove any type assertions in DirectiveStreamingParser.ts by introduc…
StevenTCramer 36c993b
Fix type assertions and formatting in DirectiveStreamingParser.ts
StevenTCramer bcf71c5
Refactor: Replace 'any' with 'ToolName' in message parsing files
StevenTCramer 946cc0c
remove old parseAssistantMessage stuff
StevenTCramer 62369d4
Add message parsing system documentation
StevenTCramer f703132
refactor: improve type safety for fetch_instructions tool
StevenTCramer 70d8e76
Merge branch 'main' into Cramer/2025-06-14/Logging
StevenTCramer 33a0a20
Convert readFileTool.spec.ts from Jest to Vitest
StevenTCramer 922e1e1
Fixed: pnpm check-types errors
StevenTCramer 6291568
Merge branch 'main' into Cramer/2025-06-14/Logging
StevenTCramer 003d77d
remove temporary test
StevenTCramer 49e8ec3
fix: resolve vitest test failures and update snapshots
StevenTCramer eee32e3
Fix TypeScript errors in readFileTool.spec.ts
StevenTCramer 3ceb0ff
Fix Windows cross-platform path compatibility in readFileTool tests
StevenTCramer 3620246
Fix timeout issue in custom-system-prompt test
StevenTCramer 77d2c4f
Fix Windows path normalization in readFileTool test
StevenTCramer 0fb5bf3
Merge branch 'main' into Cramer/2025-06-14/Logging
StevenTCramer e192d14
remove duplicate args
StevenTCramer 875d33a
Update comment to new terminology
StevenTCramer 1c00a24
remove junk.txt
StevenTCramer 1b7272d
Revert apps directory changes back to main branch state
StevenTCramer bed08af
Revert locales directory changes back to main branch state
StevenTCramer 2e67b0a
Revert src/services/mcp/McpHub.ts back to main branch state
StevenTCramer deda793
Restore apps/vscode-e2e/src/types/global.d.ts to needed version
StevenTCramer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Debug script to test the exact scenario from the image | ||
| const { DirectiveStreamingParser } = require("./src/core/message-parsing/DirectiveStreamingParser.ts") | ||
| const { FallbackParser } = require("./src/core/message-parsing/FallbackParser.ts") | ||
|
|
||
| // Test the exact content that might be causing the issue | ||
| const testContent = `I'm happy to provide an example of the XML format for the log_message directive. As specified in the guidelines, log messages are used to output debugging information to the VSCode output channel. Here's an example of how it is formatted: | ||
|
|
||
| In this example: | ||
|
|
||
| The message tag contains the text of the log message. | ||
| The level tag specifies the log level, which can be "debug", "info", "warn", or "error". It's optional and defaults to "info" if not provided. | ||
|
|
||
| This format allows for immediate logging without requiring user approval, and it can be used multiple times in a single message if needed. | ||
|
|
||
| <attempt_completion> | ||
| <result>I've provided an example of the XML format for the log_message directive. It includes the message content and an optional level specification, formatted as required for logging to the VSCode output channel.</result> | ||
| </attempt_completion>` | ||
|
|
||
| console.log("Testing DirectiveStreamingParser...") | ||
| const result1 = DirectiveStreamingParser.parse(testContent) | ||
| console.log("DirectiveStreamingParser result:") | ||
| result1.forEach((directive, idx) => { | ||
| console.log(` ${idx}: ${directive.type}`) | ||
| if (directive.type === "log_message") { | ||
| console.log(` ⚠️ LOG MESSAGE FOUND: "${directive.message}"`) | ||
| } | ||
| if (directive.type === "tool_use") { | ||
| console.log(` Tool: ${directive.name}`) | ||
| console.log(` Params:`, Object.keys(directive.params)) | ||
| } | ||
| }) | ||
|
|
||
| console.log("\nTesting FallbackParser...") | ||
| const result2 = FallbackParser.parse(testContent) | ||
| console.log("FallbackParser result:") | ||
| result2.forEach((directive, idx) => { | ||
| console.log(` ${idx}: ${directive.type}`) | ||
| if (directive.type === "log_message") { | ||
| console.log(` ⚠️ LOG MESSAGE FOUND: "${directive.message}"`) | ||
| } | ||
| if (directive.type === "tool_use") { | ||
| console.log(` Tool: ${directive.name}`) | ||
| console.log(` Params:`, Object.keys(directive.params)) | ||
| } | ||
| }) | ||
|
|
||
| // Check for any log messages | ||
| const allLogMessages1 = result1.filter((r) => r.type === "log_message") | ||
| const allLogMessages2 = result2.filter((r) => r.type === "log_message") | ||
|
|
||
| console.log(`\nDirectiveStreamingParser found ${allLogMessages1.length} log messages`) | ||
| console.log(`FallbackParser found ${allLogMessages2.length} log messages`) | ||
|
|
||
| if (allLogMessages1.length > 0 || allLogMessages2.length > 0) { | ||
| console.log("\n🚨 ISSUE FOUND: Log messages are still being parsed as directives!") | ||
| } else { | ||
| console.log("\n✅ No log message directives found - this is correct!") | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug script is helpful! Would it be possible to convert this into a permanent test case? That would help prevent future regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was a temp test should have been removed. The actual tests should cover it this was a debug test left over. I thought I cleaned them up must have missed it.