Make code-producing flows open a best-effort PR and derive branch handoff from run target - #169
Open
adamw wants to merge 15 commits into
Open
Make code-producing flows open a best-effort PR and derive branch handoff from run target#169adamw wants to merge 15 commits into
adamw wants to merge 15 commits into
Conversation
Share the throwaway-branch rule between the lifecycle and the PR helper, so a --skip-branch run opens its PR. Derive the branch handoff from the header's branch mode, not this invocation's flags. Replay the PR stages on resume regardless of what the probe answers now. Retry the probe's gh legs, fold gh's output to one line, strip a GHES port from the host, and name the right next action in every skip line.
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
Every code-producing built-in flow now ends with a best-effort PR step: when the repository is on GitHub and
ghcan reach it, the flow pushes the branch and opens a PR; when it can't—no remote, not GitHub,ghunreachable—the flow reports why in one line and finishes successfully without a PR.The per-flow
returnToStartBranchflag is gone. The run now decides where to leave the checkout: aNewBranchrun that opened a PR hands you back the branch you started on (the work is on the PR); every other run stays put.What changed
Tools: Added
gh.availability(), a read-only probe answering whether a PR can be opened as aGitHubAvailabilityenum (Available / NoRemote / NoHost / NotGitHub / Unreachable). MadePrHandlecarry the host as its first field so PR creation, lookup, and writes work on GitHub Enterprise Server. Derived the host from theoriginremote URL via the existingremoteHostparser.Flow runtime: Extracted the three stages of
openPrFromBranch(push → summarise → create) into private helpers. AddedopenPrIfGitHub, which probes first and either runs those stages or emits one Step naming the reason and returns None. Added a small explicit door onFlowControl—recordOpenedPr—so a flow that opens its PR with a baregh.createPrcan tell the lifecycle. AddedBranchHandoff.of(target, worktree, openedPr)to compute the checkout location: ReturnToStart only for NewBranch runs outside a worktree that opened a PR; everything else stays put.Built-in flows: Appended
openPrIfGitHub(codingAgent.cheap)to implement.sc, implement-interactive.sc, and simple.sc. Switched implement-enhanced.sc fromopenPrFromBranchtoopenPrIfGitHub. KeptopenPrFromBranchin issue-pr.sc (those flows require GitHub); addedrecordOpenedPrto issue-pr-bugfix.sc so the lifecycle learns about its tentative PR. RemovedreturnToStartBrancharguments and updated flow headers to describe the new behavior.Docs: Updated README to document
gh.availability, the new PR helper signatures, the host-awarePrHandle, and the target-derived branch handoff rule. Added a dated amendment to ADR 0018 R3. Updated AGENTS.md to list the new test fakes.The PR step runs outside a worktree by construction;
orca create/orca forkrun simple.sc in a sandbox with no remote, so the step skips cleanly there.