fix(version): suppress staleness warning for fork builds

When the gt binary is built from a local fork (e.g., ~/src/gastown),
the staleness check would incorrectly warn about being stale because
it compared against the rig's repo HEAD. This confused agents.

The fix detects fork builds by checking if the binary's embedded
commit exists in the target repo. If not, the binary was built from
a different repo and we report "fork build" instead of "stale".

Changes:
- Add IsForkBuild field to StaleBinaryInfo
- Add commitExistsInRepo helper to detect fork scenarios
- Update gt stale command to show "Binary built from fork" status
- Update doctor check to report fork builds as OK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
furiosa
2026-01-26 11:10:35 -08:00
committed by John Ogle
parent d0036b0768
commit 5ab01f383a
3 changed files with 37 additions and 2 deletions

View File

@@ -46,6 +46,16 @@ func (c *StaleBinaryCheck) Run(ctx *CheckContext) *CheckResult {
}
}
// Fork builds are fine - the binary was built from a different repo
if info.IsForkBuild {
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: fmt.Sprintf("Binary built from fork (%s)", version.ShortCommit(info.BinaryCommit)),
Details: []string{"Binary commit not in rig repo - likely built from local fork"},
}
}
if info.IsStale {
msg := fmt.Sprintf("Binary is stale (built from %s, repo at %s)",
version.ShortCommit(info.BinaryCommit), version.ShortCommit(info.RepoCommit))