[PROTOTYPE] [WIP] REXML for parsing taskoutput tool results#983
Draft
LasmarKhalifa wants to merge 1 commit into
Draft
Conversation
This was referenced Jun 23, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

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
statusandretrieval_statusmessages 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
pullparser, which is a lazy parser. We only parsethe next element if we need to and stop once we have eitherstatusorretrieval_status. If at any point we raise, we just returnnil.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