Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Dec 3, 2025

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.ts reads Task.ts via fs.readFileSync and checks:

  • The broken pattern partialBlocks.some((block) => block.type !== "tool_use") is NOT present
  • The correct pattern if (partialBlocks.length > 0) { IS present

Test Verification

Tested by reverting the fix in Task.ts locally:

  • With broken condition: TEST FAILS
  • With fixed condition: TEST PASSES

This prevents future regressions that would cause infinite hangs with malformed native tool calls.


Important

Adds a regression test in Task.spec.ts to ensure the correct handling of tool_use blocks in Task.ts, preventing infinite hangs.

  • Test Addition:
    • Adds regression test in Task.spec.ts to verify the absence of the broken condition partialBlocks.some((block) => block.type !== "tool_use") and presence of the correct condition if (partialBlocks.length > 0) { in Task.ts.
  • Verification:
    • Confirms test fails with broken condition and passes with correct condition, ensuring no infinite hangs with malformed native tool calls.

This description was created by Ellipsis for 1ac2c81. You can customize this summary. It will automatically update as commits are pushed.

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
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners December 3, 2025 03:20
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 3, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 3, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. Found 1 issue that could improve test robustness.

  • Test uses brittle string matching that depends on exact whitespace and comment text

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(
Copy link
Contributor

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.

@daniel-lxs daniel-lxs closed this Dec 3, 2025
Comment on lines +1997 to +1999
const hasCorrectCondition = taskSource.includes(
"if (partialBlocks.length > 0) {\n\t\t\t\t\t// If there is content to update",
)
Copy link
Contributor

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.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 3, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants