Desktop app: /clear mislabels both SessionStart source ("startup") and SessionEnd reason ("other"), making /clear undetectable by hooks

Open 💬 0 comments Opened Jul 11, 2026 by kitepon-rgb

Environment

  • Claude Code Desktop 2.1.205 (macOS, Darwin 25.5.0, arm64, CLAUDE_CODE_ENTRYPOINT=claude-desktop)
  • Contrast: VS Code extension 2.1.195–2.1.207 (claude-vscode) on the same machine

Expected behavior (docs + VS Code behavior)

When the user runs /clear:

  1. The successor session's SessionStart hook receives source: "clear", and
  2. The cleared session fires SessionEnd with reason: "clear".

The VS Code extension does both correctly. Measured 2026-07-12: SessionEnd reason:"clear" at 15:09:38.671Z, successor SessionStart source:"clear" 42 ms later.

Actual behavior on Desktop

| User action (Desktop) | SessionEnd fires | reason | SessionStart source of successor |
|---|---|---|---|
| /clear | yes, immediately | other | startup |
| new chat left open | no | — | — |
| delete session | yes | other | — |

The /clear SessionEnd payload is structurally identical to the session-deletion payload (session_id, prompt_id, hook_event_name, reason, cwd, transcript_path — no distinguishing field). Both label paths are lost: source says startup, reason says other.

Impact

Hook-based session-continuity / memory tools cannot detect /clear on Desktop at all:

  • SessionStart source=="clear" never fires — auto-restore paths that work on the VS Code extension are silently dead on Desktop.
  • SessionEnd reason=="clear" cannot be used either — reacting to reason:"other" would also trigger on session deletion (an explicit discard) and on Desktop's frequent background sessions, causing wrong-session memory injection.

Additional data point: 11 verified source:"clear" events from VS Code (2026-05-13 to 2026-07-05) vs. 0 from Desktop across 190+ Desktop sessions on the same install.

Repro

  1. Register hooks that log the SessionStart payload (source) and the SessionEnd payload (reason).
  2. In the Desktop app: new chat → send a message → /clear → send a message.
  3. Observe SessionEnd reason:"other" and successor SessionStart source:"startup".
  4. Same steps in the VS Code extension yield reason:"clear" / source:"clear".

Note

This is the same class of bug as #49937 (VS Code source:"clear" reliability), which was fixed in 2.1.128 — the Desktop client appears to need the equivalent fix. Either signal (source or reason) being correct would let hook tools work again.

View original on GitHub ↗