diff --git a/src/lib/agent/runtime-recovery-preload.test.ts b/src/lib/agent/runtime-recovery-preload.test.ts index cb51797ff71..ac8279f286b 100644 --- a/src/lib/agent/runtime-recovery-preload.test.ts +++ b/src/lib/agent/runtime-recovery-preload.test.ts @@ -43,8 +43,12 @@ function makeHarness() { hostileMarker: path.join(root, "hostile-proxy-env-sourced"), }; - fs.writeFileSync(paths.sourceSafetyNet, "module.exports = 'trusted safety net';\n"); - fs.writeFileSync(paths.sourceCiao, "module.exports = 'trusted ciao guard';\n"); + fs.writeFileSync(paths.sourceSafetyNet, "module.exports = 'trusted safety net';\n", { + mode: 0o644, + }); + fs.writeFileSync(paths.sourceCiao, "module.exports = 'trusted ciao guard';\n", { + mode: 0o644, + }); return paths; } diff --git a/test/cli/sandbox-status-json.test.ts b/test/cli/sandbox-status-json.test.ts index e1400ad7161..c3f3ffc5603 100644 --- a/test/cli/sandbox-status-json.test.ts +++ b/test/cli/sandbox-status-json.test.ts @@ -471,7 +471,7 @@ describe("CLI sandbox status JSON output", () => { const localBin = path.join(home, "bin"); fs.mkdirSync(localBin, { recursive: true }); writeSandboxRegistry(home, "alpha", { - provider: "openai-api", + provider: "compatible-endpoint", model: "gpt-4o-mini", openshellDriver: "vm", }); @@ -481,7 +481,7 @@ describe("CLI sandbox status JSON output", () => { "#!/usr/bin/env bash", 'if [ "$1" = "inference" ] && [ "$2" = "get" ]; then', " echo 'Gateway inference:'", - " echo ' Provider: openai-api'", + " echo ' Provider: compatible-endpoint'", " echo ' Model: gpt-4o-mini'", " exit 0", "fi", diff --git a/test/helpers/runtime-recovery-preload-test-helpers.ts b/test/helpers/runtime-recovery-preload-test-helpers.ts index 7bc932088cf..4141dcc9aad 100644 --- a/test/helpers/runtime-recovery-preload-test-helpers.ts +++ b/test/helpers/runtime-recovery-preload-test-helpers.ts @@ -21,8 +21,12 @@ export function createRecoveryPreloadHarnessPaths(root: string): RecoveryPreload preloadTmpSafetyNet: path.join(root, "preload-tmp-safety-net.js"), preloadTmpCiao: path.join(root, "preload-tmp-ciao.js"), }; - fs.writeFileSync(paths.preloadSourceSafetyNet, "module.exports = 'trusted safety net';\n"); - fs.writeFileSync(paths.preloadSourceCiao, "module.exports = 'trusted ciao guard';\n"); + fs.writeFileSync(paths.preloadSourceSafetyNet, "module.exports = 'trusted safety net';\n", { + mode: 0o644, + }); + fs.writeFileSync(paths.preloadSourceCiao, "module.exports = 'trusted ciao guard';\n", { + mode: 0o644, + }); return paths; } diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index ddd0b0e8b40..c315b65ec56 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { readFileSync } from "node:fs"; +import { readFileSync, statSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import YAML from "yaml"; @@ -30,6 +30,12 @@ export interface FreeStandingJobsInventory { scenarioToJob: Map; } +type CachedFreeStandingJobsInventory = { + mtimeMs: number; + size: number; + inventory: FreeStandingJobsInventory; +}; + const SELECTOR_PATTERN = /^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$/; const SELECTOR_ID_PATTERN = /^[A-Za-z0-9_-]+$/; const FREE_STANDING_JOB_MARKER = "FREE_STANDING_VITEST_JOB"; @@ -123,10 +129,22 @@ function deriveFreeStandingJobsInventoryFromJobs(jobs: WorkflowRecord): { }; } +const freeStandingJobsInventoryCache = new Map(); + function readWorkflowRecord(workflowPath: string): WorkflowRecord { return asRecord(YAML.parse(readFileSync(workflowPath, "utf-8"))); } +function cloneFreeStandingJobsInventory( + inventory: FreeStandingJobsInventory, +): FreeStandingJobsInventory { + return { + allowedJobs: [...inventory.allowedJobs], + freeStandingScenarios: [...inventory.freeStandingScenarios], + scenarioToJob: new Map(inventory.scenarioToJob), + }; +} + export function validateFreeStandingWorkflowInventory( workflowPath = DEFAULT_VITEST_WORKFLOW_PATH, ): string[] { @@ -137,11 +155,22 @@ export function validateFreeStandingWorkflowInventory( export function readFreeStandingJobsInventory( workflowPath = DEFAULT_VITEST_WORKFLOW_PATH, ): FreeStandingJobsInventory { + const stats = statSync(workflowPath); + const cached = freeStandingJobsInventoryCache.get(workflowPath); + if (cached && cached.mtimeMs === stats.mtimeMs && cached.size === stats.size) { + return cloneFreeStandingJobsInventory(cached.inventory); + } + const workflow = readWorkflowRecord(workflowPath); const { errors, inventory } = deriveFreeStandingJobsInventoryFromJobs(asRecord(workflow.jobs)); if (errors.length > 0) { throw new Error(`Invalid free-standing workflow inventory:\n${errors.join("\n")}`); } + freeStandingJobsInventoryCache.set(workflowPath, { + mtimeMs: stats.mtimeMs, + size: stats.size, + inventory: cloneFreeStandingJobsInventory(inventory), + }); return inventory; } @@ -2479,7 +2508,9 @@ function validateDiagnosticsVitestJob(errors: string[], jobs: WorkflowRecord): v errors.push("diagnostics-vitest job must not expose Docker auth to branch-controlled steps"); } if (jobEnv.E2E_ARTIFACT_DIR !== "${{ github.workspace }}/e2e-artifacts/vitest/diagnostics") { - errors.push("diagnostics-vitest job must write artifacts under e2e-artifacts/vitest/diagnostics"); + errors.push( + "diagnostics-vitest job must write artifacts under e2e-artifacts/vitest/diagnostics", + ); } if (jobEnv.NEMOCLAW_CLI_BIN !== "${{ github.workspace }}/bin/nemoclaw.js") { errors.push("diagnostics-vitest job must point NEMOCLAW_CLI_BIN at the repo CLI"); @@ -2499,7 +2530,12 @@ function validateDiagnosticsVitestJob(errors: string[], jobs: WorkflowRecord): v if (jobEnv.OPENSHELL_GATEWAY !== "nemoclaw") { errors.push("diagnostics-vitest job must force OPENSHELL_GATEWAY=nemoclaw"); } - for (const secret of ["NVIDIA_API_KEY", "DOCKERHUB_USERNAME", "DOCKERHUB_TOKEN", "GITHUB_TOKEN"]) { + for (const secret of [ + "NVIDIA_API_KEY", + "DOCKERHUB_USERNAME", + "DOCKERHUB_TOKEN", + "GITHUB_TOKEN", + ]) { requireEnvDoesNotExposeSecret(errors, "diagnostics-vitest job", jobEnv, secret); } @@ -2534,7 +2570,12 @@ function validateDiagnosticsVitestJob(errors: string[], jobs: WorkflowRecord): v if (!setupNode) errors.push("diagnostics-vitest job missing step: Set up Node"); requireFullShaAction(errors, setupNode, "diagnostics-vitest setup-node"); - const installRootDependencies = requireJobStep(errors, jobName, steps, "Install root dependencies"); + const installRootDependencies = requireJobStep( + errors, + jobName, + steps, + "Install root dependencies", + ); requireRunContains(errors, installRootDependencies, "npm ci --ignore-scripts"); const buildCli = requireJobStep(errors, jobName, steps, "Build CLI");