fix: persist hook event and clear stale session summaries
Fixes https://github.com/manaflow-ai/cmux/issues/10834
Adds backward-compatible hookEventName persistence to ClaudeHookSessionRecord and threads the hook discriminator through Claude and generic hook updates. Adds explicit updateLastSummary semantics so prompt boundaries can clear stale lastSubtitle/lastBody values.
Regression commits:
79ab6358ffadds behavior coverage.12e8374ba2implements the fix.
Checks: swiftc -frontend -parse CLI/cmux.swift; git diff --check. Local xcodebuild was not run because the repository guard requires 500 GiB free and this account-home filesystem has 331.7 GiB; no bypass used.
Summary by cubic
Fixes #10834 by persisting the hook event that most recently established each Claude session's state and clearing stale summaries at prompt boundaries so a new prompt no longer inherits the previous turn's subtitle/body.
- Adds optional
hookEventNametoClaudeHookSessionRecord; existing records decode without migration. - Records the event through Claude and generic session updates, with a
PermissionRequestfallback for legacy payloads. - Adds
updateLastSummaryso prompt boundaries clearlastSubtitleandlastBodyinstead of leaving stale values. - Adds Swift Testing coverage for hook event persistence, summary clearing, and legacy record decoding.
Summary by CodeRabbit
-
New Features
- Session activity now records the latest hook event, improving visibility into agent lifecycle updates.
- Session summaries can be explicitly cleared when newer activity supersedes previous details.
- Hook events from supported agent integrations are consistently identified and displayed.
-
Bug Fixes
- Existing saved sessions remain readable after the persistence format update.
- Updated session activity now correctly replaces outdated event and summary information.