Repository navigation
fix: catch a default or base branch the repository doesn't have - #298
Merged
kalaspuff merged 3 commits intoOct 28, 2026
Merged
Conversation
…thout a base The control plane asks GitHub, through the App, whether the repository has a project's default branch when it or the repository changes (or a link names one), and refuses one it lacks; an empty repository takes any. fctl-agent fails a session whose base branch is missing from a repository with commits, saying how to fix it, instead of starting an empty branch, and leaves no clone for a resume to reuse. Empty repositories still start an orphan branch. Refs #273
Also shortens the agent's failure: the session page shows the branch it would have made.
…ranch Settings → Project shows a field's error under its field, and has no repository: a refusal on repo, as for a repository the workspace may no longer use, would show nowhere when someone changes the default branch. fctl-agent also fails with the missing branch's message when it can't remove the clone.
kalaspuff
approved these changes
Oct 28, 2026
kalaspuff
deleted the
fctl/386-issue-about-invalidly-specified-branch-n
branch
October 28, 2026 13:16
Closed
2 tasks done
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
A project's default branch was only checked for being a valid branch name, and a session whose base branch the repository lacked started an empty branch, with only a warning in its log. Now both ends catch it:
PATCHchanges the default branch or the repository, or when aPOSTthat links a repository names a branch. A branch the repository lacks is refused with a validation error ondefault_branch, such as "acme/web has no branch named mian: push it first, or choose one it has, like main". Settings → Project shows it under Default branch. An empty repository takes any branch. Saving other settings never asks GitHub, even though the web app sends the branch with every save, so an outage or a branch deleted since doesn't block unrelated changes.fctl projects set --default-branch) and start a new session, or push the branch and resume this one. Forfctl run --baseit says to start a new session from a branch the repository has. The agent removes the clone it just made, because a resume runs in the same sandbox and would otherwise reuse a checkout that isn't on the session's branch. Empty repositories still start an orphan branch.Verified with unit tests for GitHub's answers, the messages and the agent's preparation against real git repositories. I checked the GraphQL query's answers against real GitHub: an existing branch, a missing one, a prefix of a branch with a slash, an empty repository, a missing repository and a renamed one. End to end in
cargo xtask dev, with projects linked to octocat/Hello-World and an empty public repository: a missing default branch and--base nopefail with their messages,--base masterworks, resuming a failed session clones afresh in the same sandbox, and the empty repository starts an orphan branch. The dev stack has no GitHub App, so the control plane's call to GitHub ran only in unit tests.cargo xtask check --quickpasses.Only a control plane release is needed for the refusal. The agent change reaches sessions as hosts update: agents one version behind keep starting empty branches.
Screenshots
At 98409f0. A session whose project's default branch (
main) octocat/Hello-World doesn't have, light theme at 1440 px and dark at 390 px. The reason shows twice, as the error notice and on the Failed line, as every preparation failure does:Settings → Project after saving
mianas the default branch, in both themes. The dev stack has no GitHub App to ask, so Playwright answered thePATCHwith the error this control plane sends:Worth confirming
POSTwithcreate_repoand adefault_branchis refused, since GitHub makes the new repository with one branch, which becomes the default. No fctl client sends both, and the API docs didn't list the field there.fctl run --baseand schedules' base branches aren't checked when a session is created: such sessions fail as they start, with the reason above. Checking them would add a GitHub call to every session start that names a base.Fixes #273
fctl session