feat(crash): improve crash logging and mass death detection

Add comprehensive crash logging improvements to help diagnose mass session death events:

- Add TypeSessionDeath and TypeMassDeath event types for feed visibility
- Log pre-death events before killing sessions (who killed, why)
- Add mass death detection in daemon (3+ deaths in 30s triggers alert)
- Add macOS crash report check in gt doctor
- Support session death events in townlog and feed curator

Closes hq-kt1o6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nux
2026-01-09 13:19:38 -08:00
committed by beads/crew/giles
parent 97b70517cc
commit 692d6819f2
8 changed files with 346 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import (
"time"
"github.com/steveyegge/gastown/internal/boot"
"github.com/steveyegge/gastown/internal/events"
"github.com/steveyegge/gastown/internal/tmux"
)
@@ -44,6 +45,14 @@ func StopTownSession(t *tmux.Tmux, ts TownSession, force bool) (bool, error) {
time.Sleep(100 * time.Millisecond)
}
// Log pre-death event for crash investigation (before killing)
reason := "user shutdown"
if force {
reason = "forced shutdown"
}
_ = events.LogFeed(events.TypeSessionDeath, ts.SessionID,
events.SessionDeathPayload(ts.SessionID, ts.Name, reason, "gt down"))
// Kill the session
if err := t.KillSession(ts.SessionID); err != nil {
return false, fmt.Errorf("killing %s session: %w", ts.Name, err)