fix: call resolve_forge_remote before formula_worktree_setup in supervisor-run.sh (implements #1120) (#1121)
Some checks are pending
ci/woodpecker/push/ci Pipeline is pending
ci/woodpecker/pr/ci Pipeline is pending
ci/woodpecker/pr/edge-subpath Pipeline is pending

Make formula_worktree_setup() self-heal: if FORGE_REMOTE is unset, call
resolve_forge_remote() automatically. This eliminates the class of bug
where a caller forgets the precondition, rather than patching one caller.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude 2026-04-21 14:07:20 +00:00
parent d368f904fb
commit 8c1ca922a9

View file

@ -792,10 +792,13 @@ build_sdk_prompt_footer() {
# Creates an isolated worktree for synchronous formula execution.
# Fetches primary branch, cleans stale worktree, creates new one, and
# sets an EXIT trap for cleanup.
# Requires globals: PROJECT_REPO_ROOT, PRIMARY_BRANCH, FORGE_REMOTE.
# Ensure resolve_forge_remote() is called before this function.
# Requires globals: PROJECT_REPO_ROOT, PRIMARY_BRANCH.
# Calls resolve_forge_remote() automatically if FORGE_REMOTE is unset.
formula_worktree_setup() {
local worktree="$1"
if [ -z "${FORGE_REMOTE:-}" ]; then
resolve_forge_remote
fi
cd "$PROJECT_REPO_ROOT" || return
git fetch "${FORGE_REMOTE}" "$PRIMARY_BRANCH" 2>/dev/null || true
worktree_cleanup "$worktree"