[codex] show complete approval details (#4111)

This commit is contained in:
Maxwell Young authored and GitHub committed 2026-07-20 13:16:57 +02:00
1 parent 946b867666
commit a135f2c2d3
4 files changed
+81 -2

No files matched your search

@@ -0,0 +1,33 @@
import {
EventId,
ProviderDriverKind,
RuntimeRequestId,
ThreadId,
type ProviderRuntimeEvent,
} from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";
import { runtimeEventToActivities } from "./ProviderRuntimeIngestion.ts";
describe("runtimeEventToActivities approval details", () => {
it("preserves complete multiline command details", () => {
const detail = `bun run release -- ${"long-argument ".repeat(20)}\nsecond line`;
const event = {
type: "request.opened",
eventId: EventId.make("evt-request-opened"),
provider: ProviderDriverKind.make("codex"),
createdAt: "2026-07-18T00:00:00.000Z",
threadId: ThreadId.make("thread-1"),
requestId: RuntimeRequestId.make("approval-1"),
payload: {
requestType: "command_execution_approval",
detail,
},
} satisfies ProviderRuntimeEvent;
const [activity] = runtimeEventToActivities(event);
expect(activity?.kind).toBe("approval.requested");
expect((activity?.payload as Record<string, unknown> | undefined)?.detail).toBe(detail);
});
});
@@ -306,7 +306,7 @@ function requestKindFromCanonicalRequestType(
}
}
function runtimeEventToActivities(
export function runtimeEventToActivities(
event: ProviderRuntimeEvent,
taskTitle?: string,
): ReadonlyArray<OrchestrationThreadActivity> {
@@ -340,7 +340,7 @@ function runtimeEventToActivities(
requestId: toApprovalRequestId(event.requestId),
...(requestKind ? { requestKind } : {}),
requestType: event.payload.requestType,
...(event.payload.detail ? { detail: truncateDetail(event.payload.detail) } : {}),
...(event.payload.detail ? { detail: event.payload.detail } : {}),
},
turnId: toTurnId(event.turnId) ?? null,
...maybeSequence,