Skip to content

feat(hooks): remind users to trust Codex hooks after inject - #356

Merged
jeff-r2026 merged 1 commit into
mainfrom
feat/codex-hooks-trust-notice
Aug 28, 2026
Merged

jeff-r2026 merged 1 commit into
mainfrom
feat/codex-hooks-trust-notice

Conversation

@jeff-r2026

@jeff-r2026 jeff-r2026 commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

What & Why

The public Codex (the OpenAI / ChatGPT Codex app, tool id codex) gates
non-managed hooks behind an explicit user trust step. Even after teamai
writes <repo>/.codex/hooks.json or ~/.codex/hooks.json, Codex may skip a
newly added or changed hook until the user reviews/trusts it in /hooks or
Settings → Hooks. This PR adds a UX reminder so users know they may need to
trust the hooks — without ever auto-trusting.

teamai does NOT auto-trust Codex hooks. It never reads or writes Codex's
~/.codex/config.toml [hooks.state]. The reminder is purely informational,
and stays conservative ("may require you to review/trust") since teamai has no
model of Codex's trust-gate state.

Scope: only the public codex. The internal variants (codex-internal /
tcodex) share the hooks.json format but have no trust gate, so no reminder
is shown for them.

Changes

  • src/hooks.ts — export isCodexTrustGatedTool() (only the public
    codex), codexTrustReminder() (shared wording), and
    hasInstalledCodexTrustGatedTool() (is the public Codex installed under a
    base dir, using the same root-dir gate as reconcile).
  • src/hooks-cmd.ts — after teamai hooks inject, log.warn the trust
    reminder when the public Codex received hooks. Suppressed under --silent.
  • src/doctor.ts — when public-Codex hooks are installed, print the same
    note (read-only; never inspects/writes hooks.state). Kept small — status
    output left unchanged as it has no hook-status section.
  • Tests — hooks-cmd (reminder shown / not-shown / --silent suppressed) and
    doctor (note shown / not-shown). Golden byte-compat tests unchanged and
    passing — no hook command content changed.
  • Docs — bilingual usage-guide note (EN + zh-CN).

Where the reminder appears

Command Behavior
teamai hooks inject ⚠ trust reminder when the public Codex is installed; suppressed with --silent
teamai doctor ℹ note when public-Codex hooks are installed

Test Plan

All executed against the built CLI (npm run build + real node dist/index.js):

  • npm run build passes
  • npx tsc --noEmit passes
  • npx vitest run (full suite, 2308 tests) passes; golden tests included
  • E2E: public codex installed → inject prints the trust reminder; hooks.json written; --silent prints nothing; doctor shows the note; no ~/.codex/config.toml written (no auto-trust)
  • E2E: only codex-internal installed → no reminder (scope correctly narrowed)
  • E2E: no Codex tool installed → no reminder

Not auto-trusting

Confirmed: teamai never writes [hooks.state] or ~/.codex/config.toml. The
E2E run verified the file is absent after inject. Trusting is left to the user.

🤖 Generated with Claude Code

The public Codex (the OpenAI / ChatGPT Codex app, tool id `codex`) gates
non-managed hooks behind an explicit user trust step: even after teamai
writes ~/.codex/hooks.json (or the project copy), Codex may skip a newly
added or changed hook until the user reviews/trusts it in /hooks or
Settings → Hooks. teamai never edits Codex's [hooks.state] to auto-trust
— this is a UX reminder only.

Scoped to the public `codex` only. The internal variants
(codex-internal / tcodex) share the hooks.json format but have no trust
gate, so no reminder is shown for them.

- hooks.ts: export isCodexTrustGatedTool / codexTrustReminder /
  hasInstalledCodexTrustGatedTool
- hooks-cmd.ts: after `hooks inject`, warn when the public Codex received
  hooks; suppressed under --silent
- doctor.ts: note the same when public-Codex hooks are installed
  (read-only; never inspects or writes hooks.state)
- tests + bilingual usage-guide docs

Co-Authored-By: Claude Fable 5 <[email protected]>
@jeff-r2026
jeff-r2026 force-pushed the feat/codex-hooks-trust-notice branch from dc17191 to 56b4c0c Compare August 28, 2026 03:23
@jeff-r2026
jeff-r2026 merged commit 300fcf2 into main Aug 28, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the feat/codex-hooks-trust-notice branch September 11, 2026 09:15
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
)

The public Codex (the OpenAI / ChatGPT Codex app, tool id `codex`) gates
non-managed hooks behind an explicit user trust step: even after teamai
writes ~/.codex/hooks.json (or the project copy), Codex may skip a newly
added or changed hook until the user reviews/trusts it in /hooks or
Settings → Hooks. teamai never edits Codex's [hooks.state] to auto-trust
— this is a UX reminder only.

Scoped to the public `codex` only. The internal variants
(codex-internal / tcodex) share the hooks.json format but have no trust
gate, so no reminder is shown for them.

- hooks.ts: export isCodexTrustGatedTool / codexTrustReminder /
  hasInstalledCodexTrustGatedTool
- hooks-cmd.ts: after `hooks inject`, warn when the public Codex received
  hooks; suppressed under --silent
- doctor.ts: note the same when public-Codex hooks are installed
  (read-only; never inspects or writes hooks.state)
- tests + bilingual usage-guide docs

Co-authored-by: Claude Fable 5 <[email protected]>
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