fix(hook): report real injection count in remote deployments (#42)#46
Merged
Conversation
`hook status` reported `Injection count: 0` even when injection was firing, because of two independent client-side telemetry bugs: Bug A — the remote inject path (taken whenever BOBBIN_SERVER is set) emitted metrics and stored the injection server-side but never advanced hook_state.json. Only the local path incremented the counter, so the client-side count froze at its last local value. Fix: after a successful remote injection, load / increment / save hook_state, mirroring the local path. Bug B — `hook status` used `args.path` verbatim as the bobbin root, so from a sub-directory it read a non-existent hook_state.json and defaulted to 0, while injection recorded to the true root. Fix: resolve the root by walking up to the first ancestor with `.bobbin/config.toml`, the same resolver the inject path uses. Stray `.bobbin/` dirs (config-less) are walked past. Adds a regression test for the resolver's stray-dir behavior. Fixes #42 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VsuPDxSUjMYqHvQyPvSAPW
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
Fixes #42.
hook statusreportedInjection count: 0even when injection was firing regularly — a client-side telemetry bug with two independent root causes, both with turnkey fixes.Bug A — remote inject path never advanced the counter
The hook command sets
BOBBIN_SERVER, so injection always goes throughinject_context_remote(). On success it emitted metrics and stored the injection server-side but never calledsave_hook_state, sohook_state.json(injection_count,last_injection_time) was never advanced. Only the local path incremented it — and that path is never taken in remote deployments, freezing the client counter at its last local value.Fix: after a successful remote injection, load / increment / save
hook_state, mirroring the local path.Bug B —
hook statusresolved a different root than the inject pathrun_statususedargs.pathverbatim as the bobbin root. From a sub-directory it read a non-existenthook_state.jsonand defaulted to0, while injection recorded to the true root — so the reported count depended on CWD.Fix: resolve the root by walking up to the first ancestor with
.bobbin/config.toml(the resolver the inject path already uses). Stray config-less.bobbin/dirs are walked past.Test
test_find_bobbin_root_skips_stray_bobbin_dircovers the Bug B stray-dir scenario.🤖 Generated with Claude Code