Fix mail inbox detecting wrong identity from witness/refinery dirs
When GT_ROLE env var is not set, detectSender() now falls back to cwd-based detection instead of immediately returning "overseer". This allows running mail commands from witness/refinery directories without GT_ROLE set (e.g., debugging sessions) and correctly detecting the identity from the current working directory path. (gt-od1g) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -704,10 +704,12 @@ func findLocalBeadsDir() (string, error) {
|
||||
// detectSender determines the current context's address.
|
||||
// Priority:
|
||||
// 1. GT_ROLE env var → use the role-based identity (agent session)
|
||||
// 2. No GT_ROLE → return "overseer" (human at terminal)
|
||||
// 2. No GT_ROLE → try cwd-based detection (witness/refinery/polecat/crew directories)
|
||||
// 3. No match → return "overseer" (human at terminal)
|
||||
//
|
||||
// All Gas Town agents run in tmux sessions with GT_ROLE set at spawn.
|
||||
// Humans in regular terminals won't have GT_ROLE, so they're the overseer.
|
||||
// However, cwd-based detection is also tried to support running commands
|
||||
// from agent directories without GT_ROLE set (e.g., debugging sessions).
|
||||
func detectSender() string {
|
||||
// Check GT_ROLE first (authoritative for agent sessions)
|
||||
role := os.Getenv("GT_ROLE")
|
||||
@@ -716,8 +718,8 @@ func detectSender() string {
|
||||
return detectSenderFromRole(role)
|
||||
}
|
||||
|
||||
// No GT_ROLE means human at terminal - they're the overseer
|
||||
return "overseer"
|
||||
// No GT_ROLE - try cwd-based detection, defaults to overseer if not in agent directory
|
||||
return detectSenderFromCwd()
|
||||
}
|
||||
|
||||
// detectSenderFromRole builds an address from the GT_ROLE and related env vars.
|
||||
|
||||
Reference in New Issue
Block a user