-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test: add regression test for malformed native tool call hang fix #9768
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
Conversation
Adds a test that reads the actual Task.ts source code and verifies that the broken condition (filtering out tool_use blocks) is not present, preventing future regressions of #9758
Review complete. Found 1 issue that could improve test robustness.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| const hasBrokenCondition = taskSource.includes('partialBlocks.some((block) => block.type !== "tool_use")') | ||
|
|
||
| // The CORRECT pattern we MUST have: | ||
| const hasCorrectCondition = taskSource.includes( |
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.
The check for the correct condition relies on an exact string (with specific newline and tab characters), which could be brittle if formatting changes. Consider using a regex that ignores whitespace differences.
| const hasCorrectCondition = taskSource.includes( | ||
| "if (partialBlocks.length > 0) {\n\t\t\t\t\t// If there is content to update", | ||
| ) |
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.
The test's string matching for the correct condition is brittle because it relies on exact whitespace and comment text. The test checks for "if (partialBlocks.length > 0) {\n\t\t\t\t\t// If there is content to update" but this will fail if: 1) the code is reformatted with different indentation (tabs vs spaces, or different tab count), 2) the comment text is modified or extended, or 3) code formatting tools normalize the whitespace. Consider using a regex pattern that's more flexible about whitespace, such as /if\s*\(\s*partialBlocks\.length\s*>\s*0\s*\)/ to match just the conditional logic without depending on exact formatting.
Fix it with Roo Code or mention @roomote and request a fix.
Summary
Adds a regression test that reads the actual Task.ts source code and verifies that the broken condition (filtering out tool_use blocks) is not present.
Related PR
#9758
Test Details
The test in
Task.spec.tsreadsTask.tsviafs.readFileSyncand checks:partialBlocks.some((block) => block.type !== "tool_use")is NOT presentif (partialBlocks.length > 0) {IS presentTest Verification
Tested by reverting the fix in Task.ts locally:
This prevents future regressions that would cause infinite hangs with malformed native tool calls.
Important
Adds a regression test in
Task.spec.tsto ensure the correct handling oftool_useblocks inTask.ts, preventing infinite hangs.Task.spec.tsto verify the absence of the broken conditionpartialBlocks.some((block) => block.type !== "tool_use")and presence of the correct conditionif (partialBlocks.length > 0) {inTask.ts.This description was created by
for 1ac2c81. You can customize this summary. It will automatically update as commits are pushed.