Skip to content

fix: install-test default-branch probe on shallow checkout - #583

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-582
May 23, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-582

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

The tend-install-test workflow's drift-check step fails on every install PR with:

error: Not a valid ref: refs/remotes/origin/main

Root cause: git remote set-head origin --auto requires the target ref (e.g. refs/remotes/origin/main) to already exist locally. With default actions/checkout@v6 settings, only the PR head ref is fetched — so the command errors before any default-branch detection happens.

Solution

Resolve the default branch via the GitHub API, fetch it shallowly, then point origin/HEAD at it. The generator's _detect_default_branch_local (git rev-parse --abbrev-ref origin/HEAD) then sees the correct value, so a repo with a non-main default doesn't report spurious drift.

Testing

  • Added an assertion in test_install_test_workflow_shape that the workflow uses the API-based probe and not git remote set-head (which would fail on shallow checkouts).
  • Regenerated the test_install_test_workflow_regtest snapshots for both Claude and Codex harnesses.
  • Reproduced the original failure locally with a shallow single-branch clone — confirmed the new command sequence sets origin/HEAD correctly.
  • Full pytest suite passes (242 tests); pre-commit clean.

Closes #582 — automated triage

`git remote set-head origin --auto` requires the target ref to already
exist locally, but `actions/checkout@v6` only fetches the PR head ref —
so the step errors with `Not a valid ref: refs/remotes/origin/main` on
every install PR. Resolve the default branch via the GitHub API, fetch
it shallowly, then point `origin/HEAD` at it.

Closes #582

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

can we implement this by passing args to the checkout action?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Not quite — actions/checkout has no input that sets refs/remotes/origin/HEAD. The closest knob is fetch-depth: 0, which fetches all branches (so origin/<default> exists), but it still doesn't run git remote set-head, so the generator's git rev-parse --abbrev-ref origin/HEAD would still fall back to main. We'd need a follow-up git remote set-head origin --auto either way, and fetch-depth: 0 pulls the full history of every branch just to set one ref.

The current API + shallow-fetch approach grabs only the one ref it needs and doesn't depend on set-head --auto succeeding (which is what was failing originally). Happy to switch to fetch-depth: 0 + git remote set-head origin --auto if you'd prefer the simpler-looking workflow at the cost of a heavier fetch.

@max-sixty
max-sixty merged commit 1a3700a into main May 23, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/issue-582 branch May 23, 2026 15:12
@max-sixty max-sixty mentioned this pull request May 23, 2026
2 of 3 tasks
max-sixty added a commit that referenced this pull request May 23, 2026
## Summary

- Bumps generator version to 0.1.0 and syncs lockfile.

7 commits since 0.0.25:
- fix: jitter outage-issue dedup to handle concurrent matrix-leg
failures (#586)
- fix: install-test default-branch probe on shallow checkout (#583)
- fix: pin install-tend badge link to max-sixty/tend (#585)
- skills(review-reviewers): call out commenter-self-edit filters as a
non-issue (#581)
- triage: skip on tend-outage labeled issues (#579)
- fix: use REST API for author_association in triage skill (#571)
- skills(running-in-ci): catch already-merged sibling PRs in dedup
(#569)

## Test plan
- [x] `wt test` passes
- [x] `pre-commit run --all-files` passes
- [ ] CI green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tend-install-test.yaml drift-check fails on default shallow actions/checkout: Not a valid ref: refs/remotes/origin/main

2 participants