Skip to content

porch approve run from workspace root mis-resolves the project into an UNRELATED builder worktree, then auto-commits AND auto-pushes onto that builder's published branch #1593

Open

Description

@amrmelsayed

What happened (2026-09-03, shannon workspace, receipts below)

Architect ran porch approve 4679 verify-approval --a-human-explicitly-approved-this from the workspace root (the documented flow — codev/roles/architect.md shows porch approve as a root-level architect command). The 4679 project's porch state exists in the root checkout AND — because porch state is committed and the project's PRs merged to ci — in every builder worktree created after those merges (8 copies on disk).

porch resolved the project into .builders/bugfix-3229 — an unrelated builder worktree owned by a different architect (its mtime was the most recent; resolution appears to scan worktrees rather than prefer cwd) — and then:

  1. wrote the approval into that worktree's codev/projects/4679-*/status.yaml,
  2. auto-committed 3 commits onto builder/bugfix-3229 (chore(porch): 4679 verify build-complete (auto), … gate-approved, … protocol complete; e459f7538 / 3421dc26d / d962b36d5, 13:01:56–13:02:02 +1000),
  3. auto-pushed them to origin/builder/bugfix-3229 — a published branch of a live builder in a different lane.

Meanwhile the CLI printed '🎉 PROTOCOL COMPLETE' with no indication of WHICH worktree/branch it had acted on. The real project's worktree (.builders/spir-4679) still showed the gate pending; its builder was blocked at porch done with GATE REQUIRED. Recovery required hand-locating the stray write (find … status.yaml by mtime), re-running approve from inside the correct worktree via a subshell cd, and asking the other architect to git revert the 3 pushed commits (published branch — no rebase).

Contrast case

porch approve 4755 plan-approval from the same root cwd resolved correctly — that project's state exists in exactly ONE worktree. The bug needs multiple worktrees carrying the same project dir, which is the normal steady state for any project whose porch state has merged to the default branch while other builders exist.

Why this is severe

  • Cross-lane state corruption: an approval for project A lands as pushed commits on unrelated project B's published branch; if B's PR merges, bogus protocol-complete state for A enters the default branch through the wrong lineage.
  • The gate the human actually approved stays UNRECORDED — the builder stays blocked while the CLI reports success.
  • Silent: no output names the resolved worktree/branch.

Suggested fixes (any subset)

  1. Deterministic resolution: prefer cwd's project registry; if cwd is the workspace root, resolve to the worktree whose branch matches the project (builder/<protocol>-<id>), never by scan order/mtime.
  2. Refuse ambiguity: if multiple candidate worktrees hold the project and cwd doesn't disambiguate, error listing them (like consult's 'Multiple projects found') instead of picking one.
  3. Print the target: every porch write names the worktree + branch it acted on.
  4. Never auto-push onto a branch whose name doesn't match the project being acted on.

Activity

  1. amrmelsayed commented on Sep 3, 2026

    @amrmelsayed
    CollaboratorAuthor

    Verification receipt from the affected lane's architect (app, shannon workspace): independently confirmed all three stray commits on builder/bugfix-3229 touch ONLY codev/projects/4679-voice-unified-playback-of-agen/status.yaml (git show --stat on each). Remediation in progress on their side: git revert newest-first (published branch, no rebase), plus a pre-merge check that the affected PR's diff carries no 4679-* paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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