Fix witness session parsing in categorizeSession
Witness sessions use format gt-witness-<rig> but categorizeSession was parsing them as gt-<rig>-<type>, incorrectly setting Rig="witness". This caused the mayor status line to count "witness" as a third rig. Added special case to handle gt-witness-<rig> format before the generic rig-level parsing. Also updated tests to cover both actual and legacy formats. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,13 @@ func categorizeSession(name string) *AgentSession {
|
||||
return session
|
||||
}
|
||||
|
||||
// Witness sessions use different format: gt-witness-<rig>
|
||||
if strings.HasPrefix(suffix, "witness-") {
|
||||
session.Type = AgentWitness
|
||||
session.Rig = strings.TrimPrefix(suffix, "witness-")
|
||||
return session
|
||||
}
|
||||
|
||||
// Rig-level agents: gt-<rig>-<type> or gt-<rig>-crew-<name>
|
||||
parts := strings.SplitN(suffix, "-", 2)
|
||||
if len(parts) < 2 {
|
||||
|
||||
@@ -16,7 +16,10 @@ func TestCategorizeSessionRig(t *testing.T) {
|
||||
{"gt-gastown-crew-max", "gastown"},
|
||||
{"gt-myrig-crew-user", "myrig"},
|
||||
|
||||
// Witness sessions
|
||||
// Witness sessions (actual format: gt-witness-<rig>)
|
||||
{"gt-witness-gastown", "gastown"},
|
||||
{"gt-witness-myrig", "myrig"},
|
||||
// Legacy format still works as fallback
|
||||
{"gt-gastown-witness", "gastown"},
|
||||
{"gt-myrig-witness", "myrig"},
|
||||
|
||||
@@ -58,7 +61,8 @@ func TestCategorizeSessionType(t *testing.T) {
|
||||
{"gt-a-b", AgentPolecat},
|
||||
|
||||
// Non-polecat sessions
|
||||
{"gt-gastown-witness", AgentWitness},
|
||||
{"gt-witness-gastown", AgentWitness}, // actual format
|
||||
{"gt-gastown-witness", AgentWitness}, // legacy fallback
|
||||
{"gt-gastown-refinery", AgentRefinery},
|
||||
{"gt-gastown-crew-max", AgentCrew},
|
||||
{"gt-myrig-crew-user", AgentCrew},
|
||||
|
||||
Reference in New Issue
Block a user