diff --git a/internal/cmd/crew_at.go b/internal/cmd/crew_at.go index e32f94f3..2a83beca 100644 --- a/internal/cmd/crew_at.go +++ b/internal/cmd/crew_at.go @@ -103,7 +103,10 @@ func runCrewAt(cmd *cobra.Command, args []string) error { } runtimeConfig := config.LoadRuntimeConfig(r.Path) - _ = runtime.EnsureSettingsForRole(worker.ClonePath, "crew", runtimeConfig) + if err := runtime.EnsureSettingsForRole(worker.ClonePath, "crew", runtimeConfig); err != nil { + // Non-fatal but log warning - missing settings can cause agents to start without hooks + style.PrintWarning("could not ensure settings for %s: %v", name, err) + } // Check if session exists t := tmux.NewTmux() diff --git a/internal/session/startup.go b/internal/session/startup.go index 0d67ef3f..e22096e0 100644 --- a/internal/session/startup.go +++ b/internal/session/startup.go @@ -81,5 +81,13 @@ func FormatStartupNudge(cfg StartupNudgeConfig) string { beacon += "\n\nWork is on your hook. Run `gt hook` now and begin immediately." } + // For start/restart, add fallback instructions in case SessionStart hook fails + // to inject context via gt prime. This prevents the "No recent activity" state + // where agents sit idle because they received only metadata, no instructions. + // See: gt-uoc64 (crew workers starting without proper context injection) + if cfg.Topic == "start" || cfg.Topic == "restart" { + beacon += "\n\nRun `gt prime` now for full context, then check your hook and mail." + } + return beacon } diff --git a/internal/session/startup_test.go b/internal/session/startup_test.go index 35b7a9ea..a1e05b7a 100644 --- a/internal/session/startup_test.go +++ b/internal/session/startup_test.go @@ -86,6 +86,35 @@ func TestFormatStartupNudge(t *testing.T) { "ready", }, }, + { + name: "start includes fallback instructions", + cfg: StartupNudgeConfig{ + Recipient: "beads/crew/fang", + Sender: "human", + Topic: "start", + }, + wantSub: []string{ + "[GAS TOWN]", + "beads/crew/fang", + "<- human", + "start", + "gt prime", // fallback instruction for when SessionStart hook fails + }, + }, + { + name: "restart includes fallback instructions", + cfg: StartupNudgeConfig{ + Recipient: "gastown/crew/george", + Sender: "human", + Topic: "restart", + }, + wantSub: []string{ + "[GAS TOWN]", + "gastown/crew/george", + "restart", + "gt prime", // fallback instruction for when SessionStart hook fails + }, + }, } for _, tt := range tests {