Skip to content

hooks: annotate-clean.sh's backgrounded npx pre-warm line is redundant with the mandatory store-resolution call two lines earlier #1110

Description

@alfhen

Summary

annotate-clean.sh (SessionStart hook) ends with a backgrounded pre-warm line — ("${LIEN_CMD[@]}" --version >/dev/null 2>&1 &) — whose header comment claims it exists so "the first real hook call of the session doesn't pay a cold npx install." But that line is only reached in the branch where store="$(... "${LIEN_CMD[@]}" path --store ...)" (a few lines earlier, synchronous, unconditional) has already invoked LIEN_CMD successfully — i.e. in the one branch where the npx round-trip this line claims to "pre-warm" has already happened moments earlier in the same script. In the branch where the pre-warm would matter most (store resolution failing/empty), the script exits before ever reaching the pre-warm line.

Found on

  • Hook source: origin/main @ c973d7cb (fetched fresh for this session; origin/main has since advanced further, but this file is unrelated to and untouched by the intervening commits)
  • Found during the 2026-08-07 nudge-hook dogfood session

Evidence

Forced the npx-fallback branch (hid the global lien binary from PATH, restored the sibling lien-npx-breaker.sh, invoked with an absolute path matching production's bash ${CLAUDE_PLUGIN_ROOT}/hooks/annotate-clean.sh) and measured: a standalone path --store call via the npx wrapper took 1.332s; the full annotate-clean.sh run in the same forced-npx state took 971ms total — one npx round-trip's worth of time, not two. The trailing pre-warm adds no observable extra latency (it isn't blocking), but it also isn't doing any warming the earlier mandatory call didn't already do for free whenever this line is even reached.

Impact

Low — no functional breakage, GC still works correctly. The only consequence is a misleading comment/dead-weight line: a future maintainer could reasonably (and incorrectly) conclude this line is what makes later hooks fast on a no-global-lien machine.

Suggested direction

Either delete the redundant line, or fix the comment to accurately describe what (if anything) it contributes beyond the mandatory path --store call directly above it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4Polish / DX improvementstech-debtTechnical debt and refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions