Add gastown postPatch bug fixes from jt flake

- Fix mail router normalization in validateRecipient
- Fix agentBeadToAddress to use title field for hq- prefixed beads
- Fix crew/polecat home paths (remove incorrect /rig suffix)
- Fix town root detection (RoleUnknown instead of RoleMayor)
- Fix copyDir symlink handling
- Pin to gastown commit 177094a matching jt flake

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-28 16:14:06 -08:00
parent 346c031278
commit 2799632308
2 changed files with 63 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ let
pname = "gastown";
version = "unstable-${gastownRev}";
src = globalInputs.gastown;
vendorHash = "sha256-ripY9vrYgVW8bngAyMLh0LkU/Xx1UUaLgmAA7/EmWQU=";
vendorHash = "sha256-+qaxEZgC2u51O458p3ZqZ333E/R0iRb+uKhKn8GcJJo=";
subPackages = [ "cmd/gt" ];
doCheck = false;
@@ -31,6 +31,65 @@ let
"-X github.com/steveyegge/gastown/internal/cmd.BuiltProperly=1"
];
# Bug fixes not yet merged upstream
postPatch = ''
# Fix validateRecipient bug: normalize addresses before comparison
# See: https://github.com/steveyegge/gastown/issues/TBD
substituteInPlace internal/mail/router.go \
--replace-fail \
'if agentBeadToAddress(agent) == identity {' \
'if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {'
# Fix agentBeadToAddress to use title field for hq- prefixed beads
substituteInPlace internal/mail/router.go \
--replace-fail \
'return parseAgentAddressFromDescription(bead.Description)' \
'if bead.Title != "" && strings.Contains(bead.Title, "/") { return bead.Title }; return parseAgentAddressFromDescription(bead.Description)'
# Fix crew/polecat home paths: remove incorrect /rig suffix
substituteInPlace internal/cmd/role.go \
--replace-fail \
'return filepath.Join(townRoot, rig, "polecats", polecat, "rig")' \
'return filepath.Join(townRoot, rig, "polecats", polecat)' \
--replace-fail \
'return filepath.Join(townRoot, rig, "crew", polecat, "rig")' \
'return filepath.Join(townRoot, rig, "crew", polecat)'
# Fix town root detection: don't map to Mayor (causes spurious mismatch warnings)
substituteInPlace internal/cmd/prime.go \
--replace-fail \
'if relPath == "." || relPath == "" {
ctx.Role = RoleMayor
return ctx
}
if len(parts) >= 1 && parts[0] == "mayor" {' \
'if relPath == "." || relPath == "" {
return ctx // RoleUnknown - town root is shared space
}
// Check for mayor role: mayor/ or mayor/rig/
if len(parts) >= 1 && parts[0] == "mayor" {'
# Fix copyDir to handle symlinks (broken symlinks cause "no such file" errors)
# See: https://github.com/steveyegge/gastown/issues/TBD
substituteInPlace internal/git/git.go \
--replace-fail \
'if entry.IsDir() {' \
'// Handle symlinks (recreate them, do not follow)
if entry.Type()&os.ModeSymlink != 0 {
linkTarget, err := os.Readlink(srcPath)
if err != nil {
return err
}
if err := os.Symlink(linkTarget, destPath); err != nil {
return err
}
continue
}
if entry.IsDir() {'
'';
meta = with lib; {
description = "Gas Town - multi-agent workspace manager by Steve Yegge";
homepage = "https://github.com/steveyegge/gastown";