diff --git a/home/roles/development/default.nix b/home/roles/development/default.nix index bf6107d..ccad3ca 100644 --- a/home/roles/development/default.nix +++ b/home/roles/development/default.nix @@ -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; { diff --git a/home/roles/development/gastown-fix-agent-bead-address-title.patch b/home/roles/development/gastown-fix-agent-bead-address-title.patch index b2d89b7..84975b2 100644 --- a/home/roles/development/gastown-fix-agent-bead-address-title.patch +++ b/home/roles/development/gastown-fix-agent-bead-address-title.patch @@ -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) diff --git a/home/roles/development/gastown-fix-agent-bead-rig-prefix.patch b/home/roles/development/gastown-fix-agent-bead-rig-prefix.patch index f462bd1..b5a4b20 100644 --- a/home/roles/development/gastown-fix-agent-bead-rig-prefix.patch +++ b/home/roles/development/gastown-fix-agent-bead-rig-prefix.patch @@ -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 diff --git a/home/roles/development/gastown-fix-copydir-symlinks.patch b/home/roles/development/gastown-fix-copydir-symlinks.patch index 98cc19f..fd2a9b6 100644 --- a/home/roles/development/gastown-fix-copydir-symlinks.patch +++ b/home/roles/development/gastown-fix-copydir-symlinks.patch @@ -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 } + diff --git a/home/roles/development/gastown-fix-role-home-paths.patch b/home/roles/development/gastown-fix-role-home-paths.patch index eaf049f..20ba5d3 100644 --- a/home/roles/development/gastown-fix-role-home-paths.patch +++ b/home/roles/development/gastown-fix-role-home-paths.patch @@ -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 { diff --git a/home/roles/development/gastown-fix-town-root-detection.patch b/home/roles/development/gastown-fix-town-root-detection.patch index de5170a..8782030 100644 --- a/home/roles/development/gastown-fix-town-root-detection.patch +++ b/home/roles/development/gastown-fix-town-root-detection.patch @@ -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 == "" { diff --git a/home/roles/development/gastown-fix-validate-recipient.patch b/home/roles/development/gastown-fix-validate-recipient.patch index 96e51c1..0d1258f 100644 --- a/home/roles/development/gastown-fix-validate-recipient.patch +++ b/home/roles/development/gastown-fix-validate-recipient.patch @@ -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) { diff --git a/home/roles/development/gastown-statusline-optimization.patch b/home/roles/development/gastown-statusline-optimization.patch index 395c391..b74f7ca 100644 --- a/home/roles/development/gastown-statusline-optimization.patch +++ b/home/roles/development/gastown-statusline-optimization.patch @@ -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 } - +