Repository navigation
chore: wire the claude-ops reference telemetry sink for this repo's own hooks - #2048
Conversation
…wn hooks Dogfoods the hook-telemetry opt-in contract: copies the reference sink to .claude/hooks/ (repointed at the repo's SSOT lib/hook-utils.sh) and sets HOOK_TELEMETRY_SINK in .claude/settings.json, so the enabled envelope producers (guardrails, the formatters) flow into .claude/observability/hook-events.jsonl for /claude-ops:observability. Also fixes the claude-ops README's "copy the reference sink" wiring form, which omitted the sink's hook-utils.sh source dependency — the documented bare copy fails at startup. claude-ops 0.27.3 -> 0.27.4. Settles #2021 remediation line 5 as document-and-dogfood: the six inert audit hooks are consumer-opt-in by design (README "no-op until a consumer wires a sink"), not dead weight. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Claude finished @kyle-sexton's task in 3m 25s —— View job Security review: PR #2048 (wire claude-ops telemetry sink)
Scope: the 5 files changed in this PR ( 1. IMPORTANT — Committed sink script is non-executable, silently disabling the audit trail it claims to enableFile: The new file is committed with mode On a fresh clone (any POSIX checkout — Linux/macOS respect the git executable bit), Why this matters for security, not just correctness: the six claude-ops audit hooks this PR is meant to wire up ( The PR body's own verification claim ("Smoke-tested the wired sink in the worktree... appends the mapped record") is very likely true only because the author's local worktree copy had the executable bit set (e.g., via Confidence: High — directly confirmed via Fix: No other security issues found
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63deaa3ba1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The sink is invoked as an executable via HOOK_TELEMETRY_SINK; CI's exec-bit hygiene check requires mode 100755 on hook scripts. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Claude finished @kyle-sexton's task in 1m 58s —— View job Security review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
|
Claude finished @kyle-sexton's task in 4m 9s —— View job Code review: PR #2048 (wire claude-ops telemetry sink)
Lane scope: correctness/architecture/error-handling/test-coverage/maintainability. Security is out of scope here — the security-review lane and Codex already flagged (and this PR's second commit, Findings1. Maintainability — the new repo-local sink is a full duplicate with no drift check covering it. Posted inline on 2. Minor — no test coverage for the repo-local copy's one point of difference. The upstream reference sink ships 3. Everything else checked out:
|
|
Claude has reviewed this PR 4 times. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
… reference The repo-local copy is byte-identical to the reference sink except for its hook-utils.sh resolution block; nothing previously watched the pair (the cross-plugin drift tooling clusters plugins/* only, so a .claude/hooks copy is outside its scope). The test diffs the two modulo that block and names the re-copy procedure on failure. It runs directly today and joins CI when the plugin-test runner is extended to .claude/hooks tests (queued follow-up to #2021 line 4's defer-guard PR). Co-Authored-By: Claude Fable 5 <[email protected]>
|
Both threads addressed: the exec bit was fixed in 770f8e3 (the P1 was anchored to the initial commit), and e473251 adds a dedicated drift test binding the repo-local copy to the claude-ops reference sink modulo the source-resolution block — the cross-plugin drift tooling can't cover it because it clusters plugins/* paths only. The test joins CI when the plugin-test runner is extended to .claude/hooks tests (queued follow-up PR for #2021 line 4). |
…sink # Conflicts: # plugins/claude-ops/CHANGELOG.md
|
Claude finished @kyle-sexton's task in 1m 18s —— View job Security review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
|
Claude finished @kyle-sexton's task in 6m 25s —— View job Code review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
…lcheck SC2310 (function invoked in a condition disables set -e) fails the CI shellcheck lane at info severity; the normalize step now writes temp files and the conditions test plain commands. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Claude finished @kyle-sexton's task in 1m 2s —— View job Security review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
|
Claude finished @kyle-sexton's task in 2m 34s —— View job Code review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
The normalize exclusion is a prefix match, so it could not detect a copy whose source line points at a broken target. The test now asserts the exact ../../lib/hook-utils.sh target and proves the wiring end-to-end: a valid envelope through the repo copy must append a record under a temp CLAUDE_PROJECT_DIR. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Claude finished @kyle-sexton's task in 1m 22s —— View job Security review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
|
Accepted and fixed in d2348b5: the drift test now pins the exact expected source line (a prefix-match exclusion alone could pass a copy pointing at a broken target) and smoke-runs the wired copy end-to-end — a valid envelope through the repo copy must append a record under a temp CLAUDE_PROJECT_DIR, proving the source target resolves. |
|
Claude finished @kyle-sexton's task in 3m 22s —— View job Code review: PR #2048 (wire claude-ops telemetry sink) — re-run at
|
…racked copy (#2068) No linked issue ## Summary Executes #2021 remediation line 4 (de-dup the double-fired MCP linkage gate) per the read-only investigation's verdict: the plugin copy yields to a consumer repo's own tracked equivalent, and the repo-local hook tests join CI so the two copies can never drift silently again. ## Fix - `plugins/source-control/hooks/pr-linkage-mcp-gate.sh`: after the gate-file and scope checks, the hook defers (`emit_tel "deferred"`, exit 0) when `<repo>/.claude/settings.json` wires any PreToolUse command naming `pr-linkage-mcp-gate`. The plugin side is the sound place to yield — the settings file states the wiring authoritatively; the repo-local script has no reliable "plugin active" signal (plugin source present ≠ plugin enabled). Named, accepted cost documented in the script and changelog: a same-named no-op script suppresses the gate; it is a policy gate, and the required `pr-issue-linkage` CI check remains the authority. - `scripts/run-plugin-tests.sh` now also runs `.claude/hooks/*.test.sh` — `.claude/hooks/pr-linkage-mcp-gate.test.sh` never ran in CI, which is how the two copies drifted apart silently. (This also activates the telemetry-sink drift test added on #2048.) - Tests: two new defer cases in the plugin suite (consumer's tracked gate defers; unrelated settings wiring does not) — plugin suite 22/0, repo-local suite 17/0. - source-control 0.49.1 → 0.49.2 with changelog. ## Verification Both suites green locally (22/0, 17/0); shellcheck clean at info severity; catalog/cheat-sheet regeneration: no diff. The cheaper alternative (deleting the repo-local settings entry) was rejected because docs/CLOUD-SESSIONS.md and docs/MIGRATION-PLAYBOOK.md currently contradict each other on whether cloud sessions load the plugin at all — tracked as #2053; this defer-guard is sound in both worlds. ## Related Refs #2021 (line 4), #2053 (the doc contradiction gating the cheaper fix), #2048 (the drift-test this runner extension activates). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <[email protected]>
No linked issue
Summary
Dogfoods the hook-telemetry opt-in contract in this repo and settles #2021 remediation line 5: the six inert claude-ops audit hooks are consumer-opt-in by design, not dead weight — the correct remediation is wiring the sink here, not retiring the hooks.
Fix
.claude/hooks/hook-telemetry-sink.sh, repointed at the repo's SSOTlib/hook-utils.sh(the sink sourceshook-utils.shfrom its own directory, so the README's bare-copy form fails at startup).HOOK_TELEMETRY_SINK: .claude/hooks/hook-telemetry-sink.shin.claude/settings.jsonenv— relative values resolve against the consuming repo root per the plugin README;envmap semantics verified against https://code.claude.com/docs/en/settings (fetched this session).hook-utils.shdependency; claude-ops 0.27.3 → 0.27.4 with changelog.Verification
Smoke-tested the wired sink in the worktree: a valid envelope (
hook,hook_event,duration_ms,status) appends the mapped record to.claude/observability/hook-events.jsonl; an invalid envelope exits 0 silently (fire-and-forget contract). Catalog/cheat-sheet regeneration: no diff.Related
Refs #2021 (line 5 disposition: document-and-dogfood). Note: claude-ops itself stays out of this repo's
enabledPlugins(lean-set curation per docs/CLOUD-SESSIONS.md) — the sink pays for itself via the already-enabled guardrails + formatter envelope producers.🤖 Generated with Claude Code