fix: Tighten overseer validation, document fallback behavior
This commit is contained in:
@@ -719,6 +719,10 @@ func detectSender() string {
|
||||
// detectSenderFromRole builds an address from the GT_ROLE and related env vars.
|
||||
// GT_ROLE can be either a simple role name ("crew", "polecat") or a full address
|
||||
// ("gastown/crew/joe") depending on how the session was started.
|
||||
//
|
||||
// If GT_ROLE is a simple name but required env vars (GT_RIG, GT_POLECAT, etc.)
|
||||
// are missing, falls back to cwd-based detection. This could return "overseer"
|
||||
// if cwd doesn't match any known agent path - a misconfigured agent session.
|
||||
func detectSenderFromRole(role string) string {
|
||||
rig := os.Getenv("GT_RIG")
|
||||
|
||||
|
||||
@@ -74,9 +74,14 @@ func SaveOverseerConfig(path string, config *OverseerConfig) error {
|
||||
|
||||
// validateOverseerConfig validates an OverseerConfig.
|
||||
func validateOverseerConfig(c *OverseerConfig) error {
|
||||
// Type must be "overseer" (allow empty for backwards compat on load, set on save)
|
||||
if c.Type != "overseer" && c.Type != "" {
|
||||
return fmt.Errorf("%w: expected type 'overseer', got '%s'", ErrInvalidType, c.Type)
|
||||
}
|
||||
// Ensure type is set for saving
|
||||
if c.Type == "" {
|
||||
c.Type = "overseer"
|
||||
}
|
||||
if c.Version > CurrentOverseerVersion {
|
||||
return fmt.Errorf("%w: got %d, max supported %d", ErrInvalidVersion, c.Version, CurrentOverseerVersion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user