fix(gastown): repair malformed patch files for nixos-rebuild
Some checks failed
CI / check (push) Failing after 17m48s

- Remove 'index 0000000..1111111' lines that made patches appear as new files
- Fix hunk line counts in several patches
- Add missing leading spaces to blank context lines
- Temporarily disable statusline optimization patch (needs regenerating)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 13:20:12 -08:00
parent 56097aefa4
commit 123e7d3b3a
8 changed files with 28 additions and 33 deletions

View File

@@ -55,9 +55,9 @@ let
./gastown-fix-town-root-detection.patch
# Fix copyDir to handle symlinks (broken symlinks cause "no such file" errors)
./gastown-fix-copydir-symlinks.patch
# Statusline optimization: skip detached sessions and cache results
# TODO: Statusline optimization patch needs regenerating against current gastown source
# Reduces Dolt CPU from ~70% to ~20% by avoiding beads queries for sessions nobody is watching
./gastown-statusline-optimization.patch
# ./gastown-statusline-optimization.patch
];
meta = with lib; {

View File

@@ -1,10 +1,9 @@
diff --git a/internal/mail/router.go b/internal/mail/router.go
index 0000000..1111111 100644
--- a/internal/mail/router.go
+++ b/internal/mail/router.go
@@ -326,7 +326,11 @@ func agentBeadToAddress(bead *agentBead) string {
@@ -326,7 +326,10 @@ func agentBeadToAddress(bead *agentBead) string {
}
// Fall back to parsing description for role_type and rig
- return parseAgentAddressFromDescription(bead.Description)
+ if bead.Title != "" && strings.Contains(bead.Title, "/") {
@@ -12,5 +11,5 @@ index 0000000..1111111 100644
+ }
+ return parseAgentAddressFromDescription(bead.Description)
}
// Handle gt- prefixed IDs (legacy format)

View File

@@ -1,10 +1,9 @@
diff --git a/internal/mail/router.go b/internal/mail/router.go
index 0000000..1111111 100644
--- a/internal/mail/router.go
+++ b/internal/mail/router.go
@@ -330,8 +330,28 @@ func agentBeadToAddress(bead *agentBead) string {
@@ -330,8 +330,29 @@ func agentBeadToAddress(bead *agentBead) string {
}
// Handle gt- prefixed IDs (legacy format)
- if !strings.HasPrefix(id, "gt-") {
- return "" // Not a valid agent bead ID
@@ -32,5 +31,5 @@ index 0000000..1111111 100644
+ if !strings.HasPrefix(id, "gt-") {
+ return "" // Not a valid agent bead ID
}
// Strip prefix

View File

@@ -1,11 +1,10 @@
diff --git a/internal/git/git.go b/internal/git/git.go
index 0000000..1111111 100644
--- a/internal/git/git.go
+++ b/internal/git/git.go
@@ -73,7 +73,18 @@ func copyDir(src, dest string) error {
@@ -73,7 +73,19 @@ func copyDir(src, dest string) error {
srcPath := filepath.Join(src, entry.Name())
destPath := filepath.Join(dest, entry.Name())
- if entry.IsDir() {
+ // Handle symlinks (recreate them, do not follow)
+ if entry.Type()&os.ModeSymlink != 0 {
@@ -23,3 +22,4 @@ index 0000000..1111111 100644
if err := copyDir(srcPath, destPath); err != nil {
return err
}

View File

@@ -1,5 +1,4 @@
diff --git a/internal/cmd/role.go b/internal/cmd/role.go
index 0000000..1111111 100644
--- a/internal/cmd/role.go
+++ b/internal/cmd/role.go
@@ -326,11 +326,11 @@ func getRoleHome(role Role, rig, polecat, townRoot string) string {

View File

@@ -1,9 +1,8 @@
diff --git a/internal/cmd/prime.go b/internal/cmd/prime.go
index 0000000..1111111 100644
--- a/internal/cmd/prime.go
+++ b/internal/cmd/prime.go
@@ -276,12 +276,12 @@ func detectRole(cwd, townRoot string) RoleInfo {
@@ -276,11 +276,12 @@ func detectRole(cwd, townRoot string) RoleInfo {
// Check for mayor role
// At town root, or in mayor/ or mayor/rig/
if relPath == "." || relPath == "" {

View File

@@ -4,7 +4,7 @@ index b864c069..4b6a045b 100644
+++ b/internal/mail/router.go
@@ -646,7 +646,7 @@ func (r *Router) validateRecipient(identity string) error {
}
for _, agent := range agents {
- if agentBeadToAddress(agent) == identity {
+ if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {

View File

@@ -1,5 +1,4 @@
diff --git a/internal/cmd/statusline.go b/internal/cmd/statusline.go
index 0000000..1111111 100644
--- a/internal/cmd/statusline.go
+++ b/internal/cmd/statusline.go
@@ -6,6 +6,7 @@ import (
@@ -8,13 +7,13 @@ index 0000000..1111111 100644
"sort"
"strings"
+ "time"
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/beads"
@@ -15,6 +16,43 @@ import (
"github.com/steveyegge/gastown/internal/workspace"
)
+// statusLineCacheTTL is how long cached status output remains valid.
+const statusLineCacheTTL = 10 * time.Second
+
@@ -52,7 +51,7 @@ index 0000000..1111111 100644
@@ -32,6 +70,20 @@ func init() {
func runStatusLine(cmd *cobra.Command, args []string) error {
t := tmux.NewTmux()
+ // Optimization: skip expensive beads queries for detached sessions
+ if statusLineSession != "" {
+ if !t.IsSessionAttached(statusLineSession) {
@@ -68,9 +67,9 @@ index 0000000..1111111 100644
+
// Get session environment
var rigName, polecat, crew, issue, role string
@@ -149,7 +201,12 @@ func runWorkerStatusLine(t *tmux.Tmux, session, rigName, polecat, crew, issue st
// Output
if len(parts) > 0 {
- fmt.Print(strings.Join(parts, " | ") + " |")
@@ -80,12 +79,12 @@ index 0000000..1111111 100644
+ }
+ fmt.Print(output)
}
return nil
@@ -389,7 +446,12 @@ func runMayorStatusLine(t *tmux.Tmux) error {
}
}
- fmt.Print(strings.Join(parts, " | ") + " |")
+ output := strings.Join(parts, " | ") + " |"
+ if statusLineSession != "" {
@@ -94,11 +93,11 @@ index 0000000..1111111 100644
+ fmt.Print(output)
return nil
}
@@ -458,7 +520,12 @@ func runDeaconStatusLine(t *tmux.Tmux) error {
}
}
- fmt.Print(strings.Join(parts, " | ") + " |")
+ output := strings.Join(parts, " | ") + " |"
+ if statusLineSession != "" {
@@ -107,11 +106,11 @@ index 0000000..1111111 100644
+ fmt.Print(output)
return nil
}
@@ -526,7 +593,12 @@ func runWitnessStatusLine(t *tmux.Tmux, rigName string) error {
}
}
- fmt.Print(strings.Join(parts, " | ") + " |")
+ output := strings.Join(parts, " | ") + " |"
+ if statusLineSession != "" {
@@ -120,11 +119,11 @@ index 0000000..1111111 100644
+ fmt.Print(output)
return nil
}
@@ -617,7 +689,12 @@ func runRefineryStatusLine(t *tmux.Tmux, rigName string) error {
}
}
- fmt.Print(strings.Join(parts, " | ") + " |")
+ output := strings.Join(parts, " | ") + " |"
+ if statusLineSession != "" {
@@ -133,4 +132,4 @@ index 0000000..1111111 100644
+ fmt.Print(output)
return nil
}