Fix claude-mem codex-hooks.json for current Codex: drop description (0.140 parser) + filter SessionStart no-op#2953
Conversation
…lid JSON
The shipped codex-hooks.json SessionStart context hook pipes the worker's
{"continue":true} (a Claude Code no-op) straight to Codex, which rejects it as
"hook returned invalid session start JSON output". Suppress the worker-start
stdout and filter the context hook to only forward a real SessionStart
hookSpecificOutput payload (empty otherwise).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…known fields) Codex CLI 0.140 deny_unknown_fields rejects the top-level "description" key: `failed to parse plugin hooks config ... unknown field `description`, expected `hooks``. Remove it so the hooks config parses on current Codex; only `hooks` remains. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
description (0.140 parser) + filter SessionStart no-op
…derr Addresses review feedback on the SessionStart context hook: - Capture `hook codex context` output and `|| exit $?` so a crashed/failed worker surfaces to Codex instead of being masked by the filter's exit 0. - catch branch writes non-JSON to stderr instead of re-emitting it to stdout, so malformed output can't re-trigger 'invalid session start JSON output'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the review — both points on the context hook are valid and now addressed (latest commit):
Tested the four paths locally: no-op (The simplest root fix is still worker-side — emit a valid Codex payload or nothing for |
|
I validated the parser side of this on Codex CLI 0.142.0: the top-level This PR still covers the extra SessionStart output-filtering behavior, so I would treat it as a follow-up after #2948 lands or rebase/drop the duplicate |
|
Superseded by #3127, which fixes the root cause in `worker-service.cjs` (the SessionStart no-op fallback in `hook-command.ts` now emits a valid `hookSpecificOutput` instead of leaking a bare `{"continue":true}`) rather than patching the shipped `codex-hooks.json` shell script. The top-level `description` field this PR also addressed was already dropped separately. Closing in favor of #3127. |
Problem
plugin/hooks/codex-hooks.jsonbreaks on current Codex CLI in two ways:deny_unknown_fieldshooks parser rejects the top-leveldescriptionkey:{"continue":true}(a Claude Code no-op) to Codex, which rejects it:SessionStart hook (failed): hook returned invalid session start JSON output.Fixes (all in
plugin/hooks/codex-hooks.json)descriptionfield so the file parses on Codex 0.140+ (onlyhooksremains;matcher/timeout/statusMessageare still accepted).>/dev/nullso its stdout isn't read as hook output.{"continue":true}no-op:Preferred root fix (maintainer's call)
Cleaner would be in
worker-service.cjs: when invoked ashook codex context, never emit{"continue":true}— return a valid CodexhookSpecificOutputpayload or nothing.Testing
Verified on Codex CLI 0.140.0 + claude-mem 13.6.1: 0 parse errors, all
SessionStarthooksCompleted, noinvalid session start JSON output.