Skip to content

[PROTOTYPE] [WIP] REXML for parsing taskoutput tool results#983

Draft
LasmarKhalifa wants to merge 1 commit into
06-16/tool-result-format-taskoutputfrom
06-23/tool-result-format-taskoutput-rexml-prototype
Draft

[PROTOTYPE] [WIP] REXML for parsing taskoutput tool results#983
LasmarKhalifa wants to merge 1 commit into
06-16/tool-result-format-taskoutputfrom
06-23/tool-result-format-taskoutput-rexml-prototype

Conversation

@LasmarKhalifa

@LasmarKhalifa LasmarKhalifa commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This prototype explores a different way of parsing taskoutput's tool result messages by using REXML. Nokogiri was not a good fit for our case because it uses native dependencies.

The challenges we face are the following:
-Taskoutput's tool result message resembles XML but is not. Special characters such as < are not escaped and there is no shared root.
-Most parsers raise an exception if they hit an unescaped character. This is fine for taskoutput's status and retrieval_status messages as they can only contain one of 3 options each, and neither contains unescaped characters. However, the content of that message includes other fields, such as <output> which can contain unescaped characters. We don't want our implementation to break in those cases.

This PR suggests the implementation of REXML's pull parser, which is a lazy parser. We only parsethe next element if we need to and stop once we have either status or retrieval_status. If at any point we raise, we just return nil.

This works and the main drawback is that it doesn't handle unescaped characters. That's fine for our taskoutput case, but we cannot use this in other places like error_lines

@LasmarKhalifa LasmarKhalifa changed the title [PROTOTYPE] REXML for parsing taskoutput tool results [PROTOTYPE] [WIP] REXML for parsing taskoutput tool results Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant