restore streaming notifications from codex app server
This commit is contained in:
2 files changed
-108
No files matched your search
@@ -350,94 +350,3 @@ describe("thread checkpoint control", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("notification forwarding", () => {
|
||||
it("suppresses streamed assistant message notifications", () => {
|
||||
const manager = new CodexAppServerManager();
|
||||
const emittedMethods: string[] = [];
|
||||
manager.on("event", (event) => {
|
||||
emittedMethods.push(event.method);
|
||||
});
|
||||
|
||||
const context = {
|
||||
session: {
|
||||
sessionId: "sess_1",
|
||||
provider: "codex",
|
||||
status: "running",
|
||||
threadId: "thread_1",
|
||||
createdAt: "2026-02-10T00:00:00.000Z",
|
||||
updatedAt: "2026-02-10T00:00:00.000Z",
|
||||
},
|
||||
};
|
||||
|
||||
const handleServerNotification = (
|
||||
manager as unknown as {
|
||||
handleServerNotification: (
|
||||
context: unknown,
|
||||
notification: { method: string; params?: unknown },
|
||||
) => void;
|
||||
}
|
||||
).handleServerNotification.bind(manager);
|
||||
|
||||
handleServerNotification(context, {
|
||||
method: "item/agentMessage/delta",
|
||||
params: {
|
||||
itemId: "item_msg_1",
|
||||
delta: "Partial text",
|
||||
},
|
||||
});
|
||||
handleServerNotification(context, {
|
||||
method: "item/started",
|
||||
params: {
|
||||
item: {
|
||||
id: "item_msg_1",
|
||||
type: "agentMessage",
|
||||
text: "Working...",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(emittedMethods).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps completed assistant message notifications", () => {
|
||||
const manager = new CodexAppServerManager();
|
||||
const emittedMethods: string[] = [];
|
||||
manager.on("event", (event) => {
|
||||
emittedMethods.push(event.method);
|
||||
});
|
||||
|
||||
const context = {
|
||||
session: {
|
||||
sessionId: "sess_1",
|
||||
provider: "codex",
|
||||
status: "running",
|
||||
threadId: "thread_1",
|
||||
createdAt: "2026-02-10T00:00:00.000Z",
|
||||
updatedAt: "2026-02-10T00:00:00.000Z",
|
||||
},
|
||||
};
|
||||
|
||||
const handleServerNotification = (
|
||||
manager as unknown as {
|
||||
handleServerNotification: (
|
||||
context: unknown,
|
||||
notification: { method: string; params?: unknown },
|
||||
) => void;
|
||||
}
|
||||
).handleServerNotification.bind(manager);
|
||||
|
||||
handleServerNotification(context, {
|
||||
method: "item/completed",
|
||||
params: {
|
||||
item: {
|
||||
id: "item_msg_1",
|
||||
type: "agentMessage",
|
||||
text: "Final response",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(emittedMethods).toEqual(["item/completed"]);
|
||||
});
|
||||
});
|
||||
@@ -584,10 +584,6 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
context: CodexSessionContext,
|
||||
notification: JsonRpcNotification,
|
||||
): void {
|
||||
if (this.shouldSuppressNotification(notification)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const route = this.readRouteFields(notification.params);
|
||||
const textDelta =
|
||||
notification.method === "item/agentMessage/delta"
|
||||
@@ -648,19 +644,6 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
}
|
||||
}
|
||||
|
||||
private shouldSuppressNotification(notification: JsonRpcNotification): boolean {
|
||||
if (notification.method === "item/agentMessage/delta") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (notification.method !== "item/started") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const itemType = this.readString(this.readObject(notification.params, "item"), "type");
|
||||
return itemType === "agentMessage";
|
||||
}
|
||||
|
||||
private handleServerRequest(context: CodexSessionContext, request: JsonRpcRequest): void {
|
||||
const route = this.readRouteFields(request.params);
|
||||
const requestKind = this.requestKindForMethod(request.method);
|
||||
|
||||
Reference in new issue
Block a user