fix(refinery): use mayor/rig fallback for correct git remote

Refinery was using rig.Path which found the town's .git with rig-named
remotes (e.g., 'gastown') instead of 'origin'. This caused refinery to
miss polecat branches when fetching.

Now falls back to mayor/rig (which has 'origin' pointing to the project
repo) when refinery/rig doesn't exist.

Fixes: hq-uvrzt
This commit is contained in:
mayor
2026-01-09 12:41:56 -08:00
committed by Steve Yegge
parent 1701474b3d
commit ff3d1b2e23
2 changed files with 13 additions and 4 deletions

View File

@@ -94,13 +94,21 @@ func NewEngineer(r *rig.Rig) *Engineer {
// Override target branch with rig's configured default branch
cfg.TargetBranch = r.DefaultBranch()
// Determine the git working directory for refinery operations.
// Prefer refinery/rig worktree, fall back to mayor/rig (legacy architecture).
// Using rig.Path directly would find town's .git with rig-named remotes instead of "origin".
gitDir := filepath.Join(r.Path, "refinery", "rig")
if _, err := os.Stat(gitDir); os.IsNotExist(err) {
gitDir = filepath.Join(r.Path, "mayor", "rig")
}
return &Engineer{
rig: r,
beads: beads.New(r.Path),
mrQueue: mrqueue.New(r.Path),
git: git.NewGit(r.Path),
git: git.NewGit(gitDir),
config: cfg,
workDir: r.Path,
workDir: gitDir,
output: os.Stdout,
eventLogger: mrqueue.NewEventLoggerFromRig(r.Path),
router: mail.NewRouter(r.Path),

View File

@@ -162,8 +162,9 @@ func (m *Manager) Start(foreground bool) error {
// Working directory is the refinery worktree (shares .git with mayor/polecats)
refineryRigDir := filepath.Join(m.rig.Path, "refinery", "rig")
if _, err := os.Stat(refineryRigDir); os.IsNotExist(err) {
// Fall back to rig path if refinery/rig doesn't exist
refineryRigDir = m.workDir
// Fall back to mayor/rig (legacy architecture) - ensures we use project git, not town git.
// Using rig.Path directly would find town's .git with rig-named remotes instead of "origin".
refineryRigDir = filepath.Join(m.rig.Path, "mayor", "rig")
}
// Ensure runtime settings exist in refinery/ (not refinery/rig/) so we don't