Inconsistent feature resolution: check-prerequisites.sh enforces branch name while setup-plan.sh/setup-tasks.sh honor feature.json
Summary
Feature-directory resolution is inconsistent across the bundled scripts. check-prerequisites.sh (used by /speckit.implement) enforces the feature-branch name unconditionally, while setup-plan.sh and setup-tasks.sh skip that check when .specify/feature.json pins a valid feature directory. As a result, a valid feature.json lets plan and tasks run on any branch, but /speckit.implement still fails on a branch not named NNN-....
Environment
- Spec Kit CLI:
0.8.18
Detail
scripts/bash/common.sh get_feature_paths resolves the feature directory from, in priority order:
SPECIFY_FEATURE_DIRECTORYenv var.specify/feature.jsonfeature_directory- branch-name prefix lookup
setup-plan.sh and setup-tasks.sh wrap the branch validation with feature_json_matches_feature_dir, e.g. "skip the git branch pattern check when feature.json resolves to the active feature dir". But check-prerequisites.sh calls check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" unconditionally, with no such guard. CURRENT_BRANCH comes from the git branch (unless SPECIFY_FEATURE is set), so feature.json alone does not let /speckit.implement proceed.
Steps to reproduce
- In a git repo, on a branch not named like
NNN-...(e.g.feature/foo), createspecs/001-x/{spec,plan,tasks}.mdand.specify/feature.json={"feature_directory":"specs/001-x"}. - Run the plan or tasks prerequisite (
setup-plan.sh/setup-tasks.sh): passes (feature.json honored). - Run
check-prerequisites.sh --json --require-tasks: fails withERROR: Not on a feature branch.
Expected
Consistent resolution. If .specify/feature.json (or SPECIFY_FEATURE_DIRECTORY) pins a valid feature directory, every prerequisite script should accept it.
Actual
check-prerequisites.sh ignores feature.json for the branch gate, so /speckit.implement fails where /speckit.plan and /speckit.tasks succeed.
Suggested fix
Wrap the check_feature_branch call in check-prerequisites.sh with the same feature_json_matches_feature_dir guard used by setup-plan.sh / setup-tasks.sh, so the branch-name check is skipped when feature.json resolves to the active feature directory.
Bug assessment โ check-prereqs-branch-gate: Invalid ยท severity N/A (already fixed in v0.10.0)
Bug Assessment: check-prerequisites branch gate inconsistency
- Slug: check-prereqs-branch-gate
- Created: 2026-06-30
- Source: issue #3273
- Verdict: invalid
- Severity: N/A
Report (summarized)
Reporter (@PechiSW) describes an inconsistency between check-prerequisites.sh and setup-plan.sh/setup-tasks.sh when a valid .specify/feature.json is present on a non-standard branch. According to the report:
setup-plan.sh/setup-tasks.shskip the branch-name check via afeature_json_matches_feature_dirguardcheck-prerequisites.shcallscheck_feature_branch "$CURRENT_BRANCH" "$HAS_GIT"unconditionally, ignoringfeature.json- Result:
/speckit.planand/speckit.taskssucceed, but/speckit.implementfails withERROR: Not on a feature branch
Environment: Spec Kit CLI 0.8.18
Symptom
The described symptom โ that check-prerequisites.sh enforces a branch-name pattern even when .specify/feature.json pins a valid feature directory โ does not reproduce against the current codebase. The functions and code paths the report references no longer exist.
Reproduction
- Set up a project on a non-standard branch (e.g.,
feature/foo) with.specify/feature.json = {"feature_directory":"specs/001-x"}and the requiredplan.md,tasks.md. - Run
check-prerequisites.sh --json --require-tasks(the script behind/speckit.implement). - Expected (per report): fails with
ERROR: Not on a feature branch. Actual (current code): succeeds โ no branch check is performed.
Suspected Code Paths
Code paths the report references:
| Path | Status |
|---|---|
scripts/bash/common.sh โ check_feature_branch() |
Removed in v0.10.0 |
scripts/bash/common.sh โ feature_json_matches_feature_dir() |
Never existed in current codebase |
scripts/bash/common.sh โ priority-3 branch-name lookup |
Removed; priority 3 is now an error, not a branch lookup |
scripts/bash/check-prerequisites.sh โ check_feature_branch call |
Does not exist โ only calls get_feature_paths() |
extensions/git/scripts/bash/git-common.sh โ check_feature_branch() |
Exists, but only called from create-new-feature-branch.sh |
Key evidence:
tests/test_timestamp_branches.py:362-368โTestCoreCommonRemovesGitHelpersexplicitly assertscheck_feature_branchandhas_gitare not present incommon.sh.tests/test_timestamp_branches.py:375-379โTestFindFeatureDirByPrefixRemovedassertsfind_feature_dir_by_prefixis also gone.- Current
get_feature_paths()(common.sh:154โ213) resolves via: (1)SPECIFY_FEATURE_DIRECTORY, (2).specify/feature.json, (3) hard error โ no branch name scanning. - Current
check-prerequisites.sh(scripts/bash/check-prerequisites.sh:86โ88) only callsget_feature_paths(); performs no branch validation.
Root Cause Hypothesis
The bug was valid at v0.8.18 (released 2026-05-29). At that version, check_feature_branch existed in scripts/bash/common.sh and was called unconditionally from check-prerequisites.sh, while setup-plan.sh had already been updated to honor feature.json (CHANGELOG v0.8.1: "fix(plan): use .specify/feature.json to allow /speckit.plan on custom git branches (#2305)").
The inconsistency was resolved wholesale in v0.10.0 (released 2026-06-09, commit 927f54f) by removing all git operations โ including check_feature_branch, has_git, and find_feature_dir_by_prefix โ from the core scripts entirely. CHANGELOG entry: "refactor(scripts): remove git operations from core scripts โ Remove has_git(), check_feature_branch(), git branch creation from core." The git extension now owns all branch-related logic.
Confidence: high โ corroborated by test assertions, commit history, and direct inspection of the current scripts.
Proposed Remediation
None required. The bug no longer exists in the current codebase. The broader v0.10.0 refactoring eliminated the inconsistency more thoroughly than the reporter's suggested targeted fix.
If the reporter is still hitting this on v0.8.18 with installed project scripts: the scripts under .specify/scripts/bash/ may be stale (copied at init time from an older version). Running specify init again to refresh the installed scripts, or upgrading to v0.10.0+, would resolve it.
Files likely to change: None.
Tests to add or update: None โ TestCoreCommonRemovesGitHelpers in tests/test_timestamp_branches.py already acts as a regression guard.
Risks & Considerations
- No code change is needed; closing as invalid.
- Users on pre-v0.10.0 with stale installed scripts may still observe the behavior โ a migration note could be added to the v0.10.0 release notes or upgrade guide if not already present.
Open Questions
- None. The codebase evidence is conclusive.
Posted on behalf of @mnriem by GitHub Copilot (model: claude-sonnet-4.6, autonomous)
Generated by ๐ Assess Bug from Labeled Issue for issue #3273 ยท 748.9 AIC ยท โ 13.4 AIC ยท โ 31.8K ยท โท
Please upgrade to the latest Specify CLI as it has been fixed in 0.10.0