mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-04 02:20:42 +08:00
fix(do): isolate stop hook by task_id to prevent concurrent task interference
When running multiple do tasks concurrently in worktrees, the stop hook would scan all do.*.local.md files and block exit for unrelated tasks. Changes: - setup-do.sh: export DO_TASK_ID for hook environment - stop-hook.sh: filter state files by DO_TASK_ID when set, fallback to scanning all files for backward compatibility Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,16 @@ project_dir="${CLAUDE_PROJECT_DIR:-$PWD}"
|
||||
state_dir="${project_dir}/.claude"
|
||||
|
||||
shopt -s nullglob
|
||||
state_files=("${state_dir}"/do.*.local.md)
|
||||
if [ -n "${DO_TASK_ID:-}" ]; then
|
||||
candidate="${state_dir}/do.${DO_TASK_ID}.local.md"
|
||||
if [ -f "$candidate" ]; then
|
||||
state_files=("$candidate")
|
||||
else
|
||||
state_files=()
|
||||
fi
|
||||
else
|
||||
state_files=("${state_dir}"/do.*.local.md)
|
||||
fi
|
||||
shopt -u nullglob
|
||||
|
||||
if [ ${#state_files[@]} -eq 0 ]; then
|
||||
|
||||
@@ -112,3 +112,4 @@ echo "Initialized: $state_file"
|
||||
echo "task_id: $task_id"
|
||||
echo "phase: 1/$max_phases ($phase_name)"
|
||||
echo "completion_promise: $completion_promise"
|
||||
echo "export DO_TASK_ID=$task_id"
|
||||
|
||||
Reference in New Issue
Block a user