Repository navigation
Update claude_desktop_parser.py - #171
Open
MaddipatlaChetan24 wants to merge 1 commit into
Open
MaddipatlaChetan24 wants to merge 1 commit into
MaddipatlaChetan24 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What type of PR is this? (check all applicable)
Related issue: N/A
What changed?
In
Sensor/adr_sensor/parsers/claude_desktop_parser.py,_extract_message_dataapplied the single root-leveltool_use_resultoverride to everytool_resultblock in a user turn. The fix now only applies that override when there is exactly onetool_resultblock, and only when itsresultis non-empty.Why?
When a turn contains more than one
tool_result(parallel tool calls), the shared override overwrote every block with the same single value, discarding each tool's own distinct result and corrupting the parsed chat history. This is the same bug pattern already fixed inDetection/main_benchmark.py._extract_text_from_content, which guards the override the same way — that fix just wasn't carried over to this parser.How did you test it?
Verified empirically with targeted reproductions calling
_extract_message_datadirectly:tool_resultblocks + one sharedtool_use_result: before the fix both blocks were overwritten with the same value; after the fix each keeps its own distinct content.tool_resultblock: override still applies as intended (no regression).tool_use_result["result"]: real existing content is no longer discarded.Also confirmed the file compiles (
py_compile).Potential risks
Low risk — this only narrows when the override is applied (from "always" to "only when unambiguous and non-empty"), so it can only make the recovered content more accurate, not less. No change to any other parser or to the public
AgentEvent/ChatMessageschema.