Skip to content

Commit 21cb55a

Browse files
committed
claude_code_runtime: pass the prompt on stdin, not a trailing positional
--allowedTools is variadic and swallowed the trailing "$(cat instruction)" prompt argument, so Claude Code got no prompt and exited with 'Input must be provided...' before making a single model call. Pipe the instruction on stdin.
1 parent 97c5683 commit 21cb55a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

envs/claude_code_env/claude_code_runtime.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,16 @@ def build_run_cmd(config: ClaudeCodeConfig) -> str:
140140
if config.system_prompt
141141
else ""
142142
)
143+
# Pass the prompt on stdin, not as a trailing positional: ``--allowedTools`` is
144+
# variadic and would otherwise swallow the prompt argument as another tool.
143145
return (
144146
"set -o pipefail && "
145147
f'export PATH="{node_dir(config)}/bin:{npm_prefix(config)}/bin:$PATH" && '
146148
f"cd {workdir_path(config)} && "
149+
f"cat {instruction_path(config)} | "
147150
f"{claude_bin_path(config)} -p --output-format json --dangerously-skip-permissions "
148151
f"--model {config.model} "
149152
f"{turns_flag}{tools_flag}{system_flag}"
150-
f'"$(cat {instruction_path(config)})" '
151153
f"2>&1 | tee {agent_log_path(config)}"
152154
).strip()
153155

0 commit comments

Comments
 (0)