Skip to content

fix(codex): generate array-of-tables hooks schema (Codex 0.125+)#50

Merged
telagod merged 1 commit into
mainfrom
fix/codex-hooks-toml-schema
Jun 13, 2026
Merged

fix(codex): generate array-of-tables hooks schema (Codex 0.125+)#50
telagod merged 1 commit into
mainfrom
fix/codex-hooks-toml-schema

Conversation

@telagod

@telagod telagod commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Problem

Closes #49. After installing for Codex, codex fails to start:

Error loading config.toml: invalid type: map, expected a sequence in `hooks`

Codex 0.125+ deprecated the flat [hooks.X] table form. It now requires array-of-tables: [[hooks.X]] + [[hooks.X.hooks]]. Both our generators emitted the old form.

Fix

  • injectCodexHooks rewritten to emit [[hooks.X]] (matcher) + [[hooks.X.hooks]] (type/command/timeout/statusMessage). Marker-based block injection preserves the prior contracts: idempotent re-runs, stale-path re-anchoring, and non-destructive skip when a user owns the event.
  • stripCodexAbyssIntegration upgraded to group [[hooks.X]] units so uninstall stays clean.
  • resolveWindowsBash() added — at install time on Windows it locates Git Bash (where bash → common install dirs) and emits command_windows, so hooks run even when bash is not on PATH (the reporter's second ask). Omitted on non-Windows.
  • install-hooks.sh codex branch updated to the same schema.

Verification

  • Generated TOML parses cleanly via tomllib; parsed structure matches the hooks.json source shape exactly.
  • npm test → 410 passed (added 3 assertions: array-table form, conditional command_windows).
  • npm run verify:skills → 30 skills pass.

Out of scope

Web research flagged a separate Codex regression where inline config.toml hooks may not fire interactively (workaround: write ~/.codex/hooks.json). That is distinct from this parse-error crash and not addressed here.

Codex 0.125+ rejects the flat [hooks.X] table form with
'invalid type: map, expected a sequence in hooks', breaking
codex startup after install.

- injectCodexHooks now emits [[hooks.X]] + [[hooks.X.hooks]]
  array-of-tables; marker-based block injection keeps idempotency,
  stale-path re-anchoring, and user-owned hook preservation
- stripCodexAbyssIntegration groups [[hooks.X]] units for clean uninstall
- resolveWindowsBash() locates Git Bash at install time and emits
  command_windows so hooks run when bash is not on PATH (Windows)
- install-hooks.sh codex branch updated to the same schema

Verified: generated TOML parses cleanly; 410 tests pass.

Fixes #49
@telagod telagod merged commit 28d5ce5 into main Jun 13, 2026
15 checks passed
@telagod telagod deleted the fix/codex-hooks-toml-schema branch June 13, 2026 13:56
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.

codex hooks config is generated with invalid TOML schema

1 participant