Skip to content

Commit 6e8fbd5

Browse files
authored
Merge pull request #5 from gaelic-ghost/release/codex-hooks-v3-2-4
release: prepare v3.2.4
2 parents f5573f9 + 5d09a2a commit 6e8fbd5

5 files changed

Lines changed: 46 additions & 13 deletions

File tree

.codex/config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#:schema https://developers.openai.com/codex/config-schema.json
22

3-
[features]
4-
codex_hooks = true
5-
63
# Experimental probe: record whatever payload Codex sends to the notify command.
74
notify = ["node", ".codex/hooks/notify-dump.mjs"]
5+
6+
[features]
7+
codex_hooks = true

.codex/hooks/notify-dump.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import { mkdir, appendFile } from "node:fs/promises";
44
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
56

6-
const hookRoot = path.resolve(process.cwd(), ".codex");
7+
const scriptPath = fileURLToPath(import.meta.url);
8+
const hookRoot = path.resolve(path.dirname(scriptPath), "..");
79
const logDir = path.join(hookRoot, "logs");
810
const logPath = path.join(logDir, "notify-events.jsonl");
911

.codex/hooks/stop-tts.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import { mkdir, readFile, writeFile, appendFile } from "node:fs/promises";
44
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
56

6-
const hookRoot = path.resolve(process.cwd(), ".codex");
7+
const scriptPath = fileURLToPath(import.meta.url);
8+
const hookRoot = path.resolve(path.dirname(scriptPath), "..");
79
const stateDir = path.join(hookRoot, "state");
810
const logDir = path.join(hookRoot, "logs");
911
const seenTurnsPath = path.join(stateDir, "stop-tts-seen-turns.json");

ROADMAP.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,13 @@ Current note: this milestone turns the live-service reliability work into a pack
185185
- [x] Harden configuration and persisted runtime state handling, including precedence rules, atomic writes, corruption or repair behavior, runtime-configuration persistence, and test isolation for profile-root-sensitive state.
186186
- [x] Harden the HTTP and MCP transport surface with clearer readiness policy, stronger request validation and operator-facing errors, reusable smoke coverage, and release verification that proves the staged live service can answer both transport health checks.
187187
- [x] Finish the full hardening program with a package-wide review, quick fixes discovered during the passes, and a cleanup sweep across docs, tests, and maintainer tooling.
188+
189+
## Milestone 17: Codex Hooks And Operator Workflow
190+
191+
Current note: the repo already has a working local Codex hooks prototype for
192+
Stop-hook speech and notify payload inspection. This milestone tracks turning
193+
that into a more intentional operator-facing workflow instead of a one-off
194+
prototype.
195+
196+
- [x] Re-check the repo-local Codex hook scripts against the current official Codex hooks event shapes and stable-path guidance.
197+
- [ ] Add a maintained repo-local "use this with Codex hooks" guide or skill so Gale can enable, understand, and validate the speech-hook workflow without reverse-engineering the prototype files.

docs/codex-hooks-tts.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Codex Hooks TTS Prototype
22

3-
This worktree includes a small repo-local Codex prototype for speaking final
4-
assistant replies and inspecting Codex notification payloads.
3+
This worktree includes a small repo-local Codex hooks prototype for speaking
4+
final assistant replies and inspecting Codex notification payloads.
55

66
## Files
77

@@ -26,6 +26,11 @@ assistant replies and inspecting Codex notification payloads.
2626
- `.codex/state/stop-tts-seen-turns.json`
2727
Dedupe state keyed by `session_id + turn_id`.
2828

29+
Both hook scripts now resolve their `.codex` state and log directories from the
30+
script location itself instead of from `process.cwd()`. That matches the
31+
official Codex hooks guidance to keep repo-local hook paths stable even when
32+
Codex is started from a subdirectory.
33+
2934
## Environment Overrides
3035

3136
The `Stop` hook script accepts a few optional environment overrides:
@@ -42,10 +47,24 @@ The `Stop` hook script accepts a few optional environment overrides:
4247

4348
## Validation Notes
4449

45-
The current prototype was validated with a synthetic `Stop` payload and queued a
46-
live speech request successfully against the local server.
50+
The current prototype was rechecked against the current official Codex hooks
51+
documentation:
52+
53+
- `Stop` receives one JSON object on `stdin`, including `turn_id`,
54+
`stop_hook_active`, and `last_assistant_message`.
55+
- `Stop` must not emit plain text on `stdout`.
56+
- repo-local hooks should resolve from the git root or another stable path, not
57+
by assuming the session `cwd` is the repository root.
58+
59+
The `Stop` hook script matches that current payload shape and was validated with
60+
a synthetic `Stop` payload plus real runtime requests queued through the local
61+
server.
62+
63+
Observed current behavior in this repo's live Codex TUI runs:
64+
65+
- the `Stop` hook payload arrives on `stdin`
66+
- the `notify` command currently arrives as one JSON command-line argument
67+
- the current notify runs observed here did not include any `stdin` payload
4768

48-
The current `notify` probe was validated with synthetic JSON passed both as the
49-
documented command-line argument and over `stdin`. The current Codex docs say
50-
the notify command receives a single JSON argument, so the probe now logs both
51-
paths in case any Codex surface differs in practice.
69+
The `notify` probe still logs both the documented JSON argument and any `stdin`
70+
payload so future Codex surfaces can be compared without rewriting the hook.

0 commit comments

Comments
 (0)