diff --git a/plugins/codex/scripts/session-lifecycle-hook.mjs b/plugins/codex/scripts/session-lifecycle-hook.mjs index 9655eae..1694c0c 100644 --- a/plugins/codex/scripts/session-lifecycle-hook.mjs +++ b/plugins/codex/scripts/session-lifecycle-hook.mjs @@ -20,7 +20,15 @@ export const SESSION_ID_ENV = "CODEX_COMPANION_SESSION_ID"; const PLUGIN_DATA_ENV = "CLAUDE_PLUGIN_DATA"; function readHookInput() { - const raw = fs.readFileSync(0, "utf8").trim(); + let raw; + try { + raw = fs.readFileSync(0, "utf8").trim(); + } catch (err) { + if (err.code === "EAGAIN" || err.code === "EWOULDBLOCK") { + return {}; + } + throw err; + } if (!raw) { return {}; } diff --git a/plugins/codex/scripts/stop-review-gate-hook.mjs b/plugins/codex/scripts/stop-review-gate-hook.mjs index 2346bdc..c56b340 100644 --- a/plugins/codex/scripts/stop-review-gate-hook.mjs +++ b/plugins/codex/scripts/stop-review-gate-hook.mjs @@ -19,7 +19,15 @@ const ROOT_DIR = path.resolve(SCRIPT_DIR, ".."); const STOP_REVIEW_TASK_MARKER = "Run a stop-gate review of the previous Claude turn."; function readHookInput() { - const raw = fs.readFileSync(0, "utf8").trim(); + let raw; + try { + raw = fs.readFileSync(0, "utf8").trim(); + } catch (err) { + if (err.code === "EAGAIN" || err.code === "EWOULDBLOCK") { + return {}; + } + throw err; + } if (!raw) { return {}; }