

























@@ -928,6 +928,85 @@ describe("CodexAppServerEventProjector", () => {
928928expect(toolResultContentItem.content).toBe("ok");
929929});
930930931+it("orders declined native tool diagnostics after their start event", async () => {
932+const projector = await createProjector();
933+const diagnosticEvents: DiagnosticEventPayload[] = [];
934+const unsubscribe = onInternalDiagnosticEvent((event) => diagnosticEvents.push(event));
935+936+try {
937+await projector.handleNotification(
938+forCurrentTurn("item/started", {
939+item: {
940+type: "commandExecution",
941+id: "cmd-declined",
942+command: "pnpm test extensions/codex",
943+cwd: "/workspace",
944+processId: null,
945+source: "agent",
946+status: "inProgress",
947+commandActions: [],
948+aggregatedOutput: null,
949+exitCode: null,
950+durationMs: null,
951+},
952+}),
953+);
954+await projector.handleNotification(
955+forCurrentTurn("item/completed", {
956+item: {
957+type: "commandExecution",
958+id: "cmd-declined",
959+command: "pnpm test extensions/codex",
960+cwd: "/workspace",
961+processId: null,
962+source: "agent",
963+status: "declined",
964+commandActions: [],
965+aggregatedOutput: null,
966+exitCode: null,
967+durationMs: 1,
968+},
969+}),
970+);
971+await flushDiagnosticEvents();
972+} finally {
973+unsubscribe();
974+}
975+976+const toolDiagnosticEvents = diagnosticEvents.filter(
977+(
978+event,
979+): event is Extract<
980+DiagnosticEventPayload,
981+{
982+type:
983+| "tool.execution.started"
984+| "tool.execution.completed"
985+| "tool.execution.error"
986+| "tool.execution.blocked";
987+}
988+> => event.type.startsWith("tool.execution."),
989+);
990+expect(
991+toolDiagnosticEvents.map((event) => ({
992+type: event.type,
993+toolName: event.toolName,
994+toolCallId: event.toolCallId,
995+})),
996+).toEqual([
997+{
998+type: "tool.execution.started",
999+toolName: "bash",
1000+toolCallId: "cmd-declined",
1001+},
1002+{
1003+type: "tool.execution.blocked",
1004+toolName: "bash",
1005+toolCallId: "cmd-declined",
1006+},
1007+]);
1008+});
1009+9311010it("records dynamic OpenClaw tool calls in mirrored transcript snapshots", async () => {
9321011const projector = await createProjector();
9331012此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。