Repository navigation
Continue an existing Issue branch - #20
Merged
Merged
Conversation
Issue branch selection now reads the Issue branches on origin (one git ls-remote) and their PRs in any state (one gh pr list). If the highest-numbered one is on origin with no PR or an open PR, the run checks it out and gives the agent the continuation prompt, in its update-PR form when a PR is open. An open PR's base becomes the Base branch, with a note on stderr when it differs from the checkout. A local Issue branch that doesn't match its origin copy stops the run before anything is created. Numbered branches after a merged or closed PR are left to #7; for now that case is an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anch From review: selection now refuses a local Issue branch that differs from origin, and works out the Base branch itself, so a detached HEAD only matters when the Base branch has to come from the checkout. PR state is an enum, gh JSON calls share one helper, and branch names come from one function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the pre-flight checks (#4) and the README. Pre-flight is split around Issue branch selection: - preflight::check (Origin match, issue open, git identity) runs first. - The Base branch comes from the selection (the open PR's base, else the checked-out branch), so a detached HEAD still doesn't block a Continuation whose open PR supplies it. The detached-HEAD error keeps pre-flight's hint. - preflight::check_base_branch then checks that base exists on origin and that the local copy, if there is one, isn't ahead. A PR's base need not exist locally. Both branches added a gh JSON helper; issue-6's (plain Value, "no pull requests found" handled by pull_request_for) is kept and issue_is_open uses it. The gh-call test now expects pre-flight's `issue view` first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in merging the Base branch with a conflict Repair (#8) and the progress lines (#10). - run.rs: main's run_session runs the implement session with the prompt Issue branch selection picked (fresh or continuation), so a Continuation also gets the Base-branch merge and Repair afterwards. - worktree.rs: the shared Worktree::add prints main's "creating worktree" progress line, naming its start ref (origin/<base> fresh, origin/<branch> continued). Callers do the fetching. - prompt.rs, tests/support: both sides' additions kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the Failed run path (#5): failure commit, push, draft PR, interrupts. - run.rs: keeps main's run/implement split so any failure after the worktree exists goes through failed_run::fail. run() does Issue branch selection and creates the fresh or continued worktree and its prompt; implement() takes the prompt. The interrupt check still comes right before the worktree is created. - github.rs: PullRequest keeps issue-6's typed fields (number, head, PrState) and gains main's is_draft and is_open(); PR_FIELDS asks for isDraft. main's mark_ready/convert_to_draft and gh() helper are kept alongside issue-6's gh_json. - tests: both added an origin_has_branch helper. issue-6's (branch, from, commits) covers main's single use, so failed_run.rs now calls origin_has_branch("develop", "main", &[]). The fake gh supports both pr list and pr ready, and the harness passes FAKE_GH_RECORD through main's shared command builder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continuation (ADR-0002): if an Issue branch is already on origin with no PR, or with an open PR, the Run picks it up instead of starting over.
Tested seams
thirdshiftCLI (the one seam agreed in the spec Spec: thirdshift, turn a GitHub issue into a ready-for-review PR unattended #2): tests run the compiled binary against real git and fakegh/claude, and check stdout, stderr, the exit code, origin's branches, the fake GitHub state, and the promptclaudereceived.Evidence
Before (
main):thirdshift <issue 7>withissue-7already on origin createsissue-7fresh frommain. The push is rejected (non-fast-forward) and the run exits 1.After:
cargo test: 12 intests/continuation.rs+ 11 intests/fresh_run.rs+ 10 intests/preflight.rs, all passing:I checked that the local-branch tests aren't vacuous: with the local-branch check disabled, both "stops the run" tests fail.
Merge Danger
Door: two-way
The change adds no stored state or migrations. A Continuation only adds commits and pushes; it never rebases or force-pushes. The one destructive step (
worktree add -B, then the existingbranch -Dat cleanup) runs only after selection has checked that the local Issue branch matches origin's.Blast Radius: runs
Every Run now makes a
gh pr listcall before the worktree exists. Aghfailure there now stops a run that used to be fresh. A merged or closed PR onissue-<n>now errors instead of starting over onissue-<n>(that case gets numbered branches in #7).Unaddressed findings
Standards
Worktree::addtakes raw git flags (-b/-B): private, two callers, and the flags say exactly what git does. An enum would only rename them.matchonSelectioninrun.rsfor worktree + prompt: the Base branch logic moved ontoSelection(the domain rule from ADR-0002). Building the worktree and prompt stays inrun.rs, which is where the Run's steps live.IssueBranchtype: the repeatedformat!is gone (everything goes throughbranch_name). A dedicated type would only wrap two private functions used in one module.Spec
git ls-remotecalls: git is real in the harness, and counting its network calls would mean tracing git internals. Selection makes exactly onels-remotecall by construction; theghside is asserted.issue-<n>with no origin copy is an error: kept on purpose. User story 16 says local-only commits are never destroyed, and the run would otherwise delete that branch at cleanup.issue-<n>there would reopen finished work, which ADR-0002 forbids.isCrossRepository): a fork'sissue-7is not this repository's Issue branch. The filter costs nothing and avoids a wrong Continuation.<base>, and the local<base>may be stale or missing when the PR's base isn't checked out: the prompt wording is the spec's verbatim, and the same staleness applies to fresh runs. Fixing it means either creating or moving the user's local branches or changing the spec's prompt; worth deciding in the spec, not here.origin/<base>is fetched so the agent can use it.gh pr list --search head:relies on GitHub's search index, which can lag: the alternative, listing every PR without--search, grows with the repo's whole PR history. The lag is seconds, and the only case it affects is a PR merged moments before the Run, which matters for Numbered Issue branches after a merged or closed PR #7. Revisit there if needed.Closes #6
🤖 Generated with Claude Code