Skip to content

Enabling the armorcodex Codex plugin double-fires hooks; plugin hooks.json uses a broken relative path #50

Description

@Harihara04sudhan

Problem

With ArmorCodex installed via the installer (global ~/.codex/hooks.json + MCP server), if the user ALSO enables the armorcodex@armorcodex plugin from Codex's /plugins UI, every hook fires twice — once "completed", once "failed (exit code 1)":

  • Global ~/.codex/hooks.json (installer) uses ABSOLUTE node /abs/.../bootstrap.mjs router -> works.
  • Plugin plugins/armorcodex/hooks/hooks.json (and .codex/hooks.json) uses RELATIVE node ./scripts/bootstrap.mjs router. Codex fires plugin hooks with CWD = user workspace, so ./scripts/bootstrap.mjs doesn't exist -> exit 1 -> "failed".

The failing hook confuses the agent (observed it web-searching for the intent tool) and looks broken to users.

Root cause

Two hook registration mechanisms are active simultaneously, and the plugin's hooks.json assumes CWD = plugin root (relative path), which isn't true when Codex invokes plugin hooks.

Fix options

  1. Installer model (global hooks + MCP) is the supported path -> the plugin should NOT also ship conflicting hooks, or the docs must say "don't enable the plugin; the installer wires hooks." (Immediate mitigation: enabled = false for the plugin.)
  2. If the plugin path is meant to be supported, its hooks/hooks.json + .codex/hooks.json must resolve the bootstrap path independent of CWD (absolute, or a Codex plugin-root variable if one exists) — a relative ./scripts/... is always wrong under a workspace CWD.
  3. Decide on ONE mechanism (installer global hooks OR plugin) and make them mutually exclusive.

Refs

Surfaced during ArmorCodex parity testing (#41).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions