Skip to content

fix: ignore timeout/statusMessage on Codex prompt hooks - #1752

Merged
bcdonadio merged 1 commit into
mainfrom
fix/1719-codex-prompt-agent-fields
Oct 25, 2026
Merged

bcdonadio merged 1 commit into
mainfrom
fix/1719-codex-prompt-agent-fields

Conversation

@bcdonadio

Copy link
Copy Markdown
Contributor

Why

lcm doctor reported every LCM hook as hooks-file-unreadable when hooks.json held a prompt or agent handler with a bad timeout (for example -1 or 1.5) or a non-string statusMessage. Codex 0.163.0 defines those two handler variants as empty and its HookHandlerConfig enum does not deny unknown fields, so it ignores both members and loads the file. Doctor was stricter than Codex and told users their working hooks were broken.

Before: {"type":"prompt","timeout":-1} next to the LCM hooks gives hooks-file-unreadable on every row. After: the rows keep their real status (ready here).

How

In validHandler (src/connectors/codex-readiness.ts), a prompt or agent handler now returns valid right after the known-type check, before any timeout or statusMessage check. command and mcp_tool keep the existing integer-token timeout and string statusMessage checks unchanged. The now-unreachable non-command guard and the timeout ternary are removed so no dead branches remain.

Role detection for prompt and agent handlers that carry a command string is a separate pre-existing behaviour and is not touched.

Closes #1719.

Testing

  • test/connectors/codex-readiness.test.ts: the two rejected prompt/agent timeout cases are now accepted, with added accepted cases for odd timeout and statusMessage values on prompt/agent, and rejection cases for number/boolean/object statusMessage on command and mcp_tool (null stays accepted). The flipped case fails on the unfixed source ({"type":"prompt","timeout":-1}: expected ready, got hooks-file-unreadable).
  • test/codecov-config.test.ts passes with the new ownership fragment.
  • tsc --noEmit and eslint on the changed files are clean; codex-readiness.ts has 100% statement, branch, function and line coverage.

Reviewer guide

Start with the validHandler diff, then the flipped assertions in the rejects a timeout or additionalContextLimit ... test. The docs/vscode-codex.md row now scopes the whole-number timeout rule to command and mcp_tool handlers. A patch changeset and a test/codecov-ownership fragment (no codecov.yml change) are included.

lcm doctor validated timeout and statusMessage on every Codex hook
handler type, so a prompt or agent handler with e.g. timeout -1 or
timeout 1.5 made every LCM hook row report hooks-file-unreadable.
Codex defines those two variants as empty and its handler enum does not
deny unknown fields, so it ignores both members and loads the file.

validHandler now returns valid for prompt and agent right after the
known-type check. command and mcp_tool keep their integer-token timeout
and string statusMessage checks. The timeout ternary and the non-command
guard became unreachable and are removed to keep the 100% branch gate.

Gotcha: role detection still reads the command member of a prompt or
agent handler; that pre-existing behaviour is left alone.

Closes #1719

Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
@bcdonadio bcdonadio self-assigned this Oct 25, 2026
@bcdonadio
bcdonadio enabled auto-merge October 25, 2026 06:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T06:14:43.301779Z 2c8f51c PR opened
🔒 Security Review ✅ Completed 2026-10-25T06:16:00.003318Z 2c8f51c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bcdonadio
bcdonadio merged commit 931db70 into main Oct 25, 2026
21 checks passed
@bcdonadio
bcdonadio deleted the fix/1719-codex-prompt-agent-fields branch October 25, 2026 06:18
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 doctor rejects timeout and statusMessage on prompt and agent hook handlers that Codex ignores

1 participant