From cbf4f3a2b0cffe3fcf0ba068fa2029142e03069a Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Wed, 15 Jul 2026 12:49:16 -0400 Subject: [PATCH] Handle absent tool observability during upload --- .github/scripts/run-agent-task/prepare-agent-task-upload.mjs | 2 +- tests/execute-native-agent-task-playground-e2e.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/run-agent-task/prepare-agent-task-upload.mjs b/.github/scripts/run-agent-task/prepare-agent-task-upload.mjs index 368057ce..97d52a29 100644 --- a/.github/scripts/run-agent-task/prepare-agent-task-upload.mjs +++ b/.github/scripts/run-agent-task/prepare-agent-task-upload.mjs @@ -218,7 +218,7 @@ function projectParsed(value) { tool_results: results.slice(0, MAX_TRANSCRIPT_EXECUTIONS).map(projectToolCall), errors: errors.slice(0, MAX_TRANSCRIPT_EXECUTIONS).flatMap((error) => boundedText(record(error).message ?? error) ? [boundedText(record(error).message ?? error)] : []), tool_observability: toolObservability, - }).filter(([, item]) => Array.isArray(item) ? item.length > 0 : Object.keys(item).length > 0)) + }).filter(([, item]) => item !== undefined && (Array.isArray(item) ? item.length > 0 : Object.keys(item).length > 0))) } // This is deliberately limited to the public Agents API summary. Tool payloads diff --git a/tests/execute-native-agent-task-playground-e2e.test.ts b/tests/execute-native-agent-task-playground-e2e.test.ts index ee9b88b9..f1b4d433 100644 --- a/tests/execute-native-agent-task-playground-e2e.test.ts +++ b/tests/execute-native-agent-task-playground-e2e.test.ts @@ -90,6 +90,7 @@ add_filter( 'pre_http_request', static function( $preempt, $args, $url ) { assert.equal(exclusions.canonical_transcripts.length, 1, "available canonical evidence is projected once") assert.match(exclusions.canonical_transcripts[0].provenance.artifact_path, /^runtime-[a-z0-9-]+\/files\/transcript\.json$/) const staged = JSON.stringify(await Promise.all((await readdir(join(workspace, ".codebox", "agent-task-upload"), { recursive: true })).map((path) => readFile(join(workspace, ".codebox", "agent-task-upload", path), "utf8").catch(() => "")))) + assert.doesNotMatch(staged, /"tool_observability"/, "absent optional tool observability is omitted during upload staging") for (const privateValue of ["wp-codebox-runner-workspace-seed-", workspace, "PRIVATE_WORKSPACE_SENTINEL", "PRIVATE_NPM_SENTINEL", "PRIVATE_NETRC_SENTINEL", "PRIVATE_KEY_SENTINEL"]) assert.doesNotMatch(staged, new RegExp(privateValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))) const stagedInput = JSON.parse(await readFile(join(workspace, ".codebox", "agent-task-upload", ".codebox", "native-agent-task-input.json"), "utf8")) assert.deepEqual(stagedInput.task_input.workspaces[0].seed, { kind: "runner-workspace-seed", digest: seedProvenance.digest.sha256, files: 2, bytes: seedProvenance.bytes, excludes: seedProvenance.excludes, excluded: seedProvenance.excluded })