Fix crew loadState to handle empty/incomplete state.json

When state.json contains empty JSON {}, the ClonePath and other fields
were left empty, causing "can't find pane/session" errors in gt crew at.
Now backfills essential fields (Name, Rig, ClonePath) if missing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 00:02:23 -08:00
parent 378d3cd569
commit d9eecf864c

View File

@@ -291,6 +291,17 @@ func (m *Manager) loadState(name string) (*CrewWorker, error) {
return nil, fmt.Errorf("parsing state: %w", err)
}
// Backfill essential fields if missing (handles empty or incomplete state.json)
if crew.Name == "" {
crew.Name = name
}
if crew.Rig == "" {
crew.Rig = m.rig.Name
}
if crew.ClonePath == "" {
crew.ClonePath = m.crewDir(name)
}
return &crew, nil
}