From da52d685e5cefd1ea9f54804e310fab3e42b209c Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Sun, 21 Jun 2026 14:28:38 +0800 Subject: [PATCH] fix: expose tool call summaries in otel (#216) --- src/backend/codex-stdio.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/backend/codex-stdio.ts b/src/backend/codex-stdio.ts index 0abd9e7..d25cf2f 100644 --- a/src/backend/codex-stdio.ts +++ b/src/backend/codex-stdio.ts @@ -1510,16 +1510,22 @@ function toolCallSummaryFromNotification(message: JsonRecord): JsonRecord | null const item = asRecordAt(asRecordAt(message, "params"), "item"); const itemType = typeof item.type === "string" ? item.type : "unknown"; if (!isVisibleCodexToolItemType(itemType)) return null; - const command = toolCallCommandSummary(item, itemType, toolCallName(item, itemType)); + const redacted = redactJson(item); + const command = toolCallCommandSummary(redacted, itemType, toolCallName(redacted, itemType)); + const outputSummary = toolCallOutputSummary(redacted); return { method, - itemId: stringAt(item, "id"), + itemId: stringAt(redacted, "id"), itemType, - toolName: toolCallName(item, itemType), + toolName: toolCallName(redacted, itemType), status: toolCallStatus(method, item), - exitCode: typeof item.exitCode === "number" ? item.exitCode : null, - durationMs: typeof item.durationMs === "number" ? item.durationMs : null, + exitCode: typeof redacted.exitCode === "number" ? redacted.exitCode : null, + durationMs: typeof redacted.durationMs === "number" ? redacted.durationMs : null, + cwd: typeof redacted.cwd === "string" ? redacted.cwd : null, + processId: typeof redacted.processId === "string" || typeof redacted.processId === "number" ? String(redacted.processId) : null, + command: command ? String(boundedTextSummary(command, { limitChars: 600 }).text) : null, commandFingerprint: command ? shortHash(command) : null, + outputSummary: outputSummary ? String(boundedTextSummary(outputSummary, { limitChars: 600 }).text) : null, valuesPrinted: false, }; }