Repository navigation
feat(harness-ops): route hook telemetry to the reference sink via @harness-ops - #14279
Conversation
…rness-ops
A repository could reach harness-ops' reference sink only through a vendored
copy or a per-machine cache path, because settings env values are not shell
expanded. HOOK_TELEMETRY_SINK now takes the reserved value @harness-ops.
- harness-ops: a SessionStart hook (refresh-sink-launcher.sh) keeps
${CLAUDE_PLUGIN_DATA}/hook-telemetry-sink.sh, a launcher that execs the
installed sink with this install's session_event_log_dir and
hook_events_max_bytes; rewritten only on change, via rename, and it removes
itself when its install is gone.
- lib/hook-utils.sh: hook::emit_telemetry resolves @harness-ops to the first
launcher under the plugin data root (the caller's own data dir, then
harness-ops-* in name order), found beside CLAUDE_PLUGIN_DATA or under
CLAUDE_CONFIG_DIR / ~/.claude; skips when none, and skips any other @ value.
Synced to every carrier.
- context-guard's mod resolves the same value through $.fs.list.
- The sink maps subject from data.subject, else data.file, so {tool, file}
envelopes from guardrails and the formatters keep their subject.
- Contract README and CHANGELOG document the reserved value (envelope stays
1.1); the harness-ops README makes @harness-ops the default and lists every
file the copy route needs.
Closes #14227
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015XWwmcgXUX6XBUUZcBwQfQ
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
.claude/hooks/hook-telemetry-sink.sh mirrors the harness-ops sink except for its hook-utils.sh source repoint, and its drift test failed after the sink gained the data.file subject fallback and the @harness-ops wiring header. This repository's settings still wire the repo copy; switching them to @harness-ops is a separate change. Refs: #14227 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015XWwmcgXUX6XBUUZcBwQfQ
|
claude-security-review reviewed Security review: PR #14279, incremental (a6e083d → 4fdf5aa)No security issues found in the changes since the last review. This lane already reviewed an earlier head, so this pass reported only blocking findings (CRITICAL or IMPORTANT). critical-findings: 0 ScopeI read all 30 files in the incremental list.
The job counts the other 19 synced What was checked
Settled threadsBoth threads (Windows path splitting, and name-order precedence) are marked Notes (not findings)
|
|
claude-review reviewed Code review (incremental, a6e083d → 4fdf5aa): harness-ops sink launcher precedence and Windows pathsBlocking-only review. This lane already reviewed an earlier head, so this pass reports blocking findings only. It found none. Scope. I read every hunk of the 30 files in the incremental list. The 20 synced What changed, and how it holds up:
Earlier findings. Both earlier inline findings are resolved. The owner replied, and both threads are marked
The incremental diff carries the fixes the owner described, and the new tests cover them:
Closing issue #14227. Nothing in this increment changes how the change meets its three criteria (assessed at the previous head). The earlier Windows gap in criterion 2 is now addressed. Not checked. I ran nothing. The test results, the red-before-the-fix runs and the sync and changelog checks are the author's claims and unverified here. Other notes:
|
…west Two review findings on hook::harness_ops_sink_to: - A Windows plugin hook gets CLAUDE_PLUGIN_DATA with backslashes, so the `%/*` split never reached the data root and every @harness-ops event was dropped. Backslashes now fold to `/` first, and every producer also searches the CLAUDE_CONFIG_DIR / $HOME data root when its sibling search finds nothing. - Name order picked a stale but present launcher (harness-ops-inline sorts before harness-ops-<marketplace>), splitting rows across two log roots. The refresher now touches its launcher at each SessionStart (content is still rewritten only on change), and resolution picks the newest launcher with -nt, for every producer including harness-ops' own hooks, so all of them send to one root. context-guard's mod does the same with $.fs.stat mtimeMs. The contract README states the precedence. Refs: #14227 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015XWwmcgXUX6XBUUZcBwQfQ
Closes #14227
Summary
A repository can now send its hook telemetry to harness-ops' reference sink without copying the sink into the repository and without a per-machine path. It sets
"HOOK_TELEMETRY_SINK": "@harness-ops"in itssettings.json. A copy was needed before because settingsenvvalues are copied as written, with no shell expansion (env-vars, "In settings files").The sink now also fills
subjectfromdata.file, so rows from guardrails and the formatters, whose data is{tool, file}, no longer land with an empty subject.Fix
hooks/refresh-sink-launcher.sh, writes${CLAUDE_PLUGIN_DATA}/hook-telemetry-sink.sh. It is async so it adds no startup wait; the hooks reference covers asyncSessionStarthooks (Run hooks in the background). That launcher runs this install'shooks/hook-telemetry-sink.sh. The data directory is~/.claude/plugins/data/<id>/and is "kept across plugin updates" (plugins reference, Environment variables).${CLAUDE_PLUGIN_ROOT}changes on every update.session_event_log_dirandhook_events_max_bytes(or clears them), so a foreign producer's rows land in the same root as harness-ops' own.lib/hook-utils.sh, synced to all 20 carriers).hook::emit_telemetrymaps@harness-opsto the launcher. Any other value starting with@is reserved and skipped.harness-ops-*in name order. The first executable launcher wins.CLAUDE_PLUGIN_DATAfor a plugin hook. For a repository hook it is${CLAUDE_CONFIG_DIR:-$HOME/.claude}/plugins/data; theCLAUDE_CONFIG_DIRrow says "All settings, session history, and plugins are stored under this path" (env-vars).-inlineand-<marketplace>data dirs both exist in practice).$.fs.listand$.fs.exists, since a mod has noCLAUDE_PLUGIN_DATA. Before this change it would have joined@harness-opsonto the project root and tried to run that path.subjectnow comes from.data.subject // .data.file.1.1: this is not an envelope field, and the 1.0 sink-path rule set the same precedent. The harness-ops README makes@harness-opsthe default, and its copy route now listshook-telemetry-sink.sh,hook-utils.shandsession-log-lib.sh.Verification
plugins/harness-ops/hooks/refresh-sink-launcher.test.sh: 21 pass. Covers a silent first write, the launcher reaching the real sink, no rewrite when nothing changed, a rewrite after the root moves, options carried and a caller's options overridden, a stale launcher deleting itself, missing inputs, a symlink at the launcher path, and a directory at the launcher path.plugins/harness-ops/hooks/hook-telemetry-sink.test.sh: 58 pass. The new{tool, file}case failed before the fix.lib/hook-utils.test.sh: 702 pass. It adds 7@harness-opscases: the config dir, the$HOMEfallback, a sibling data dir, own-dir precedence, no launcher, and an unknown@value. The first 5 failed before the change.claude plugin test plugins/context-guard: 328 pass, 0 fail, including 4 new cases. The 3@harness-opscases were run red before the change.shellcheckis clean on every changed shell file.scripts/validate-plugin-contracts.test.sh: 230 pass.scripts/validate-plugins.sh --only "<all 20 carriers>": "All mod tests passed. All plugin manifests and the catalog validated."scripts/sync-shared-copies.sh --checkreports all 767 copies matching.--check-bump origin/mainreports every carrier bumped.check-changelog-fragments.sh --check-required origin/mainreports 20 of 20.HOME, then the real SessionStart writer, then the real guardrailshardcoded-path-check.shwithHOOK_TELEMETRY_SINK=@harness-ops. One row landed in<proj>/.observability/claude/sessions/<sid>.jsonlboth as a repository hook (noCLAUDE_PLUGIN_DATA) and as a plugin hook (siblingCLAUDE_PLUGIN_DATA), withsource: "envelope",hook_event_name: "PreToolUse"andsubject: "src/a.txt"taken fromdata.file.Related
@harness-ops.🤖 Generated with Claude Code
https://claude.ai/code/session_015XWwmcgXUX6XBUUZcBwQfQ