fix(statusline): ensure crew sessions have correct hook display
Root cause: tmux statusline showed wrong hook for all java crewmembers because GT_CREW env var wasn't set in tmux session environment. Changes: - statusline.go: Add early return in getHookedWork() when identity is empty to prevent returning ALL hooked beads regardless of assignee - crew_at.go: Call SetEnvironment in the restart path so sessions created before GT_CREW was being set get it on restart Fixes gt-zxnr. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -250,8 +250,22 @@ func runCrewAt(cmd *cobra.Command, args []string) error {
|
||||
Topic: "restart",
|
||||
})
|
||||
|
||||
// Ensure tmux session environment is set (for gt status-line to read).
|
||||
// Sessions created before this was added may be missing GT_CREW, etc.
|
||||
envVars := config.AgentEnv(config.AgentEnvConfig{
|
||||
Role: "crew",
|
||||
Rig: r.Name,
|
||||
AgentName: name,
|
||||
TownRoot: townRoot,
|
||||
RuntimeConfigDir: claudeConfigDir,
|
||||
BeadsNoDaemon: true,
|
||||
})
|
||||
for k, v := range envVars {
|
||||
_ = t.SetEnvironment(sessionID, k, v)
|
||||
}
|
||||
|
||||
// Use respawn-pane to replace shell with runtime directly
|
||||
// Export GT_ROLE and BD_ACTOR since tmux SetEnvironment only affects new panes
|
||||
// Export GT_ROLE and BD_ACTOR in the command since pane inherits from shell, not session env
|
||||
startupCmd, err := config.BuildCrewStartupCommandWithAgentOverride(r.Name, name, r.Path, beacon, crewAgentOverride)
|
||||
if err != nil {
|
||||
return fmt.Errorf("building startup command: %w", err)
|
||||
|
||||
@@ -713,6 +713,12 @@ func getMailPreviewWithRoot(identity string, maxLen int, townRoot string) (int,
|
||||
// beadsDir should be the directory containing .beads (for rig-level) or
|
||||
// empty to use the town root (for town-level roles).
|
||||
func getHookedWork(identity string, maxLen int, beadsDir string) string {
|
||||
// Guard: identity must be non-empty to filter by assignee.
|
||||
// Without identity, the query would return ALL hooked beads regardless of assignee.
|
||||
if identity == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
// If no beadsDir specified, use town root
|
||||
if beadsDir == "" {
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user