You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bg task output path extraction on session resume
When a Claude Code session is resumed, the current transcript's session
id differs from the session that launched a background task, so the
task's .output file lives under the old session dir while the stop hook
probed a path derived from the new transcript. Dead/orphaned tasks were
never pruned, blocking the loop from reaching Codex review.
Teach is_bg_task_alive to extract the real output path recorded in the
transcript launch message, piping an optional transcript_path arg
through prune_dead_bg_task_ids and list_pending_background_task_ids.
Falls back to the derived tasks_dir when the transcript is unreadable or
the message is missing.
Add regression tests AC-25 (session resume) and AC-25b (whitespace in
recorded output path).
local tool_use_id="$1" bg_task_id="$2" output_path="$3"
242
+
jq -c -n \
243
+
--arg id "$tool_use_id" \
244
+
--arg bid "$bg_task_id" \
245
+
--arg out "$output_path" \
246
+
'{
247
+
type:"user",
248
+
message:{
249
+
role:"user",
250
+
content:[{tool_use_id:$id, type:"tool_result",
251
+
content:[{type:"text", text:("Command running in background with ID: " + $bid + ". Output is being written to: " + $out + ". You will be notified when it completes.")}]}]
252
+
},
253
+
toolUseResult:{backgroundTaskId:$bid}
254
+
}'
255
+
}
256
+
240
257
emit_task_completion_event() {
241
258
local task_id="$1" tool_use_id="$2" status="${3:-completed}"
0 commit comments