Repository navigation
Description
What is wrong
A project's default branch is only checked for being a valid branch name, wherever it is set: the web app's Settings → Project, fctl projects set --default-branch and PATCH /api/v1/projects/{id}. When the repository has no such branch (a typo, or a branch renamed or deleted on GitHub), new sessions don't fail. Each agent starts its branch empty, without any of the repository's files, and works from there. fctl run --base with a branch the repository lacks does the same.
How it works now
updateincrates/fctl-control/src/api/projects.rschecks the branch withfctl_domain::validate::branch(the rules ofgit check-ref-format) and never asks GitHub.createtakes the branch from GitHub when it links or creates the repository, unless the request names one.crates/fctl-agent/src/workspace.rsclones the repository and, whenorigin/<base branch>is missing, starts the session branch withgit checkout --orphan. The only sign is a warning in the session's log ("acme/web has no develop branch; starting fctl/12 empty"). That path is meant for empty repositories, which have no branches at all, but any missing base branch takes it.
Found while adding --default-branch to the CLI in #272.
What should happen
- Setting a default branch the repository doesn't have is refused, or at least warned about, where it is set. The control plane can ask GitHub through the App, as it already does for the repository itself. (fix: catch a default or base branch the repository doesn't have #298)
- A session whose base branch is missing from a repository that has commits fails with an error that names the branch and says how to fix it, instead of starting empty. Empty repositories still start an orphan branch. (fix: catch a default or base branch the repository doesn't have #298)
Compatibility
Checking the branch where it is set takes a control plane release only. Failing the session changes fctl-agent, which reaches sessions as their hosts update: hosts one version behind keep starting empty branches.
Decisions for a person
- Refuse a default branch the repository doesn't have, or accept it with a warning (for a branch someone is about to push)?
Activity
fctl-sh commentedon Oct 28, 2026
Done in #298, merged as 865e9e9.
fctl projects set --default-branch,PATCH /api/v1/projects/{id}), the control plane asks GitHub through the App and refuses a branch the repository doesn't have. The error names the branch and one the repository has, such as "acme/web has no branch named mian: push it first, or choose one it has, like main". An empty repository takes any branch. For the open decision, fix: catch a default or base branch the repository doesn't have #298 refuses rather than warns; that choice was listed for review there, and the pull request was approved and merged. This part is deployed to app.fctl.sh (CI run).docs/api.md,docs/cli.mdanddocs/architecture.mdon fctl.sh, andllms.txton fctl.sh and app.fctl.sh.fctl run --baseand schedules' base branches aren't checked when a session is created: such sessions fail as they start, once their hosts run the next release.