hotfix: fix dispatch command breaking on multi-line prompts#653
hotfix: fix dispatch command breaking on multi-line prompts#653marcusquinn merged 1 commit intomainfrom
Conversation
The bash -c construction used printf '%q' to escape cmd_parts, but multi-line prompts (from t173 worker restrictions) produce $'\n' sequences that break when embedded in bash -c double-quoted strings. Workers received malformed commands and printed help text instead of executing. Fix: write dispatch commands to temp script files in pids/ directory and execute those instead. This is robust regardless of prompt content. Fixes both cmd_dispatch (tabby + headless) and cmd_reprompt paths.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue where supervisor-dispatched workers would silently fail when processing multi-line prompts. The problem was traced to how Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sun Feb 8 19:43:08 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a critical issue where multi-line prompts broke command dispatching. The solution of writing commands to temporary script files instead of using bash -c with complex quoting is a solid approach. My review identifies a minor issue with this new approach: the temporary dispatch scripts are not cleaned up after execution, which can lead to file accumulation and violates the repository's style guide. I've provided suggestions to add cleanup steps to the execution commands.
| if [[ "$dispatch_mode" == "tabby" ]]; then | ||
| # Tabby: attempt to open in a new tab via OSC 1337 escape sequence | ||
| log_info "Opening Tabby tab for $task_id..." | ||
| local tab_cmd | ||
| tab_cmd="cd '${worktree_path}' && ${headless_env} ${cmd_parts[*]} > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" | ||
| tab_cmd="'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" | ||
| printf '\e]1337;NewTab=%s\a' "$tab_cmd" 2>/dev/null || true | ||
| # Also start background process as fallback (Tabby may not support OSC 1337) | ||
| # Use nohup + disown to survive parent (cron) exit | ||
| nohup bash -c "cd '${worktree_path}' && export ${headless_env} && $(printf '%q ' "${cmd_parts[@]}") > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | ||
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | ||
| else | ||
| # Headless: background process | ||
| # Use nohup + disown to survive parent (cron) exit — without this, | ||
| # workers die after ~2 minutes when the cron pulse script exits | ||
| nohup bash -c "cd '${worktree_path}' && export ${headless_env} && $(printf '%q ' "${cmd_parts[@]}") > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | ||
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | ||
| fi |
There was a problem hiding this comment.
The newly created dispatch_script is not removed after execution. This will lead to an accumulation of script files in the pids directory over time. The repository style guide requires that temporary files are cleaned up.
To address this, I suggest appending a cleanup command (rm -f '${dispatch_script}') to the commands that execute the script.
| if [[ "$dispatch_mode" == "tabby" ]]; then | |
| # Tabby: attempt to open in a new tab via OSC 1337 escape sequence | |
| log_info "Opening Tabby tab for $task_id..." | |
| local tab_cmd | |
| tab_cmd="cd '${worktree_path}' && ${headless_env} ${cmd_parts[*]} > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" | |
| tab_cmd="'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" | |
| printf '\e]1337;NewTab=%s\a' "$tab_cmd" 2>/dev/null || true | |
| # Also start background process as fallback (Tabby may not support OSC 1337) | |
| # Use nohup + disown to survive parent (cron) exit | |
| nohup bash -c "cd '${worktree_path}' && export ${headless_env} && $(printf '%q ' "${cmd_parts[@]}") > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | |
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | |
| else | |
| # Headless: background process | |
| # Use nohup + disown to survive parent (cron) exit — without this, | |
| # workers die after ~2 minutes when the cron pulse script exits | |
| nohup bash -c "cd '${worktree_path}' && export ${headless_env} && $(printf '%q ' "${cmd_parts[@]}") > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | |
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'" &>/dev/null & | |
| fi | |
| if [[ "$dispatch_mode" == "tabby" ]]; then | |
| # Tabby: attempt to open in a new tab via OSC 1337 escape sequence | |
| log_info "Opening Tabby tab for $task_id..." | |
| local tab_cmd | |
| tab_cmd="'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'; rm -f '${dispatch_script}'" | |
| printf '\e]1337;NewTab=%s\a' "$tab_cmd" 2>/dev/null || true | |
| # Also start background process as fallback (Tabby may not support OSC 1337) | |
| # Use nohup + disown to survive parent (cron) exit | |
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'; rm -f '${dispatch_script}'" &>/dev/null & | |
| else | |
| # Headless: background process | |
| # Use nohup + disown to survive parent (cron) exit — without this, | |
| # workers die after ~2 minutes when the cron pulse script exits | |
| nohup bash -c "'${dispatch_script}' > '${log_file}' 2>&1; echo \"EXIT:\$?\" >> '${log_file}'; rm -f '${dispatch_script}'" &>/dev/null & | |
| fi |
References
- Rule feat: add /session-review and /full-loop commands for comprehensive AI workflow #33 states that temporary files must have a
trapcleanup. While a trap is not directly applicable here due to the background process, the principle of cleaning up temporary files still applies. The generated dispatch scripts are temporary and should be removed after use. (link)
|
|
||
| # Use nohup + disown to survive parent (cron) exit | ||
| nohup bash -c "cd '${work_dir}' && $(printf '%q ' "${cmd_parts[@]}") > '${new_log_file}' 2>&1; echo \"EXIT:\$?\" >> '${new_log_file}'" &>/dev/null & | ||
| nohup bash -c "'${dispatch_script}' > '${new_log_file}' 2>&1; echo \"EXIT:\$?\" >> '${new_log_file}'" &>/dev/null & |
There was a problem hiding this comment.
The temporary dispatch_script created for reprompting is not cleaned up after execution, which violates the style guide rule for temporary files. This will cause script files to accumulate in the pids directory.
| nohup bash -c "'${dispatch_script}' > '${new_log_file}' 2>&1; echo \"EXIT:\$?\" >> '${new_log_file}'" &>/dev/null & | |
| nohup bash -c "'${dispatch_script}' > '${new_log_file}' 2>&1; echo \"EXIT:\$?\" >> '${new_log_file}'; rm -f '${dispatch_script}'" &>/dev/null & |
References
- Rule feat: add /session-review and /full-loop commands for comprehensive AI workflow #33 states that temporary files must have a
trapcleanup. The principle of cleaning up temporary files applies here. The generated dispatch scripts are temporary and should be removed after use. (link)



Summary
printf '%q'produces$'\n'sequences that break insidebash -cdouble-quoted stringsRoot Cause
build_dispatch_cmd()correctly builds multi-line prompts (task description + worker restrictions + memory context). Butcmd_dispatch()embeds the escaped command in abash -cstring:The
$'\n'fromprintf '%q'gets split across lines inside the double-quotedbash -cargument, producing invalid syntax. The worker process receives a truncated/malformed command and exits immediately with the help text.Fix
Write dispatch commands to temp script files (
pids/{task_id}-dispatch.sh) and execute those instead. Theprintf '%q'output is valid bash when written to its own file — the$'\n'sequences are interpreted correctly by the script's own bash process.Applied to both
cmd_dispatch(tabby + headless paths) andcmd_reprompt.Impact
ambiguous_skipped_ai(EXIT:1, 28-line logs containing only help text)self-improvement-02will work after this fix is deployedTesting
bash -npasses)$'\n'sequences are correctly interpreted in standalone script files