Skip to content

Crews: branch renames do not break worktree launches #752

Closed

Description

@bryantderosier

Additional story in the Crews: organic teamwork milestone, addressing a launch gap not covered by the existing Crews v2 slices.

The problem

A Crew proposal used j5code/2969a292 as a new worktree's base, copied from the Captain's session-start snapshot. J5 had since renamed that branch to j5code/next-16-upgrade-analysis. Preview reported the affected member as unavailable because the old ref no longer resolved, and blocked the whole roster with “Nothing was spawned.” Replacing the base with an existing commit allowed a new proposal to proceed.

The validation is useful, but keeping a mutable branch name as the launch dependency lets routine branch naming invalidate a proposal. The user should be able to approve a Crew and get worktrees from the intended revision even if that revision's branch is subsequently renamed, moved, or deleted.

What we already have

Inspected at j5/main commit 50e5f284634f68b8f319026074b2e9d63d7eaf8b:

Proposal

Resolve a new worktree's intended base to a full commit SHA before accepting its proposal, persist that SHA, and use it through preview, approval, restart, and worktree preparation. Retain the requested branch/ref as a readable label. For “start from the Captain's current checkout,” capture that checkout's current commit on the server instead of relying on a branch name copied into the agent's session snapshot.

Implement the binding in J5's workspace/launch service boundary and pass the pinned commit to upstream's existing worktree preparation. Do not introduce branch aliases, automatic branch-rename repair, or silent fallback to another revision.

Acceptance criteria

  • Every accepted new-worktree choice has a durable full commit SHA before a roster or addition proposal is stored. Its original requested ref remains available for display and diagnosis.
  • A base meaning the Captain's current checkout is resolved from that checkout at request time. It does not depend on a temporary branch name from a session-start snapshot. Uncommitted changes are not implicitly included.
  • An explicit ref that cannot resolve when submitted is refused immediately, naming the member, ref, and corrective action. No unapprovable new proposal or member is created, and the server never guesses a replacement revision.
  • Preview, approval, and worktree preparation use the saved SHA. Renaming, moving, or deleting the source branch after proposal acceptance does not change the selected revision or prevent launch while that commit remains available.
  • The preview identifies the selected revision, and approval binds the same SHA. Editing a member's base resolves and previews a new SHA and requires approval of that edited choice; an ordinary refresh never silently advances an existing pin.
  • Automatic approval and direct additions under Crews: Agent Setup, auto-approve new Crews, and additions without approval #743 use the same binding. Delaying a member's first assignment under Crews: members start when there's work for them #745 does not resolve its base again.
  • For start_from_origin, preserve its requested fetch/source semantics when selecting the commit; subsequent preparation uses the pinned commit without advancing it to a newer origin tip.
  • Identical retries and server restarts preserve the original pin and existing proposal/member identities. Changed request arguments retain fix(j5): reject changed spawn and Crew proposal replays #660's replay-conflict behavior; retrying is not an implicit re-pin.
  • Existing open proposals from before this change have an explicit compatibility path: resolve and expose a pin for review before launch when possible; if their ref is already gone, explain the required edit or replacement. Never infer the missing revision from another branch.
  • A genuinely unavailable pinned commit fails visibly with the member and revision named, without falling back to the Captain's checkout or current branch tip. Existing destination-branch collision checks remain in force.
  • Focused behavior tests cover a branch rename between proposal and approval, a rename between approval and preparation, source-branch movement/deletion with the commit retained, an already-stale submitted ref, a base edit, restart/retry, and automatic/direct launch paths. Coordinate deferred-activation coverage with Crews: members start when there's work for them #745. Use deterministic barriers rather than sleeps.
  • Update the J5 workspace/tool guidance and affected contracts as needed so agents and the roster editor use the same revision semantics.

Out of scope

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

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions