fix: persist hook event and clear stale session summaries

Merged
LA
2mo ago
+139-11

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:

  1. 79ab6358ff adds behavior coverage.
  2. 12e8374ba2 implements 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 hookEventName to ClaudeHookSessionRecord; existing records decode without migration.
  • Records the event through Claude and generic session updates, with a PermissionRequest fallback for legacy payloads.
  • Adds updateLastSummary so prompt boundaries clear lastSubtitle and lastBody instead 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.