Skip to content

hook-augment: prove the hook's build identity without hashing the whole executable in every hook process #2683

Open

Description

@DeusData

Problem

Before a hook-augment process can ask the daemon for graph context, it computes the SHA-256 of its own executable (about 300 MB) as its daemon build identity.

Since #2575 (e93e438, first released in v0.12.0) that hash runs on the CPU's SHA instructions where they exist. Measured on current main (354ccec), Apple arm64, over the 305 MB image:

path time per hash
hardware (ARMv8 SHA2) 0.10 s
portable fallback 0.95 s

CPUs without SHA instructions take the portable path on every hook call. Reporters measured about 2.3 s of startup CPU on their machines (#1335, #1388, #2441), which is past the 2000 ms hook deadline, so the hook exits 0 with no output. Even when it stays under the deadline, every Grep/Glob/Bash call pays that latency.

Constraints

Options to evaluate

  1. Daemon-side verification. The daemon verifies the connecting hook's image, as fix(daemon): hash a verified peer image copy once, not on every HELLO (#1955) #2335 does for peers with the verified handle held open, and the hook process does not hash itself.
  2. A read-only hook channel with a narrower identity requirement, since hook-augment only reads the graph.
  3. An install-time digest, recorded by the installer in an owner-only file and checked by the daemon against its own verification of the peer image.

Done when

  • A hook process does no full-image hash on the hook path, asserted by a work counter (bytes hashed), never by wall time.
  • The identity contract holds on macOS, Linux and Windows.
  • Hooks on CPUs without SHA instructions return context at the default deadline.

Activity

  1. added
    enhancementNew feature or request
    stability/performanceServer crashes, OOM, hangs, high CPU/memory
    priority/normalStandard review queue; useful PR with ordinary maintainer urgency.
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor/integrationEditor compatibility and CLI integrationenhancementNew feature or requestpriority/normalStandard review queue; useful PR with ordinary maintainer urgency.stability/performanceServer crashes, OOM, hangs, high CPU/memorywindowsWindows-specific issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions