Skip to content

[codex] support codex hooks injection - #103

Merged
jeff-r2026 merged 2 commits into
Tencent:mainfrom
jeff-r2026:codex/codex-hooks-support
Jul 2, 2026
Merged

[codex] support codex hooks injection#103
jeff-r2026 merged 2 commits into
Tencent:mainfrom
jeff-r2026:codex/codex-hooks-support

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add Codex-family hook targets (codex, codex-internal, tcodex) using hooks.json paths.
  • Add a Codex-specific hook renderer/reconciler that keeps Codex's PascalCase hook event shape while omitting Claude-only description metadata.
  • Extend unit/core/e2e coverage so built-in and team-declared hooks are injected, recorded in the manifest, removed, and status-checked for Codex.

Why

Codex now supports lifecycle hooks via hooks.json / [hooks] config, but teamai-cli still skipped Codex-family tools because their default toolPaths had no settings path. README claimed support, but implementation only synced skills/rules/agents.

Test Report

Passing checks run locally:

  • npx vitest run src/__tests__/hooks.test.ts src/__tests__/hooks-reconcile-scope.test.ts src/__tests__/tclaude-tcodex.test.ts src/__tests__/types.test.ts — 75 tests passed
  • npm run typecheck — passed
  • npm run build — passed
  • npm run test:e2e -- src/__tests__/hooks-team-e2e.test.ts — 5 tests passed
  • Local Codex smoke with codex-cli 0.142.5: generated .codex/hooks.json via built teamai hooks inject, verified Stop contained both built-in and team hook entries, then parsed with CODEX_HOME=<temp>/.codex codex debug prompt-input ... — exit 0, no stderr

Full-suite status:

  • npm test currently fails in unrelated suites: 5 auto-recall.test.ts assertions where hook output is null, plus 1 http-repo-integration.test.ts timeout. These failures reproduced when rerunning those files directly and are outside the Codex hook changes.

@jeff-r2026
jeff-r2026 marked this pull request as ready for review July 2, 2026 03:01
@jeff-r2026
jeff-r2026 merged commit 9fd9ac6 into Tencent:main Jul 2, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the codex/codex-hooks-support branch July 2, 2026 03:18
hsuchifeng pushed a commit to hsuchifeng/teamai-cli that referenced this pull request Jul 2, 2026
Rebase onto main picked up the new Codex hooks injection tests
(Tencent#103), which still hardcoded 7 PostToolUse builtin hooks. Update
the expectation to 3 to match the auto-recall removal in this branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
jeff-r2026 added a commit that referenced this pull request Jul 2, 2026
…mai-recall subagent (#106)

* refactor(recall)!: remove auto-recall PostToolUse hook in favor of teamai-recall subagent

auto-recall silently fired on every Bash/Grep/WebSearch/WebFetch tool call to
search team knowledge, but was noisy and low-hit-rate in practice, and its job
is now done better by the teamai-recall subagent (proactive, codebase-graph
aware, structured output). Installed machines self-clean the old hook entries
on the next `teamai pull` / `hooks inject` via the existing reconcile engine.

contribute-check's knowledge-gap detection (Phase 2) depended on auto-recall's
quality cache, so `teamai recall` now records recall quality itself (moved
into a standalone recall-quality.ts module) — the feature keeps working, just
with a new, more accurate data source (manual recall + the recall subagent's
underlying command, instead of a passive hook).

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(test): update Codex hooks test for reduced PostToolUse count

Rebase onto main picked up the new Codex hooks injection tests
(#103), which still hardcoded 7 PostToolUse builtin hooks. Update
the expectation to 3 to match the auto-recall removal in this branch.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jeffyxu <jeffyxu@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
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