authorgravatar for 46866023+GuilhermeVieiraDev@users.noreply.github.comGuilherme Vieira <46866023+GuilhermeVieiraDev@users.noreply.github.com> 2026-07-20 09:58:38+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-20 10:58:38+02:00
log33f1cb422461bf0f072b9f181734e9b654d1ca69
treef7ce054177211239fbed999a76fe916dfb88b212
parentd266c068d0e8b8cd168d38cd70b885a7a9e233e2
signature Signed by PGP key B5690EEEBB952194

fix(codex): show web search query and url in tool call details (#2093)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

1 files changed, 10 insertions(+), 3 deletions(-)

apps/server/src/provider/Layers/CodexAdapter.ts+10-3
...@@ -267,8 +267,14 @@ function itemTitle(itemType: CanonicalItemType, item?: CodexLifecycleItem): stri...@@ -267,8 +267,14 @@ function itemTitle(itemType: CanonicalItemType, item?: CodexLifecycleItem): stri
267 }267 }
268}268}
269269
270function itemDetail(item: CodexLifecycleItem): string | undefined {270function itemDetail(itemType: CanonicalItemType, item: CodexLifecycleItem): string | undefined {
271 const itemRecord = item as Record<string, unknown>;
272 const action = itemRecord.action as Record<string, unknown> | undefined;
273 const actionQueries = Array.isArray(action?.queries) ? action.queries : [];
271 const candidates = [274 const candidates = [
275 ...(itemType === "web_search"
276 ? [itemRecord.query, action?.query, ...actionQueries, action?.pattern, action?.url]
277 : []),
272 "command" in item ? item.command : undefined,278 "command" in item ? item.command : undefined,
273 "title" in item ? item.title : undefined,279 "title" in item ? item.title : undefined,
274 "summary" in item ? item.summary : undefined,280 "summary" in item ? item.summary : undefined,
...@@ -276,6 +282,7 @@ function itemDetail(item: CodexLifecycleItem): string | undefined {...@@ -276,6 +282,7 @@ function itemDetail(item: CodexLifecycleItem): string | undefined {
276 "path" in item ? item.path : undefined,282 "path" in item ? item.path : undefined,
277 "prompt" in item ? item.prompt : undefined,283 "prompt" in item ? item.prompt : undefined,
278 ];284 ];
285
279 for (const candidate of candidates) {286 for (const candidate of candidates) {
280 const trimmed = typeof candidate === "string" ? trimText(candidate) : undefined;287 const trimmed = typeof candidate === "string" ? trimText(candidate) : undefined;
281 if (!trimmed) continue;288 if (!trimmed) continue;
...@@ -465,7 +472,7 @@ function mapItemLifecycle(...@@ -465,7 +472,7 @@ function mapItemLifecycle(
465 return undefined;472 return undefined;
466 }473 }
467474
468 const detail = itemDetail(item);475 const detail = itemDetail(itemType, item);
469 const status =476 const status =
470 lifecycle === "item.started"477 lifecycle === "item.started"
471 ? "inProgress"478 ? "inProgress"
...@@ -839,7 +846,7 @@ function mapToRuntimeEvents(...@@ -839,7 +846,7 @@ function mapToRuntimeEvents(
839 }846 }
840 const itemType = toCanonicalItemType(item.type);847 const itemType = toCanonicalItemType(item.type);
841 if (itemType === "plan") {848 if (itemType === "plan") {
842 const detail = itemDetail(item);849 const detail = itemDetail(itemType, item);
843 if (!detail) {850 if (!detail) {
844 return [];851 return [];
845 }852 }