Skip to content

Commit 5f0c8f9

Browse files
author
furiosa
committed
fix(sling): default dispatched_by to human when role unknown
When running gt sling from rig root (e.g., ~/gt/gastown), the role detection returns 'unknown' because the directory doesn't match any specific agent pattern. This change provides sensible fallbacks: - ActorString() returns the rig name when role is unknown but rig is known - ActorString() returns 'human' when both role and rig are unknown - detectActor() returns 'human' instead of 'unknown' on GetRole() failure This enables human operators to sling work from the rig root without having to cd into a specific agent directory first. Fixes gt-spt3u
1 parent 9a9974e commit 5f0c8f9

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

internal/cmd/role.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,13 @@ func (info RoleInfo) ActorString() string {
283283
}
284284
return "crew"
285285
default:
286-
return string(info.Role)
286+
// When role is unknown, provide a useful fallback:
287+
// - If we know the rig, use it (e.g., "gastown") - implies human operator at rig root
288+
// - Otherwise use "human" to indicate a human operator
289+
if info.Rig != "" {
290+
return info.Rig
291+
}
292+
return "human"
287293
}
288294
}
289295

internal/cmd/sling_helpers.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,13 @@ func detectCloneRoot() (string, error) {
262262
}
263263

264264
// detectActor returns the current agent's actor string for event logging.
265+
// When running from rig root or without a known agent identity, returns:
266+
// - The rig name (e.g., "gastown") if we can detect it
267+
// - "human" as a fallback for human operators
265268
func detectActor() string {
266269
roleInfo, err := GetRole()
267270
if err != nil {
268-
return "unknown"
271+
return "human"
269272
}
270273
return roleInfo.ActorString()
271274
}

0 commit comments

Comments
 (0)