Skip worker launch when build_*_prompt returns empty content

This commit is contained in:
Rebase Agent
2026-05-14 04:19:26 +00:00
committed by Forgejo
parent 0fb95af78b
commit fc7fed644d
+10 -1
View File
@@ -1185,7 +1185,7 @@ main_loop() {
local tmp_prompt
tmp_prompt=$(mktemp "/tmp/ocb-${worker_tag}-${$}.XXXXXX.txt") || continue
local prompt_text
local prompt_text=""
case "$agent" in
*implementation*) prompt_text=$(build_impl_prompt "$item" "$kind" "$work_num") ;;
*merge*) prompt_text=$(build_merge_prompt "$item" "$work_num") ;;
@@ -1193,6 +1193,15 @@ main_loop() {
*grooming*) prompt_text=$(build_groom_prompt "$item" "$kind" "$work_num") ;;
esac
# Skip if the build function returned an empty prompt — sending
# an empty body to prompt_async results in "no user message
# found in stream" errors on the server.
if [[ -z "$prompt_text" ]]; then
log_warn "[pool:${prefix}] built empty prompt for ${kind} ${work_num} (${agent}) — skipping launch"
rm -f "$tmp_prompt"
continue
fi
printf '%s' "$prompt_text" > "$tmp_prompt"
$SESSION_START --server "${BASE}" --tag "$worker_tag" --agent "$agent" --prompt-file "$tmp_prompt" --restart \