@devries-cameron20 / t3code Mirror · read-only / commits / 6f108e8556
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 17:15 UTC

fix(codex): accept hook event names newer than the pinned protocol (#35885)

Julius Marminge committed Nov 12, 2026 at 19:35 UTC 6f108e8556194e135a714604f4c37f2a99c271c7
3 files changed +47 -135
packages/effect-codex-app-server/scripts/generate.ts
+2
@@ -145,6 +145,8 @@ const ManualSchemas: Record<string, Schema.Json> = {
145 // `account/read` decode and take the provider down with it.
146 const DefinitionOverrides: Record<string, Schema.Json> = {
147 PlanType: { type: "string" },
148 + // Newer Codex releases add hook events (e.g. `preModelRequest`); a closed enum drops their notifications.
149 + HookEventName: { type: "string" },
150 // Newer custom Codex binaries emit partial answers before additional tools or text.
151 MessagePhase: {
152 description:
packages/effect-codex-app-server/src/_generated/schema.gen.ts
+20 -135
@@ -2782,33 +2782,10 @@ export const ServerNotification__HookOutputEntryKind = Schema.Literals([
2782 "error",
2783 ]).annotate({ identifier: "ServerNotification__HookOutputEntryKind" });
2784
2785 -export type ServerNotification__HookEventName =
2786 - | "preToolUse"
2787 - | "permissionRequest"
2788 - | "postToolUse"
2789 - | "preCompact"
2790 - | "postCompact"
2791 - | "sessionStart"
2792 - | "sessionEnd"
2793 - | "userPromptSubmit"
2794 - | "subagentStart"
2795 - | "subagentStop"
2796 - | "stop"
2797 - | "interrupt";
2798 -export const ServerNotification__HookEventName = Schema.Literals([
2799 - "preToolUse",
2800 - "permissionRequest",
2801 - "postToolUse",
2802 - "preCompact",
2803 - "postCompact",
2804 - "sessionStart",
2805 - "sessionEnd",
2806 - "userPromptSubmit",
2807 - "subagentStart",
2808 - "subagentStop",
2809 - "stop",
2810 - "interrupt",
2811 -]).annotate({ identifier: "ServerNotification__HookEventName" });
2785 +export type ServerNotification__HookEventName = string;
2786 +export const ServerNotification__HookEventName = Schema.String.annotate({
2787 + identifier: "ServerNotification__HookEventName",
2788 +});
2789
2790 export type ServerNotification__HookExecutionMode = "sync" | "async";
2791 export const ServerNotification__HookExecutionMode = Schema.Literals(["sync", "async"]).annotate({
@@ -5653,33 +5630,10 @@ export const V2HookCompletedNotification__HookOutputEntryKind = Schema.Literals(
5630 "error",
5631 ]).annotate({ identifier: "V2HookCompletedNotification__HookOutputEntryKind" });
5632
5656 -export type V2HookCompletedNotification__HookEventName =
5657 - | "preToolUse"
5658 - | "permissionRequest"
5659 - | "postToolUse"
5660 - | "preCompact"
5661 - | "postCompact"
5662 - | "sessionStart"
5663 - | "sessionEnd"
5664 - | "userPromptSubmit"
5665 - | "subagentStart"
5666 - | "subagentStop"
5667 - | "stop"
5668 - | "interrupt";
5669 -export const V2HookCompletedNotification__HookEventName = Schema.Literals([
5670 - "preToolUse",
5671 - "permissionRequest",
5672 - "postToolUse",
5673 - "preCompact",
5674 - "postCompact",
5675 - "sessionStart",
5676 - "sessionEnd",
5677 - "userPromptSubmit",
5678 - "subagentStart",
5679 - "subagentStop",
5680 - "stop",
5681 - "interrupt",
5682 -]).annotate({ identifier: "V2HookCompletedNotification__HookEventName" });
5633 +export type V2HookCompletedNotification__HookEventName = string;
5634 +export const V2HookCompletedNotification__HookEventName = Schema.String.annotate({
5635 + identifier: "V2HookCompletedNotification__HookEventName",
5636 +});
5637
5638 export type V2HookCompletedNotification__HookExecutionMode = "sync" | "async";
5639 export const V2HookCompletedNotification__HookExecutionMode = Schema.Literals([
@@ -5760,33 +5714,10 @@ export const V2HooksListResponse__HookErrorInfo = Schema.Struct({
5714 path: Schema.String,
5715 }).annotate({ identifier: "V2HooksListResponse__HookErrorInfo" });
5716
5763 -export type V2HooksListResponse__HookEventName =
5764 - | "preToolUse"
5765 - | "permissionRequest"
5766 - | "postToolUse"
5767 - | "preCompact"
5768 - | "postCompact"
5769 - | "sessionStart"
5770 - | "sessionEnd"
5771 - | "userPromptSubmit"
5772 - | "subagentStart"
5773 - | "subagentStop"
5774 - | "stop"
5775 - | "interrupt";
5776 -export const V2HooksListResponse__HookEventName = Schema.Literals([
5777 - "preToolUse",
5778 - "permissionRequest",
5779 - "postToolUse",
5780 - "preCompact",
5781 - "postCompact",
5782 - "sessionStart",
5783 - "sessionEnd",
5784 - "userPromptSubmit",
5785 - "subagentStart",
5786 - "subagentStop",
5787 - "stop",
5788 - "interrupt",
5789 -]).annotate({ identifier: "V2HooksListResponse__HookEventName" });
5717 +export type V2HooksListResponse__HookEventName = string;
5718 +export const V2HooksListResponse__HookEventName = Schema.String.annotate({
5719 + identifier: "V2HooksListResponse__HookEventName",
5720 +});
5721
5722 export type V2HooksListResponse__HookSource =
5723 | "system"
@@ -5843,33 +5774,10 @@ export const V2HookStartedNotification__HookOutputEntryKind = Schema.Literals([
5774 "error",
5775 ]).annotate({ identifier: "V2HookStartedNotification__HookOutputEntryKind" });
5776
5846 -export type V2HookStartedNotification__HookEventName =
5847 - | "preToolUse"
5848 - | "permissionRequest"
5849 - | "postToolUse"
5850 - | "preCompact"
5851 - | "postCompact"
5852 - | "sessionStart"
5853 - | "sessionEnd"
5854 - | "userPromptSubmit"
5855 - | "subagentStart"
5856 - | "subagentStop"
5857 - | "stop"
5858 - | "interrupt";
5859 -export const V2HookStartedNotification__HookEventName = Schema.Literals([
5860 - "preToolUse",
5861 - "permissionRequest",
5862 - "postToolUse",
5863 - "preCompact",
5864 - "postCompact",
5865 - "sessionStart",
5866 - "sessionEnd",
5867 - "userPromptSubmit",
5868 - "subagentStart",
5869 - "subagentStop",
5870 - "stop",
5871 - "interrupt",
5872 -]).annotate({ identifier: "V2HookStartedNotification__HookEventName" });
5777 +export type V2HookStartedNotification__HookEventName = string;
5778 +export const V2HookStartedNotification__HookEventName = Schema.String.annotate({
5779 + identifier: "V2HookStartedNotification__HookEventName",
5780 +});
5781
5782 export type V2HookStartedNotification__HookExecutionMode = "sync" | "async";
5783 export const V2HookStartedNotification__HookExecutionMode = Schema.Literals([
@@ -7530,33 +7438,10 @@ export const V2PluginReadResponse__AppSummary = Schema.Struct({
7438 identifier: "V2PluginReadResponse__AppSummary",
7439 });
7440
7533 -export type V2PluginReadResponse__HookEventName =
7534 - | "preToolUse"
7535 - | "permissionRequest"
7536 - | "postToolUse"
7537 - | "preCompact"
7538 - | "postCompact"
7539 - | "sessionStart"
7540 - | "sessionEnd"
7541 - | "userPromptSubmit"
7542 - | "subagentStart"
7543 - | "subagentStop"
7544 - | "stop"
7545 - | "interrupt";
7546 -export const V2PluginReadResponse__HookEventName = Schema.Literals([
7547 - "preToolUse",
7548 - "permissionRequest",
7549 - "postToolUse",
7550 - "preCompact",
7551 - "postCompact",
7552 - "sessionStart",
7553 - "sessionEnd",
7554 - "userPromptSubmit",
7555 - "subagentStart",
7556 - "subagentStop",
7557 - "stop",
7558 - "interrupt",
7559 -]).annotate({ identifier: "V2PluginReadResponse__HookEventName" });
7441 +export type V2PluginReadResponse__HookEventName = string;
7442 +export const V2PluginReadResponse__HookEventName = Schema.String.annotate({
7443 + identifier: "V2PluginReadResponse__HookEventName",
7444 +});
7445
7446 export type V2PluginReadResponse__AbsolutePathBuf = string;
7447 export const V2PluginReadResponse__AbsolutePathBuf = Schema.String.annotate({
packages/effect-codex-app-server/src/schema.test.ts
+25
@@ -8,6 +8,8 @@ const isThreadReadResponse = Schema.is(CodexSchema.V2ThreadReadResponse);
8 const isThreadResumeResponse = Schema.is(CodexSchema.V2ThreadResumeResponse);
9 const isThreadForkResponse = Schema.is(CodexSchema.V2ThreadForkResponse);
10 const isTurnCompletedNotification = Schema.is(CodexSchema.V2TurnCompletedNotification);
11 +const isHookStartedNotification = Schema.is(CodexSchema.V2HookStartedNotification);
12 +const isHookCompletedNotification = Schema.is(CodexSchema.V2HookCompletedNotification);
13 const decodeThreadResumeResponse = Schema.decodeUnknownSync(CodexSchema.V2ThreadResumeResponse);
14
15 it("keeps async questions in live notifications and thread history", () => {
@@ -239,3 +241,26 @@ it("accepts account plan slugs newer than the pinned protocol", () => {
241 assert.equal(isGetAccountResponse(accountResponse), true);
242 }
243 });
244 +
245 +it("accepts Codex model-request hook runs", () => {
246 + for (const eventName of ["preModelRequest", "postModelRequest"]) {
247 + const notification = {
248 + threadId: "thread-1",
249 + turnId: "turn-1",
250 + run: {
251 + id: `hook-${eventName}`,
252 + eventName,
253 + executionMode: "sync",
254 + handlerType: "command",
255 + scope: "turn",
256 + sourcePath: "/tmp/project/.codex/hooks.json",
257 + startedAt: 1,
258 + status: "stopped",
259 + displayOrder: 0,
260 + entries: [{ kind: "stop", text: "Stop reason supplied by hook" }],
261 + },
262 + };
263 + assert.equal(isHookStartedNotification(notification), true);
264 + assert.equal(isHookCompletedNotification(notification), true);
265 + }
266 +});