Skip to content

An unrecognised hook name is dropped with no record or warning #392

Open

Description

@blitzcrieg1

A hook event name the mapper does not recognise produces no record and no warning. A miswired hook could therefore capture nothing while the install looks healthy.

An outside audit reported this on 2026-11-07.

Reproduction

map_hook on master, run in process, with AGENTMETRY_SOURCE_APP unset so the source defaults to cursor:

Hook name Result
preToolUse ('cursor', 'approval_request')
PreToolUse (wrong case for Cursor) None
NoSuchHook None

hook_main in hooks/ingest.py only calls post_ingest when there is a payload, then returns through _emit_hook_stdout. So the name is dropped without a record. That part comes from reading the code, plus the audit's own run, which reported exit 0, nothing recorded and nothing printed. A full hook run was not repeated here.

The audit also said no heartbeat field would show this. That has not been checked.

What this means

The likely case is a hand-edited config, or an agent renaming a hook event in a new version. Either way the agent keeps working and the trail goes quiet for that event. hooks status and doctor have not been tested against this case, so whether they notice is unknown.

Fix, when it is scheduled

Recording every None is the wrong fix, because mappers may also return None on purpose for events they do not record. Check which is which first.

  • Separate "known and deliberately not recorded" from "not recognised".
  • Report the second kind where someone will see it. The hook must still exit 0, because it must never break the agent.
  • Record the hook name only, never the payload. An unrecognised event could carry anything.
  • Have doctor warn when this has happened recently.
  • Add a test for each mapper.

hooks/ingest.py is not on the frozen list.

Filed, not scheduled. Under the feature stop this waits for a pilot or a user to hit it.

Activity

  1. added
    bug
    on Nov 7, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions