orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: Codex hooks registered without a timeout field; codex-hook.sh curl has no --max-time

Open majiayu000 opened this issue 6 months ago • 2 comments

Environment

  • Orca v1.4.27 (com.stablyai.orca), macOS
  • Codex CLI hooks (~/.codex/hooks.json)

What happens

Orca registers its agent hooks into ~/.codex/hooks.json, but the entries it writes do not include a timeout field. On my machine all 6 Orca-registered Codex hooks (events: PreToolUse, PostToolUse, PermissionRequest, SessionStart, Stop, UserPromptSubmit) look like:

{ "command": "if [ -x '~/.orca/agent-hooks/codex-hook.sh' ]; then /bin/sh '...'; fi" }

— no timeout key.

Two related concerns:

  1. Tools that read/validate ~/.codex/hooks.json flag every Orca hook as "unmanaged hook without timeout".
  2. ~/.orca/agent-hooks/codex-hook.sh POSTs to http://127.0.0.1:$ORCA_AGENT_HOOK_PORT/hook/codex via curl -sS without --max-time. If the local Orca endpoint is down/unresponsive, the curl (and thus the agent's hook step) can block.

Expected

  • Each hook entry Orca writes includes a sane default timeout (e.g. 10).
  • The hook script's curl uses --max-time so a stalled endpoint can't hang the agent.

Repro

  1. Install Orca, let it register Codex hooks.
  2. Inspect ~/.codex/hooks.json → Orca entries have no timeout field.

Suggested fix

  • When writing hook entries (codex/claude/cursor/…), add "timeout": 10 (or similar) per entry.
  • In codex-hook.sh (and the sibling *-hook.sh scripts), add --max-time 5 (or similar) to the curl call.

majiayu000 avatar Jun 04 '26 09:06 majiayu000

Fixed the Codex side in #4638 — \ imeout: 10\ is now written to each hook command entry in ~/.codex/hooks.json\ during both local install and remote install.

Note that other agents (Claude, Cursor, Gemini, Droid, Grok, Antigravity, Command Code) use the same pattern of writing hooks without a \ imeout\ field. I kept this PR scoped to Codex per the issue, but if y'all want me to follow up with a pass across the other agents, happy to do it in a separate PR — it's the same one-line fix in each hook service.

sudoeren avatar Jun 04 '26 12:06 sudoeren

After the Codex-side fix, I would add one cross-agent hook install test so this does not regress in the sibling adapters.

Fixture shape:

  • generate hook config for each supported host
  • assert every managed hook entry has a timeout
  • assert the shell wrapper has a transport timeout such as curl --max-time
  • simulate a dead local endpoint and assert the hook returns within budget

Codex exposed the failure first because hooks sit on a very visible critical path, but the same local-endpoint pattern can block other agent hosts if their wrappers wait forever.


Generated with ax.

Necmttn avatar Jun 21 '26 10:06 Necmttn