Repository navigation
fix(session-telemetry): register only the event categories the session event log records - #16665
Conversation
…cords
With session_event_log_categories set, the hooks module now hooks only
the classic events in the enabled categories, plus SessionEnd always for
retention; SessionEnd writes its record only when the session category
is enabled. An event outside the list starts no process, and where the
built-in guard holds classic.* events only the chosen events are held.
categoryFilter restates slog_category_enabled; one parse table pins both.
The generator writes each observed event behind wants('<category>').
Refs: #15976
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README, option descriptions, harness-ops setup cost sentence and ADR 0065 amendment now say registration follows session_event_log_categories, SessionEnd stays hooked for retention, where sec-default loads and which administrator actions let the log run there. Adds the session-telemetry changelog fragment and tightens the new code comments. Refs: #15976 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tence Refs: #15976 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heck Refs: #15976 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctly The module header and README cost paragraph no longer say every event records and SessionEnd always runs both scripts; the guard paragraph limits its claim to the per-event skip lines, not the /plugin note. Refs: #15976 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dget The two descriptions this change extended stay within the 300-character option-description budget. Refs: #15976 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Lane run report
Failed GitHub API calls
|
|
claude-security-review reviewed Security review: PR #16665 (head 2bca240)No security issues found. I read the whole diff for all 12 changed files. critical-findings: 0 What I checked
Plugin manifest (
|
|
claude-review reviewed Code review: no findingsI read the whole diff (all 12 listed files), plus the code the changed lines call: Correctness checks
Closing issue #15976 (part A).
Plugin manifest (
Path-scoped rule. Embedded text. None of the PR context asks the lane to approve, skip or drop anything. Spend. None: the change registers fewer hooks and adds no paid resources. Verifier dropped 0 of 0 candidates. |
Post-merge mutation testingKilled 1, survived 6, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
Closes #15976
Summary
With
session_event_log_categoriesset, the session event log's hooks module now registers only theclassic.*events in the enabled categories, plusSessionEndalways, for retention. Before this change it registered all 28 observable events. An event outside the list started node and bash only to be filtered out by the script, and where the built-in guardsec-defaultholdsclassic.*hooks, it was reported as skipped even though the user never asked to record it. This is the owner's 2026-11-13 decision recorded in the issue: the minimum fix plus the category filter (part A). Part B, the setup warning, is #15993.The log moved from harness-ops into
plugins/session-telemetry/in #16519 after this issue was written. The paths below are the new ones; the intent is unchanged. Nothing here loosens or detects the guard: the module only registers fewer hooks.Fix
plugins/session-telemetry/hooks/register.ts: exportscategoryFilter, which parses the option exactly asslog_category_enableddoes: unset or empty means all; commas, spaces, tabs and newlines separate; matches are case-sensitive;\ris not a separator. Each generatedon('classic.<Event>', …)is guarded byif (wants('<category>')), and each event name stays a literal.SessionEndis always hooked; it runssession-event-log.shonly whensessionis enabled, andsession-retention.shalways.scripts/gen-hook-event-registry.sh:mod_tswrites the guarded block from the registry'scategoryfield, andSessionEndunguarded. The block was applied by hand from the--checkdiff, so registryas_ofstamps are unchanged.SessionEndis kept for retention; wheresec-defaultloads (managed settings,managed-mcp.json, or a Team or Enterprise/login); the/pluginnote and the 2.1.304+ per-event lines; no user off switch; the two administrator routes, linked to the mods admin page. No claim that the/pluginnote shrinks.pr-test-platforms.yml,work-resolve-issue.yml,.claude/rules/mod-authoring.md) are unchanged: no done-when item requires editing them.Verification
Counter (the binding gate). Switch on, categories
permission,tool, every$.classickey fired:On main, the new category-budget test fails, and its
toEqualdiff lists all 28 events; the SessionEnd"turn"case also fails (it runs both scripts), andcategory-filter.test.tsfails to load. Result: 14 pass, 3 fail. The run total of 29 is the issue's baseline: on main the test stops at the event list before it reaches the total.On the branch,
claude plugin test plugins/session-telemetry(Claude Code 2.1.326): 27 pass, 0 fail.Wall time, same host (Linux), 5 interleaved rounds per arm, using the issue's script (it times the script path, which this change does not touch):
Other checks:
session-event-log.test.sh: PASS=205, including the shared 11-row parse table againstslog_category_enabled.gen-hook-event-registry.test.sh: PASS=26.gen-hook-event-registry.sh --check: clean.claude plugin validate --jsonon session-telemetry and on harness-ops:success: true.scripts/check-affected.sh: 18 passed, 1 skipped.check-changelog-fragments.sh --checkand--check-required origin/main: pass. The bare command the issue's AC8 names now exits with a usage error, so these two forms were run in its place.sync-plugin-options-docs.py --check: up to date.cant-fail-scan --checkon the new tests: no gating findings.Not run:
/code-metrics:audit,/simplify,/review:quality-gate,/verification:confirm. Waste pass by reading the diff: the only new runtime work is onecategoryFiltercall per SessionEnd; there are no added process starts, loops or git calls. Behavior under the guard rests on the docs read, sinceclaude plugin testcannot loadsec-default.The ADR amendment is dated 2026-11-16; correct it if the merge lands on another day.
Related
🤖 Generated with Claude Code