Problem (one or two sentences)
When a heredoc opener line is followed by a control operator on the same line (e.g. << EOF; echo done), the parser absorbs the control operator into the heredoc delimiter. The terminator line is then never found, and a valid command is incorrectly rejected as an unterminated heredoc.
Context (who is affected and when)
Affects any user running shell commands that combine a heredoc with a control operator on the opener line — a common pattern such as cat << EOF | grep pattern or sh -c '...' << EOF && next. The command is mis-parsed and treated as a syntax error, so it cannot be executed or auto-approved correctly.
Reproduction steps
-
Environment: Zoo Code extension, any OS, any API provider.
-
Enter a command that uses a heredoc with a control operator on the opener line, e.g.:
sh -c bash << EOF; echo done
echo hello
EOF
or
sh -c bash << EOF | grep hi
echo hello
EOF
-
Observe that the command is parsed as an unterminated heredoc (parse error) instead of a single valid heredoc command.
Expected result
The heredoc is recognized as a single valid command. The delimiter is EOF (the control operator terminates the delimiter word), and the terminator line EOF is found correctly.
Actual result
The delimiter incorrectly becomes EOF; echo done (or EOF | grep hi), the terminator line is never matched, and the whole valid command is reported as an unterminated heredoc.
Variations tried (optional)
All three control operators (;, |, &&) reproduce the issue. Quoted delimiters (<< 'EOF') are not affected.
App Version
v3.74.0
API Provider (optional)
None
Model Used (optional)
No response
Zoo Code Task Links (optional)
No response
Relevant logs or errors (optional)
{
"type": "tool_result",
"tool_use_id": "chatcmpl-tool-95e9934ee1b0601f",
"content": "{\"status\":\"error\",\"message\":\"The tool execution failed\",\"error\":\"Malformed command: unterminated heredoc (<<) at position 4 -- near: `cat <<EOF; echo \\\"--- don...`. \"}"
}
Problem (one or two sentences)
When a heredoc opener line is followed by a control operator on the same line (e.g.
<< EOF; echo done), the parser absorbs the control operator into the heredoc delimiter. The terminator line is then never found, and a valid command is incorrectly rejected as an unterminated heredoc.Context (who is affected and when)
Affects any user running shell commands that combine a heredoc with a control operator on the opener line — a common pattern such as
cat << EOF | grep patternorsh -c '...' << EOF && next. The command is mis-parsed and treated as a syntax error, so it cannot be executed or auto-approved correctly.Reproduction steps
Environment: Zoo Code extension, any OS, any API provider.
Enter a command that uses a heredoc with a control operator on the opener line, e.g.:
or
Observe that the command is parsed as an unterminated heredoc (parse error) instead of a single valid heredoc command.
Expected result
The heredoc is recognized as a single valid command. The delimiter is
EOF(the control operator terminates the delimiter word), and the terminator lineEOFis found correctly.Actual result
The delimiter incorrectly becomes
EOF; echo done(orEOF | grep hi), the terminator line is never matched, and the whole valid command is reported as an unterminated heredoc.Variations tried (optional)
All three control operators (
;,|,&&) reproduce the issue. Quoted delimiters (<< 'EOF') are not affected.App Version
v3.74.0
API Provider (optional)
None
Model Used (optional)
No response
Zoo Code Task Links (optional)
No response
Relevant logs or errors (optional)
{ "type": "tool_result", "tool_use_id": "chatcmpl-tool-95e9934ee1b0601f", "content": "{\"status\":\"error\",\"message\":\"The tool execution failed\",\"error\":\"Malformed command: unterminated heredoc (<<) at position 4 -- near: `cat <<EOF; echo \\\"--- don...`. \"}" }