Skip to content

Stale Branch Detection

Quick Start: Sequant’s pre-flight checks now detect when a feature branch has fallen behind main, preventing wasted QA cycles and false merge-readiness verdicts. Configure the threshold in .sequant/settings.json to control how many commits behind triggers a warning or block.

Before /qa, /test, or /exec begin their main work, a pre-flight check counts how many commits the feature branch is behind origin/main. Depending on the count and which skill is running, Sequant either warns or blocks execution.

Skill0 commits behind1 to thresholdAbove threshold
/qaProceed normallyWarning, continuesBlocked (STALE_BRANCH)
/testProceed normallyWarning, continuesBlocked (STALE_BRANCH)
/execProceed normallyInfo messageWarning (never blocks)

The default threshold is 5 commits.

Stale branch detection runs automatically during pre-flight checks for /qa, /test, and /exec. No configuration is required.

When a branch is stale, you will see a table like this in the skill output:

CheckValue
Commits behind main8
Threshold5
StatusBlocked

When stale branch detection blocks QA or testing, rebase before retrying:

  1. Fetch the latest remote state:
    Terminal window
    git fetch origin
  2. Rebase onto main:
    Terminal window
    git rebase origin/main
  3. Re-run the skill (/qa, /test, etc.)

Edit .sequant/settings.json to change when blocking kicks in:

{
"run": {
"staleBranchThreshold": 10
}
}

Set a higher value for repositories with frequent commits to main, or a lower value for stricter merge hygiene.

OptionDescriptionDefault
staleBranchThresholdNumber of commits behind main before /qa and /test block execution5

This setting lives under the run key in .sequant/settings.json.

  1. Finish implementation with /exec
  2. Before running /qa, check how far behind your branch is:
    Terminal window
    git fetch origin && git rev-list --count HEAD..origin/main
  3. If the count exceeds the threshold, rebase first
  4. Run /qa — the pre-flight check confirms the branch is current

When running as part of sequant run or /fullsolve, the orchestrator handles branch freshness checks. Individual skills skip their own stale branch detection when the SEQUANT_ORCHESTRATOR environment variable is set.

QA blocked with STALE_BRANCH but branch looks current

Section titled “QA blocked with STALE_BRANCH but branch looks current”

Symptoms: /qa reports the branch is behind main even though you recently rebased.

Solution: Ensure you fetched the latest remote state. Run git fetch origin before retrying. The check compares against origin/main, not your local main.

Symptoms: Branches are frequently blocked because main moves fast.

Solution: Increase staleBranchThreshold in .sequant/settings.json. For high-velocity repositories, a threshold of 10-15 may be more practical.


Generated for Issue #304 on 2026-03-12