feat(parser): capture background_tasks and session_crons from v2.1.145+ Stop/SubagentStop hooks#108
Merged
Conversation
…145+ compat Stop and SubagentStop hook input payloads in Claude Code v2.1.145+ include two new fields: background_tasks (array of running task descriptors) and session_crons (array of session-scoped cron jobs). Add both as Option<Value> to Entry so they are captured rather than silently skipped on future hook entries. Fixes #106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
background_tasksandsession_cronsas optional fields on theEntrystruct to handle the new Stop/SubagentStop hook payload fields introduced in Claude Code v2.1.145.Problem
Claude Code v2.1.145 (May 19, 2026) added two new fields to
StopandSubagentStophook input payloads:background_tasks— array of currently-running background task descriptorssession_crons— array of cron jobs registered for the sessionWithout explicit struct fields, serde silently skips these arrays on deserialization. While this does not cause parser crashes (no
deny_unknown_fieldsis in use), the data is lost and future code cannot access it. Declaring the fields explicitly captures the payloads and makes the compat intent clear.Changes
src-tauri/src/parser/entry.rs: Addedbackground_tasks: Option<Value>andsession_crons: Option<Value>toEntry, both with#[serde(default)]so pre-v2.1.145 entries (where the fields are absent) default toNonewithout error. Added 3 tests covering: Stop hook with both fields populated, pre-v2.1.145 Stop hook with neither field present, and SubagentStop hook with an emptybackground_tasksarray and a multi-itemsession_cronsarray.specs/01-parser-pipeline.md: Added the two new fields to the Key Fields table.Testing
All 400 Rust tests pass (
cargo test). All 349 frontend tests pass (vitest run).cargo clippy -- -D warningsreports no issues.Fixes #106