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
- Enable Yolo Mode Auto Enter.
- 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.
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>
Recommended Practices
- Run one test per command.
- To run multiple tests:
- Chain them in separate
run_terminal_cmd
blocks. - Or use wildcard filters (e.g.
cargo test test_task_
).
- Chain them in separate
- Avoid unescaped command strings that resemble
<tags>
. - Move directory changes into separate commands.
- Avoid flags like
--nocapture
in multiline callsβuse them separately.
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>
Reporting Metadata
Field | Value |
---|---|
OS | Windows 11 |
Cursor Version | v0.48.7 |
Blocks Workflow? | Yes β terminal hangs |