Skip to content

[RELEASE] Never delete another tool's Claude Code hook (carries #5209) - #5216

Open
vivekchand wants to merge 87 commits into
mainfrom
release/hook-collision
Open

[RELEASE] Never delete another tool's Claude Code hook (carries #5209)#5216
vivekchand wants to merge 87 commits into
mainfrom
release/hook-collision

Conversation

@vivekchand

Copy link
Copy Markdown
Owner

Publishes the WO-8 hook-collision fix merged in #5209 (2a0620abb).

What ships: hook removal moves from entry granularity to hook granularity, so a co-installed writer (GitLens's gk ai hook install claude-code --force, numbat, a hand-written entry) keeps its hook when it shares a row with ours. Installed hook timeouts are capped at 8h (CLAWMETRY_HOOK_TIMEOUT_MAX_S) instead of seven days, which on fail-closed Copilot was a week-long stall of the user's own agent.

Verified before merge: 18 new tests (6 confirmed failing against the pre-fix modules), the collision harness going 6/8 → 8/8, and a real-machine run over a copy of this machine's live settings.json where numbat's 11 hooks survived the full cycle. 32/33 checks green on #5209 including drift-bot, Syntax & Lint, OSS golden path and the required E2E Gate.

CHANGELOG entry under [Unreleased].

No-PRD: CHANGELOG-only release PR; the product record is WO-8, https://claude.ai/code/artifact/cfad06ca-5e1d-499b-8c1a-c67bc2c303ef

🤖 Generated with Claude Code

https://claude.ai/code/session_01ULNvmk1PP5a9Y83TV85GJ8

@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

1 similar comment
@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

@vivekchand
vivekchand force-pushed the release/hook-collision branch from 4a108d2 to 2244aaa Compare August 26, 2026 00:19
@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py

The blueprint documents numbat hook management and uninstall behavior but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). The code implements this rule consistently across all paths through clawmetry/hook_ownership.py, while the blueprint omits it.

2. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py:125

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This is a critical safety feature implemented in clawmetry/hook_ownership.py that prevents a stuck ClawMetry gate from blocking user agents indefinitely.

Copy link
Copy Markdown
Owner Author

blocked on author decision — skipping (auto-mergeability sweep)

Drift Bot found 2 drift finding(s) on the current head commit (2244aaa). The branch is now rebased onto main (conflict resolved), but the Drift Bot failure on the CHANGELOG-only content requires author review before this can be merged.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Maintainer bot status (2026-08-26): CI is largely green on the latest run (32914613824) -- Syntax & Lint, OSS golden path, E2E Browser Tests, MOAT Verifier, API Tests (mac/win), C4/C6 gates all pass. The blocking failure is E2E Gate (required) from a separate early-firing workflow (32914613990) that completed in 8 s before the E2E suite had results -- this is a gate-ordering race, not a code failure. Several jobs (API Tests ubuntu, Entitlement API, Live OpenClaw E2E, MOAT Keystone, Eval Suite Gate, Compression Safety) are still queued. Once those complete the E2E Gate should be re-evaluated.

This is a [RELEASE] PR that triggers a PyPI publish on merge -- leaving for human sign-off. No code changes needed; a re-push or CI re-run once all queued jobs finish should clear the gate.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

E2E Gate (required) is failing on this PR, but the same check is also red on main (runs 32919684979 and 32915967965 — both pushed to main after the last merge). This failure is not caused by the changes in this PR; it's a pre-existing base-branch issue.

No fix PR exists yet to port. Triggered one rerun of the failed E2E Gate job to confirm the failure pattern. This PR is otherwise clean (30/31 checks pass, no merge conflict, mergeable_state: blocked solely due to this gate).

Janitor sweep — auto-comment from the every-3h PR-mergeability routine.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Same timing race as #5220 — E2E Gate timed out at 1800s but the Entitlement API tests were already passing on this commit. Triggered a re-run of the failed gate job.


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py

The blueprint documents numbat hook management and uninstall behavior but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). The code implements this rule consistently across all paths through clawmetry/hook_ownership.py, while the blueprint omits it.

2. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py:123

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This is a critical safety feature implemented in clawmetry/hook_ownership.py that prevents a stuck ClawMetry gate from blocking user agents indefinitely.

Copy link
Copy Markdown
Owner Author

PR sweep status — drift-bot blocking the E2E Gate

Investigated this PR as part of a scheduled unblock sweep. The only failing required check is E2E Gate (required), which exits immediately because drift-bot has already failed on this commit (3984779ae674):

[0s] Drift Bot: failed: 1 of 1 matching check(s) failed
    'drift-bot': failure
FAIL: required checks did not pass:
  - Drift Bot: 1 of 1 matching check(s) failed

All other 30 required checks pass (Syntax & Lint, API Tests, MOAT Verifier, E2E Browser Tests, pip matrix, etc.).

Root cause: drift-bot has found a contradiction between the code on this branch and a blueprint at factory.8090.ai. This is not a CI flake — drift-bot is passing on #5220 (same base commit), so it is specific to this branch's changes.

What's needed to unblock: Update the relevant blueprint on factory.8090.ai to match the hook-collision implementation, then re-sync (or push an empty commit to retrigger drift-bot). Once drift-bot passes, E2E Gate will go green and this [RELEASE] PR becomes mergeable.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

🤖 Auto-triage (scheduled PR health check): E2E Gate failed due to Drift Bot reporting a semantic conflict between this PR's code changes and an existing Blueprint/product record.

The gate log shows:

[0s] Drift Bot: failed: 1 of 1 matching check(s) failed
FAIL: required checks did not pass:
  - Drift Bot: 1 of 1 matching check(s) failed
      'drift-bot': failure

This requires human/product judgment — the automated routine cannot determine which side (code or Blueprint) needs to change. Please review the Drift Bot output on this PR to identify which Blueprint entry is in conflict and resolve it accordingly.


Generated by Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULNvmk1PP5a9Y83TV85GJ8
@vivekchand
vivekchand force-pushed the release/hook-collision branch from 3984779 to 810ecdf Compare August 26, 2026 09:17

Copy link
Copy Markdown
Owner Author

Auto-rebase pushed; CI now running. If still not green in 10min, may need manual attention.


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py

The blueprint documents numbat hook management and uninstall behavior but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). The code implements this rule consistently across all paths through clawmetry/hook_ownership.py, while the blueprint omits it.

2. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py:122

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This is a critical safety feature implemented in clawmetry/hook_ownership.py that prevents a stuck ClawMetry gate from blocking user agents indefinitely.

@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

Takes main's CHANGELOG and inserts the hook-collision release section
(carries #5209) between the git-outcomes section and the agent-is-watched
section, exactly where the PR's original change was targeted.
@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: CHANGELOG.md

The blueprint documents numbat hook management and uninstall behavior but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). This critical architectural rule is implemented in clawmetry/hook_ownership.py and now being released in this PR, but the blueprint omits it.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This critical safety feature prevents a stuck ClawMetry hook from blocking user agents indefinitely and is now being released in this PR.

Copy link
Copy Markdown
Owner Author

Mergeability janitor sweep (2026-08-26): E2E Gate is failing because the Drift Bot check returned failure on head commit c0094867a957. The E2E Gate script found drift-bot: failure as the only blocking check — all other required checks (OSS golden path, MOAT Keystone, API Tests, Syntax & Lint, etc.) are green on the newer CI run. This is a content/spec alignment issue, not a transient infra flake, so a simple rerun won't clear it. Needs manual attention to resolve the drift-bot finding before this can merge.


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py:1

The blueprint documents numbat hook management and uninstall behavior but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). This critical architectural rule is implemented in clawmetry/hook_ownership.py and now being released in this PR, but the blueprint omits it.

2. Blueprint: Installer Scripts

File: clawmetry/hook_ownership.py:122

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This critical safety feature prevents a stuck ClawMetry hook from blocking user agents indefinitely and is now being released in this PR.

Copy link
Copy Markdown
Owner Author

Blocker: E2E Gate fails because drift-bot check fails — Drift Bot detected a blueprint contradiction or missing product-record citation on this [RELEASE] PR; needs author review to resolve before this can merge.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Maintenance sweep status — 2026-08-26

This [RELEASE] PR is still blocked by the E2E Gate. Root cause is Drift Bot (8090-software-factory[bot]) failing because the changes to clawmetry/hook_ownership.py — hook-granularity removal and the 8h timeout cap via CLAWMETRY_HOOK_TIMEOUT_MAX_S — are not yet documented in the blueprint at factory.8090.ai.

What's needed to unblock (human action required):

  1. Go to factory.8090.ai and update the relevant blueprint to document the hook-granularity removal pattern and the CLAWMETRY_HOOK_TIMEOUT_MAX_S timeout-cap mechanism from hook_ownership.py
  2. Re-trigger drift-bot (re-sync the blueprint, or push an empty commit to retrigger CI)
  3. Once drift-bot passes, E2E Gate will go green and this PR becomes squash-mergeable

No code changes are needed here — the implementation is correct. This is purely a blueprint-documentation gap.


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: CHANGELOG.md:62

The blueprint documents numbat hook management but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). This critical architectural rule is now being released and is implemented in clawmetry/hook_ownership.py, but the blueprint omits it.

2. Blueprint: Installer Scripts

File: CHANGELOG.md:65

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This critical safety feature is now being released and prevents a stuck ClawMetry hook from blocking user agents indefinitely, but the blueprint omits it.

Comment thread CHANGELOG.md

### Release: ClawMetry will never delete another tool's hook from your Claude Code settings (carries #5209) (2026-08-25)
- **Who this reaches:** anyone who runs ClawMetry alongside another tool that also hooks Claude Code. GitLens now installs its own hooks with a force flag on a very large number of machines, and it is not the only one: numbat does it too, and so might something you set up by hand.
- **These tools all write the same file, and we were not careful enough with it.** `~/.claude/settings.json` holds a list of hooks, and ClawMetry writes to it from three places. Another tool can add itself in one of two ways: as its own separate row, or by adding its command to a row that already exists. We only ever handled the first. Co-installation looked fine because every tool we had seen used it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Installer Scripts

The blueprint documents numbat hook management but does not document the core hook ownership invariant: hooks are removed at hook granularity (not entry granularity) to preserve co-installed foreign hooks (GitLens, numbat, user entries). This critical architectural rule is now being released and is implemented in clawmetry/hook_ownership.py, but the blueprint omits it.

Comment thread CHANGELOG.md
- **These tools all write the same file, and we were not careful enough with it.** `~/.claude/settings.json` holds a list of hooks, and ClawMetry writes to it from three places. Another tool can add itself in one of two ways: as its own separate row, or by adding its command to a row that already exists. We only ever handled the first. Co-installation looked fine because every tool we had seen used it.
- **When a tool added itself to one of our rows, we deleted it.** Removing ClawMetry's hooks removed the whole row, so the other tool's hook went with it. Worse, the same thing happened without anyone uninstalling anything: the part of ClawMetry that keeps its hook up to date rewrites that file roughly every two seconds, and it deleted the neighbour within seconds of it appearing, silently. It was doing this to one of our own hooks as well.
- **The rule now is simple: never delete a hook you did not write.** Removal works on individual hooks rather than whole rows. Ours come out, everything else stays exactly where it was, and a row is only removed once nothing is left in it.
- **A stuck gate can no longer hold up your agent for a week.** The waiting time we installed was worked out from the longest approval window and came to seven days. If our side ever wedged, your agent waited. On GitHub Copilot, which refuses the tool call when a hook does not answer, that is your own agent brought to a halt. The wait is now capped at eight hours, adjustable with `CLAWMETRY_HOOK_TIMEOUT_MAX_S`, and set to 0 if you really do want the old behaviour. Past the cap the runtime stops the call itself rather than the approval policy deciding, which is written down rather than left to be discovered.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Installer Scripts

The blueprint does not document the installed hook timeout ceiling (default 8 hours, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that bounds how long a runtime waits on a wedged gate. This critical safety feature is now being released and prevents a stuck ClawMetry hook from blocking user agents indefinitely, but the blueprint omits it.

Copy link
Copy Markdown
Owner Author

Test plan & review notes

Repo: vivekchand/clawmetry

What changed

  • clawmetry/hook_ownership.py — hook removal now operates at hook granularity, not entry granularity, so co-installed hooks from GitLens, numbat, and user configs are never accidentally deleted. Added CLAWMETRY_HOOK_TIMEOUT_MAX_S ceiling (default 8h) to prevent a wedged ClawMetry gate from blocking agents indefinitely.

Current status (14 days open)
Last known state: E2E Gate failing on drift-bot. Drift Bot found 2 findings on the Installer Scripts blueprint: the hook-granularity invariant and the timeout ceiling aren't documented there.

This is a [RELEASE] PR — once Drift Bot is resolved, it triggers a PyPI publish on merge.

Smoke commands

# Install a hook alongside another tool's hook, then uninstall:
clawmetry hook install claude-code
# Manually add a dummy foreign hook to ~/.claude/settings.json
clawmetry hook uninstall claude-code
# Verify the foreign hook survived

make test  # includes hook_ownership tests

What to verify

  • ~/.claude/settings.json after uninstall: only the ClawMetry-owned hook is gone; any co-installed entry (GitLens gk ai hook install ..., numbat, etc.) is intact.
  • CLAWMETRY_HOOK_TIMEOUT_MAX_S=30 env set before install: hook manifest should reflect a 30s ceiling.

To unblock
Update the Installer Scripts blueprint to document (a) hook-granularity removal invariant and (b) the timeout ceiling env var. Then push a real commit to retrigger Drift Bot.


Generated by Claude Code

github-actions Bot pushed a commit that referenced this pull request Sep 8, 2026

Copy link
Copy Markdown
Owner Author

blocked on author decision — skipping (auto-mergeability sweep)


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

blocked on author decision — skipping (auto-mergeability sweep)

drift-bot commit status is failing with 3 findings. This is a product-review decision by 8090 Software Factory, not a mechanical CI failure. Needs author action.


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 3 potential drift finding(s)

1. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the hook ownership invariant released in WO-8: hooks are removed at hook granularity (individual hooks) rather than entry granularity (whole rows) to preserve co-installed hooks from other tools like GitLens and numbat. This critical architectural rule is published in this PR as a major release feature but is absent from the blueprint.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the installed hook timeout ceiling (8 hours default, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S) that prevents stuck hooks from blocking user agents indefinitely. This safety-critical contract is published in this PR as a major release feature but is absent from the blueprint.

3. Blueprint: Cost and Efficiency Analytics

File: routes/usage.py:1782

The function _try_local_store_token_velocity() removes the check that returns None when zero events are present in the trailing 5-min window, but its docstring (line 1756-1757) specifies it should return None in that case. The function now processes empty rows rather than returning None, contradicting the documented contract.

Comment thread routes/usage.py
return None
if not rows:
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Cost and Efficiency Analytics

The function _try_local_store_token_velocity() removes the check that returns None when zero events are present in the trailing 5-min window, but its docstring (line 1756-1757) specifies it should return None in that case. The function now processes empty rows rather than returning None, contradicting the documented contract.

Copy link
Copy Markdown
Owner Author

blocked on author decision — skipping (auto-mergeability sweep)


Generated by Claude Code

github-actions Bot pushed a commit that referenced this pull request Sep 9, 2026

Copy link
Copy Markdown
Owner Author

✨ auto-fixed: merged latest main into branch to keep it up to date


Generated by Claude Code

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 3 potential drift finding(s)

1. Blueprint: Cost and Efficiency Analytics

File: routes/usage.py:1779

The function _try_local_store_token_velocity() removes the check that returns None when zero events are present in the trailing 5-min window, but its docstring specifies it should return None in that case. The function now processes empty rows and returns a response rather than None, contradicting the documented contract.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the hook ownership invariant released in WO-8: hooks are removed at hook granularity (individual hooks) rather than entry granularity (whole rows) to preserve co-installed hooks from other tools like GitLens and numbat. This critical architectural rule is published in this PR as a major release feature but is absent from the blueprint.

3. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the installed hook timeout ceiling (8 hours default, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S) that prevents stuck hooks from blocking user agents indefinitely. This safety-critical contract is published in this PR as a major release feature but is absent from the blueprint.

Comment thread routes/usage.py
@@ -1779,8 +1779,6 @@ def _try_local_store_token_velocity():
rows = store.query_events(since=since_iso, limit=5000) or []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Cost and Efficiency Analytics

The function _try_local_store_token_velocity() removes the check that returns None when zero events are present in the trailing 5-min window, but its docstring specifies it should return None in that case. The function now processes empty rows and returns a response rather than None, contradicting the documented contract.

github-actions Bot pushed a commit that referenced this pull request Sep 9, 2026
@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 3 potential drift finding(s)

1. Blueprint: Cost and Efficiency Analytics

File: routes/usage.py:1756

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (line 1781-1783 deleted) and processes empty rows, contradicting the documented contract.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The PR releases WO-8 which specifies hook removal at hook granularity (individual hooks) rather than entry granularity to preserve co-installed hooks from other tools. This critical system contract is published in the CHANGELOG but is absent from the Installer Scripts blueprint's System Contracts section.

3. Blueprint: Installer Scripts

File: CHANGELOG.md

The PR releases WO-8 which specifies that installed hook timeouts are capped at 8 hours (via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) to prevent stuck hooks from blocking user agents. This safety-critical contract is published as a major release feature but is absent from the Installer Scripts blueprint's System Contracts section.

Comment thread routes/usage.py
Tool-chain length: count the longest consecutive run of tool-call /
assistant events within the last 2 min per session, broken by a
user-prompt row (matches the legacy JSONL heuristic).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Cost and Efficiency Analytics

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (line 1781-1783 deleted) and processes empty rows, contradicting the documented contract.

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 3 potential drift finding(s)

1. Blueprint: Cost and Efficiency Analytics

File: routes/usage.py:1756

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (line 1781-1783 deleted) and processes empty rows, contradicting the documented contract.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the hook ownership invariant released in WO-8: hooks are removed at hook granularity (individual hooks) rather than entry granularity (whole rows) to preserve co-installed hooks from other tools like GitLens and numbat. This critical architectural rule is published in the CHANGELOG but absent from the blueprint.

3. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the installed hook timeout ceiling (8 hours default, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S) that prevents stuck hooks from blocking user agents indefinitely. This safety-critical contract is published in the CHANGELOG as a major release feature but is absent from the blueprint.

Comment thread routes/usage.py
Tool-chain length: count the longest consecutive run of tool-call /
assistant events within the last 2 min per session, broken by a
user-prompt row (matches the legacy JSONL heuristic).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Cost and Efficiency Analytics

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (line 1781-1783 deleted) and processes empty rows, contradicting the documented contract.

github-actions Bot pushed a commit that referenced this pull request Sep 9, 2026
@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 3 potential drift finding(s)

1. Blueprint: Cost and Efficiency Analytics

File: routes/usage.py:1783

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (lines 1782-1783 deleted) and continues processing empty rows, contradicting the documented contract.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the hook ownership invariant released in WO-8: hooks are removed at hook granularity (individual hooks) rather than entry granularity (whole rows) to preserve co-installed hooks from other tools like GitLens and numbat. This critical architectural rule is published in the CHANGELOG as a major release feature but is absent from the blueprint.

3. Blueprint: Installer Scripts

File: CHANGELOG.md

The Installer Scripts blueprint's System Contracts section does not document the installed hook timeout ceiling (8 hours default, configurable via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) that prevents stuck hooks from blocking user agents indefinitely. This safety-critical contract is published in the CHANGELOG as a major release feature (WO-8) but is absent from the blueprint.

Comment thread routes/usage.py
return None
if not rows:
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Cost and Efficiency Analytics

The _try_local_store_token_velocity() function's docstring specifies it should return None when zero events are present in the trailing 5-min window, but the code removes this check (lines 1782-1783 deleted) and continues processing empty rows, contradicting the documented contract.

github-actions Bot pushed a commit that referenced this pull request Sep 10, 2026
@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 2 potential drift finding(s)

1. Blueprint: Installer Scripts

File: CHANGELOG.md

The PR releases WO-8 which implements hook removal at hook granularity (individual hooks) rather than entry granularity (whole rows) to preserve co-installed hooks from other tools like GitLens and numbat. This critical system contract is published in the CHANGELOG as a major release feature but is absent from the Installer Scripts blueprint's System Contracts section.

2. Blueprint: Installer Scripts

File: CHANGELOG.md

The PR releases WO-8 which specifies that installed hook timeouts are capped at 8 hours (via CLAWMETRY_HOOK_TIMEOUT_MAX_S environment variable) to prevent stuck hooks from blocking user agents indefinitely. This safety-critical system contract is published as a major release feature but is absent from the Installer Scripts blueprint's System Contracts section.

github-actions Bot pushed a commit that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants