Skip to content

Support future hook event types in progress entry classification#21

Merged
delexw merged 2 commits intomainfrom
claude/fix-repo-issues-oKGOX
Mar 29, 2026
Merged

Support future hook event types in progress entry classification#21
delexw merged 2 commits intomainfrom
claude/fix-repo-issues-oKGOX

Conversation

@delexw
Copy link
Copy Markdown
Owner

@delexw delexw commented Mar 29, 2026

Summary

Updated the progress entry classification logic to support future hook event types beyond the currently used hook_progress, making the code more maintainable and forward-compatible.

Key Changes

  • Modified the hook event detection in classify.rs to check for the presence of hookEvent field rather than hardcoding specific data.type values
  • Updated comments to clarify that the logic rescues all hook events, not just hook_progress
  • Added explanatory comments documenting that future hook types (e.g., TaskCreated in v2.1.84) will be automatically supported without code changes
  • Added Linux schema file for platform-specific configuration

Implementation Details

The change replaces an enumeration-based approach with a presence-based check. Instead of maintaining a list of known hook types like hook_progress, the code now checks if a hookEvent field exists in the entry data. This allows new hook event types introduced in future versions to be properly rescued from the noise filter without requiring code modifications.

https://claude.ai/code/session_01MK63kGRSmtkGSXCDaqh8p3

claude added 2 commits March 29, 2026 00:12
Issue #19 (v2.1.84): PowerShell is an opt-in Windows shell tool that
appears in tool_use blocks. Map it to ToolCategory::Bash so it renders
with the correct shell-execution icon rather than falling into Other.

Issue #19 (v2.1.84) + Issue #20 (v2.1.85-v2.1.86): The hook rescue in
classify() previously required data.type == "hook_progress". This is
correct for all existing hook events (PreToolUse, PostToolUse, etc.)
but would silently discard future hook types that carry a hookEvent field
under a different data.type (e.g. TaskCreated). Guard on hookEvent
presence in addition to data.type so any hook-bearing progress entry is
correctly surfaced as a HookMsg.

Non-hook progress entries (agent_progress, bash_progress, ...) remain
noise: they have no hookEvent field and are still dropped.

Verified against claude --debug output and cli.js bundle (v2.1.86):
- All current hook events use data.type="hook_progress" with hookEvent
- @-mention encoding change: parser never double-unescaped, no change needed
- Read tool compact line-number format: no line-number regex in parser

https://claude.ai/code/session_01MK63kGRSmtkGSXCDaqh8p3
Generated by cargo build when libgtk-3-dev became available in this
environment. Matches the pattern of the other OS schemas already tracked.

https://claude.ai/code/session_01MK63kGRSmtkGSXCDaqh8p3
@delexw delexw merged commit 93036c9 into main Mar 29, 2026
1 check passed
@delexw delexw deleted the claude/fix-repo-issues-oKGOX branch March 29, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants