Skip to content

fix(agents): approve Menew's Codex hooks so the ChatGPT app reaches the notch - #26

Merged
Quost merged 1 commit into
mainfrom
fix/codex-hook-trust
Nov 12, 2026
Merged

Quost merged 1 commit into
mainfrom
fix/codex-hook-trust

Conversation

@Quost

@Quost Quost commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What changes

Sessions from the ChatGPT app (Work mode, which runs Codex inside through codex app-server) never showed up in the notch, even with Codex notifications turned on.

Cause: Codex only runs a hooks.json entry when ~/.codex/config.toml has an approval for it, [hooks.state."<hooks.json>:<event>:<group>:<handler>"] with a trusted_hash. The CLI asks for it on startup, but the ChatGPT app skips unapproved hooks without asking, so Menew's hooks never fired.

Fix:

  • New CodexHookTrust (in AgentHub.swift) computes Codex's own hash, taken from codex-rs/hooks/src/engine/discovery.rs (hook_hash + version_for_toml): SHA-256 of the compact JSON, with sorted keys, of {event_name, hooks: [normalized handler]}. The default timeout is 600 s, or 1 s for SessionEnd.
  • Turning Codex on (or pressing Update) writes the approvals for Menew's own commands into a managed # >>> menew hooks block in config.toml, after saving a .menew-backup. A key Codex already wrote elsewhere is left alone, because repeating the table would break the TOML. Turning Codex off removes the block.
  • AgentHooks.status(.codex) reports .outdated while the approvals are missing, so existing users see Outdated → Update once.
  • The confirmation text now explains this (en/de/es/zh updated).

For reviewers:

  • Codex approves hooks by their position in hooks.json. If another tool adds or removes hook groups before Menew's, the approval goes stale and the row shows Outdated again until Update is pressed.
  • Classic ChatGPT chats can't be shown. They don't go through the local Codex, so they leave no hook, log or process on the Mac.

Screenshots

No visual change beyond the existing Outdated/Update state and the confirmation text.

Checklist

  • Builds with ./build.sh. I checked that Codex runs the hooks with the approvals in place: a real codex exec with an isolated CODEX_HOME delivered SessionStart, UserPromptSubmit and SessionEnd to Menew; without the approvals, none arrived.
  • swift test passes (113 tests). New tests check the hash against hashes Codex itself wrote, plus block insertion, removal and dedupe.
  • Every new UI string uses L("…") with en, de, es and zh (check-l10n.py passes).
  • Screenshots regenerated if a screen changed (no screen changed).
  • README and website: no change needed (no new feature).
  • CHANGELOG.md has a line under ## Unreleased.
  • Commits follow Conventional Commits.
  • No telemetry, no new network calls and no new dependencies. CryptoKit is a system framework.

🤖 Generated with Claude Code

…he notch

Codex only runs hooks.json entries that have a matching trusted_hash in
~/.codex/config.toml. The CLI asks for it, but the ChatGPT app (which runs
Codex inside) skips unapproved hooks silently, so its sessions never
showed up. Turning on Codex now also writes the approval for Menew's own
commands in a managed block, using Codex's hash (SHA-256 of the
normalized event and hook), and shows Codex as outdated until it is there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Quost
Quost merged commit 0e51a82 into main Nov 12, 2026
11 checks passed
@Quost
Quost deleted the fix/codex-hook-trust branch November 12, 2026 13:12
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