Skip to content

fix(run): stop registering the noisy gateway hook for Codex - #110

Merged
johnnyfish merged 1 commit into
mainfrom
fix/codex-gateway-hook-noise
Jul 30, 2026
Merged

fix(run): stop registering the noisy gateway hook for Codex#110
johnnyfish merged 1 commit into
mainfrom
fix/codex-gateway-hook-noise

Conversation

@johnnyfish

Copy link
Copy Markdown
Contributor

What

Codex was printing a noisy OneCLI gateway block on every prompt:

• UserPromptSubmit hook (completed)
  hook context: OneCLI gateway active — load the onecli-gateway skill ...

Root cause: onecli run registers a UserPromptSubmit gateway-detect hook that emits a {"hookSpecificOutput":{"additionalContext":...}} envelope. Claude Code injects that context silently; Codex renders it in the transcript. There is no Codex flag to hide it. The auto-loaded onecli-gateway skill already carries identical guidance, so the hook is redundant on Codex.

Change

  • Codex spec gets skipHook: true — no hook registered on new runs. Claude keeps it (silent + useful there).
  • Self-healing cleanupskipHook agents now de-register a gateway hook a prior CLI version wrote into ~/.codex/hooks.json, so existing installs go quiet too, not just fresh ones. Removes only our entry (command referencing the detect script), preserves third-party hooks, and prunes an emptied UserPromptSubmit array. No-op when absent/missing.

Verification

  • go test ./... -count=1 green; go vet + gofmt clean.
  • New tests: Codex-skips-hook spec assertion; de-registration (preserve others / prune empty / no-op absent / no-op missing file); retargeted the dedicated-hooks-file test.
  • Live: ran onecli run -- codex on a real ~/.codex/hooks.json — printed removed the stale gateway hook for Codex, and the file now contains only the pre-existing Superset hooks (SessionStart/Stop/UserPromptSubmit all intact), onecli entry gone.

Out of scope

The longer SessionStart block ("Call external APIs directly (curl/gh)...") comes from a different repo (onecli-codex-plugin/src/codex/session-start.mts), not this CLI. Same Codex-renders-hooks root cause; needs a matching fix there.

Review

Fast path (small, isolated fix). Self-reviewed for: scope (only Codex spec + a new cleanup helper), regression safety (Claude/Cursor/OpenCode hook paths unchanged; hooksFile machinery retained), and data safety (JSON round-trip preserves unrelated hooks, 0600 perms, no-op on parse/no-match). Verified live against the real config file.

@johnnyfish
johnnyfish force-pushed the fix/codex-gateway-hook-noise branch from 72b93e4 to 08e9484 Compare July 30, 2026 21:00
Codex renders injected hook context in its transcript (Claude injects
the same JSON envelope silently), so the UserPromptSubmit gateway hook
printed a block on every prompt. The auto-loaded onecli-gateway skill
already carries identical guidance, so the hook is redundant there.

Codex spec gets skipHook=true — no registration on new runs. Claude keeps
the hook (silent injection there). Existing installs that already have the
hook can drop it by removing the entry from ~/.codex/hooks.json.

Tests: Codex-skips-hook spec assertion; agent-spec table updated.
@johnnyfish
johnnyfish force-pushed the fix/codex-gateway-hook-noise branch from 08e9484 to 724a66d Compare July 30, 2026 21:09
@johnnyfish
johnnyfish merged commit 86415d3 into main Jul 30, 2026
2 checks passed
@johnnyfish
johnnyfish deleted the fix/codex-gateway-hook-noise branch July 30, 2026 21:18
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.

1 participant