Skip to content

porch run from a worktree containing nested .builders worktrees can resolve the NESTED worktree as its target repo and commit to that branch #1260

Description

@waleedkadous

Problem

When porch runs from a builder worktree that itself contains nested .builders/* worktrees (from nested task spawns, see #1254), its project/repo resolution can select the NESTED worktree instead of the worktree it was invoked from. The resulting commit lands on the nested worktree's branch.

Observed 2026-07-26 (shannon workspace): porch done invoked from .builders/spir-3276 (via the --help bug, filed separately) committed ed0ef3b86 — a two-line status.yaml build-complete change — onto builder/task-bXLl, the branch of a nested, stood-down task worktree at .builders/spir-3276/.builders/task-bXLl, and it was pushed. The invoking worktree's own status.yaml was left unchanged. The stray commit moved the tip of a branch whose SHA had been certified in a close report, forcing a visible correction to a delivered document.

Two aggravating factors: (a) the wrong-repo resolution is silent — output looked like a normal build-complete; (b) the affected branch belonged to a session that was deliberately stood down, i.e. precisely a branch nobody was watching.

Ask

Pin porch's repo/project resolution to the git worktree of the invocation cwd (git rev-parse --show-toplevel of cwd, not a scan that can descend into .builders/), or refuse with an explicit error when multiple candidate project roots are visible.

Related: #1254 (nested task-spawn registration), #1255, #1256.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions