From e48f7fcd6c1cd8dbf7e58967e91bf70b40fac6aa Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Fri, 26 Dec 2025 19:12:55 -0800 Subject: [PATCH] fix: Role detection reads GT_RIG/GT_CREW env vars for crew identity When GT_ROLE is set to a simple value like "crew", the role detection was not reading GT_RIG and GT_CREW to get the full identity. This caused gt mol status to show "/crew/" instead of "gastown/crew/max". Now GetRoleWithContext checks these additional env vars when the rig or polecat fields are empty after parsing the role string. Generated with Claude Code Co-Authored-By: Claude Opus 4.5 --- internal/cmd/role.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/cmd/role.go b/internal/cmd/role.go index a879661a..e25bdab1 100644 --- a/internal/cmd/role.go +++ b/internal/cmd/role.go @@ -155,6 +155,21 @@ func GetRoleWithContext(cwd, townRoot string) (RoleInfo, error) { info.Polecat = polecat info.Source = "env" + // For simple role strings like "crew" or "polecat", also check + // GT_RIG and GT_CREW/GT_POLECAT env vars for the full identity + if info.Rig == "" { + if envRig := os.Getenv("GT_RIG"); envRig != "" { + info.Rig = envRig + } + } + if info.Polecat == "" { + if envCrew := os.Getenv("GT_CREW"); envCrew != "" { + info.Polecat = envCrew + } else if envPolecat := os.Getenv("GT_POLECAT"); envPolecat != "" { + info.Polecat = envPolecat + } + } + // Check for mismatch with cwd detection if cwdCtx.Role != RoleUnknown && cwdCtx.Role != parsedRole { info.Mismatch = true