Skip to content

Warn dstack skill about heredocs split across commands items - #4348

Merged
r4victor merged 1 commit into
masterfrom
pr_dstack_skill_commands_join
Oct 7, 2026
Merged

r4victor merged 1 commit into
masterfrom
pr_dstack_skill_commands_join

Conversation

@r4victor

@r4victor r4victor commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

dstack joins commands items into one shell line with && after stripping each item:

def _join_shell_commands(commands: List[str]) -> str:
for i, cmd in enumerate(commands):
cmd = cmd.strip()
if cmd.endswith("&"): # escape background command
cmd = "{ %s }" % cmd
commands[i] = cmd
return " && ".join(commands)

So a heredoc that ends an item never sees its terminator: the next item lands on the terminator line, the rest of the script becomes heredoc text, and the run exits 0 without running anything after it. A trailing # comment in an item silently drops the following items the same way.

This hit a preset creation session for Qwen3.8-Flash-Next on 4xH200: the agent split a heredoc writing the nginx config into its own commands item, so the final verification service exited 0 after the model download without starting the engines. The agent took about 10 minutes to notice and relaunch, which delayed the preset by ~10 minutes of idle 4xH200 time plus a second service launch.

  • Add a best-practice bullet to the dstack skill (also bundled into the preset agent) to keep multi-line shell such as heredocs inside one commands item and to avoid trailing comments.

The underlying joining in _join_shell_commands is unchanged; making it heredoc-safe is a separate fix.

@r4victor
r4victor merged commit c2850b2 into master Oct 7, 2026
20 of 24 checks passed
@r4victor
r4victor deleted the pr_dstack_skill_commands_join branch October 7, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant