🐞 Bug Report: XML Misinterpretation When Running Multiple Tests in a Single Command

Issue Summary

When executing multiple space-separated test names in a single cargo test command via a model function call, the command output is misinterpreted as XML, resulting in truncation and a terminal hang.


Steps to Reproduce

  1. Enable Yolo Mode Auto Enter.
  2. Prompt the model with:

    please run this command cargo test test_task_cancellation_basic test_task_cancellation_with_cleanup


Expected Behavior

The model should output and execute the full command:

cargo test test_task_cancellation_basic test_task_cancellation_with_cleanup

Actual Behavior

The command is truncated and malformed:

<argo test test_task_cancellation_basic test_task_cancellation_with_cleanup

This causes the terminal to hang indefinitely.


Suspected Cause

The command string is misinterpreted by the XML or markdown parser as a tag due to the leading < and unescaped space-separated tokens, resulting in invalid XML structure.


Context

While developing a Rust program, I noticed that test commands containing multiple test names (separated by spaces) would not execute properly. After debugging with the model, we traced the issue to the function call interpreter parsing the command as malformed XML.


:white_check_mark: Temporary Workaround

Added this to my .cursorrules to enforce safer command formatting:

## KNOWN ISSUES

### Command Execution

Avoid passing multiple test names in a single `cargo test` command, as the model's function call interpreter misreads the command as XML-like markup.

**Problematic Command (fails):**
```xml
<function_calls>
  <invoke name="run_terminal_cmd">
    <parameter name="command">cargo test test_task_cancellation_basic test_task_cancellation_with_cleanup</parameter>
    <parameter name="explanation">Run multiple tests</parameter>
    <parameter name="is_background">false</parameter>
  </invoke>
</function_calls>

Working Command (single test only):

<function_calls>
  <invoke name="run_terminal_cmd">
    <parameter name="command">cargo test test_task_cancellation_basic</parameter>
    <parameter name="explanation">Run single test</parameter>
    <parameter name="is_background">false</parameter>
  </invoke>
</function_calls>

:hammer_and_wrench: Recommended Practices

  1. Run one test per command.
  2. To run multiple tests:
    • Chain them in separate run_terminal_cmd blocks.
    • Or use wildcard filters (e.g. cargo test test_task_).
  3. Avoid unescaped command strings that resemble <tags>.
  4. Move directory changes into separate commands.
  5. Avoid flags like --nocapture in multiline callsβ€”use them separately.

:white_check_mark: Example: Correct Multi-Test Format

<!-- Run first test -->
<function_calls>
  <invoke name="run_terminal_cmd">
    <parameter name="command">cargo test test_task_cancellation_basic</parameter>
    <parameter name="explanation">Run first test</parameter>
    <parameter name="is_background">false</parameter>
  </invoke>
</function_calls>

<!-- Run second test -->
<function_calls>
  <invoke name="run_terminal_cmd">
    <parameter name="command">cargo test test_task_cancellation_with_cleanup</parameter>
    <parameter name="explanation">Run second test</parameter>
    <parameter name="is_background">false</parameter>
  </invoke>
</function_calls>

:receipt: Reporting Metadata

Field Value
OS Windows 11
Cursor Version v0.48.7
Blocks Workflow? Yes – terminal hangs

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.