Reference.
resolveEvaluationScopeandgsd_run check evaluation-scope(#5164, epic #5056, ADR-5057 §4). The overview is in Architecture.
resolveEvaluationScope(projectDir, unit, options) takes a unit — a phase, a plan (<phase>-<plan>) or a quick task id — and returns:
| Field | Meaning |
|---|---|
status |
resolved (exactly the unit's own commits), degraded (the preferred evidence was absent or empty, so files come from wider evidence; reason says why) or unresolvable (git or the phase could not be read, including a git timeout; files is empty and means "could not look"). A plan or quick unit that matches nothing is resolved with reason: no-matching-commits (or empty-after-exclusions when its commits touched only excluded paths, or merge-only when every match is a merge, which carries only its own resolutions): git was read and the answer is "none", and the verb reports it as advisory, not pass |
source |
task-commits, plan-subjects, quick-subjects, phase-range or none |
commits |
the unit's commits (sha, subject, optionally body and files) |
changedFiles / files / missingOnDisk |
every path the commits touched; the subset that exists on disk (the reviewable set); the subset that no longer exists, by name |
outsideUnion |
files changed in the phase window by commits that are not the unit's, by name. What a listed catch-up merge (base branch merged into the phase branch) brought in from the base is base work the union deliberately omits, so it is not named here either, under an exact rule: a file is omitted only when it is in the merge's diff against its first parent, no listed commit sits on the merge's second-parent side, no listed non-merge commit is an ancestor of the second parent after the phase start (a branch forked from the phase), every merge-base of the two parents (git merge-base --all) is rangeBase or an ancestor of it (the fork-point rule: a side forked from phase work is phase work), and no commit of the phase window (<rangeBase>..<newest listed commit> minus what the second parent reaches, listed or not, made before or after the merge, the merge itself excluded) touched the file; any other merge commit in that window counts through its own changes against each of its parents (git log -m), so a phase-side merge's conflict resolution or edit is phase work, and a clean one over-includes (a file stays named, never hidden). Anything doubtful is named: an advisory false positive is accepted, hidden phase work is not. No merge-base, an empty-tree rangeBase (the phase directory arrived with the root commit) or any git call for that merge that fails or times out subtracts nothing for that merge only, and the scope stays resolved. Accepted cost: a second catch-up merge forks at the first catch-up's base commit, which is after rangeBase, so the base files it brings in are named as an advisory false positive. A SUMMARY whose every listed commit is a merge is merge-only-task-commits; a task commit that touched only excluded paths is not a merge, so it keeps the ordinary reasons. A phase branch merged into its base keeps its listed task commits on the merged side, so the base work in the window is still named |
unreachable |
listed task commits that are not reachable from the evaluated ref (another branch, dropped by a rebase), by name |
unparsedSummaries |
phase units: the live SUMMARY files that have a ## Task Commits section from which no commit id could be read, or in which a task row yielded no id, by name. Their work is not in the scope, so it is reported instead of left to read as complete. A task row may carry a qualifier before its colon (**Task 1 (tracer):**, **Task 1 RED:**), and the backticked ids on the first list level nested under a task row (a TDD task's RED and GREEN sub-bullets; wrapped description lines allowed, a blank line ends the row) belong to that row |
rangeBase |
the phase-start anchor (the parent of the commit that first added the phase directory, or --since), for consumers that need an anchor sha |
The design rules:
- The scope is a union, not a range. A range keeps every interleaved non-phase commit in its window. Measured on a 9,676-commit repository, the range held 23, 194 and 602 files for three phases where the union of the phases' own commits held 9, 42 and 69. A phase's commits are the
## Task Commitsrows of its SUMMARY files (section-scoped, row-scoped, backtick-anchored: a sha quoted in prose is not a task commit); a merge commit contributes only what the merge itself changed (its conflict resolutions and edits, fromgit show --remerge-diff, git 2.36 or newer), so a clean merge contributes nothing in either direction: a catch-up merge of the base branch into the phase branch adds none of the base's files, and a phase branch merged into its base adds none either, its files coming from its own task commits. On a git without--remerge-diff, and for an octopus merge, a merge contributes no files rather than the base branch's work. A SUMMARY whose listed commits are merges alone (for example only the phase-into-base merge sha) has no task commits of its own to read, so it degrades to the phase range withreason: merge-only-task-commits, neverresolvedwith just the merge's edits. - Only commits reachable from the evaluated ref count. The former
git log --alllet a commit on any branch satisfy a check. - An empty union never becomes an empty scope. A phase with no SUMMARY, no task rows, no reachable task commits, or only planning paths degrades to the phase-directory range and reports
degradedwith the reason. A phase directory git has never seen, or an unreadable repository, isunresolvable. - Plan commits are matched on the subject.
<type>(<phase>-<plan>):is anchored, tolerant of zero padding (03-01,3-1) and of decimal, N-segment and letter-suffixed phase numbers, and escapes every metacharacter, so03-01never matches03-010. An id carrying the project's CONFIGUREDproject_code(PRJ-01-01withproject_code: "PRJ", #5271) matches either spelling of the same plan —feat(PRJ-01-01):andfeat(01-01):— because the two init verbs hand out different phase tokens for one plan. The code is stripped only when it is the configured one, matched case-sensitively; the configured value only has to pass a safety check (a letter first, then letters, digits,_,.or-, at most 32 characters), sogsdandAUTH-Xwork. An id that merely looks coded (AUTH-01-02), and an unusableproject_codevalue, keeps the literal behaviour. Every spelling is built byqualifiedPlanSubjectPattern, the builder the workstream-qualified id proposed in #5177 is meant to share. - Every git call is bounded by the
execGitseam; a timeout or a missing git isunresolvable, never a throw and never an empty scope. - A
planning.sub_reposworkspace is read repo by repo (#5867). The workspace root need not be a git repo: the resolver runs the same lookup in each configured sub-repo (and in the root, when the root is itself a repo) and merges the result. Commits are ordered newest first by committer time withmaxCommitsapplied to the merged list;changedFiles,files,missingOnDisk,outsideUnionand eachcommits[].filesare workspace-relative (<sub-repo>/<path>); a phase task-commit id is resolved in whichever sub-repo holds it, and one no sub-repo holds is named inunreachable.--ref,--pathspec,--milestone-bound(each repo bounded at its own latest tag; a repo with none is unbounded) and--committed-sinceapply inside every repo, and a sub-repo that has no such commit (an empty repo, or a--refonly another repo has) contributes nothing; a--sincecommit filters the repo that holds it by ancestry and every other repo by that commit's committer time (a--sinceno repo holds isunresolvable:since-not-found). Names are normalized (./app/isapp), at most 64 are read, a phase's task-commit ids times repos are capped at 1024 lookups (sub-repo-too-many-lookups), sub-repo git runs withcore.fsmonitor=false, and a folder that is part of the workspace root's own repo is covered by the root. A configured sub-repo that is missing (also when the workspace root is itself a repo), escapes the project (symlinks included), or sits inside some other repo without being its own root makes the scopeunresolvablewith a reason naming it (sub-repo-unreadable:<name>:<cause>,sub-repo-escapes-root:<name>,sub-repo-invalid:<index>,sub-repo-too-many). A phase with no task commits has no phase-start anchor in a sub-repo, so unless the workspace root is a repo that tracked the phase directory it is an emptydegradedscope whose reason ends:no-phase-start-anchor(advisory, never a pass).--pathspecis a git pathspec evaluated inside each repo, so it is repo-relative (src, notapi/src); two config names that resolve to one repo are read once under the first spelling listed; a sub-repo whose directory cannot be run in makes the ancestry answer unknown (null).tdd-review-checkpoint's ancestry check asks the workspace root (when it owns its repo) and then each sub-repo, and the first repo that holds the commits answers; a repo that times out leaves the answer unknown (null), never "no". Withoutsub_reposnothing changes.
Workflows reach it as gsd_run check evaluation-scope:
gsd_run check evaluation-scope --phase <phase> [--since <sha>] --raw # a phase (or --phase-dir <dir>; --ref <ref>)
gsd_run check evaluation-scope --plan <phase>-<plan> --raw # a plan: --commits-only, --max-commits N,
# --milestone-bound, --committed-since <date>,
# --pathspec <glob> (repeatable),
# --all-branches (plan/quick only; see below)
gsd_run check evaluation-scope --quick <quick-id> --include-files --raw # a quick task--all-branches (plan and quick units only; a usage failure on a phase) looks the unit's commits up across every local branch instead of the commits reachable from --ref, and adds latestCommitTime (unix seconds of the newest match, or null) to the payload. It exists for the executor stall probe (#6117): a worktree executor's commits sit on its own unmerged agent branch until the wave merges. It is an explicit opt-in; the gates keep the reachable-from-ref contract above, and without the flag the payload is unchanged.
The verb is a resolver, not a policy: it always reports block: false, and the caller decides what a degraded or unresolvable scope means. scripts/lint-evaluation-scope-drift.cjs fails CI when a gate module, verify, a workflow or an agent derives its own range again (git log … --all, git diff … ..HEAD, a HEAD~N anchor, a hand-rolled phase-start anchor, a commit-message lookup); its allowlist pins exact non-scope sites and is drained, never renewed.
Behavior differences from the pre-resolver derivations: a UI file, task commit or decision that appears only in an interleaved non-phase commit, or only on another branch, no longer counts toward a phase or plan; ui-safety-gate reads the whole phase's commits instead of the last one and reports scopeStatus / scopeReason when the scope was widened or unreadable; decision-coverage-verify and verify schema-drift read the phase's own commit messages instead of the last 200 (or 50) commits of any branch; the code-review step names deleted files and out-of-scope files instead of counting them.