ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(pixel): answer free GPU memory from the host (#8285)
Mike Bradley99791d09a52d
diff --git a/ods/extensions/services/pixel-agent/host/system_observe.py b/ods/extensions/services/pixel-agent/host/system_observe.pyindex 0c85a54df..39238ab35 100644--- a/ods/extensions/services/pixel-agent/host/system_observe.py+++ b/ods/extensions/services/pixel-agent/host/system_observe.py@@ -99,27 +99,12 @@ def observe_gpu() -> dict:result = _run([executable,- "--query-gpu=name,memory.total,driver_version",+ "--query-gpu=name,memory.total,memory.used,memory.free,driver_version","--format=csv,noheader,nounits",])if result and result.returncode == 0 and not result.stderr.strip():- for line in result.stdout.splitlines()[:16]:- fields = [field.strip() for field in line.split(",")]- if len(fields) != 3 or not SAFE_NAME.fullmatch(fields[0]) or not SAFE_VERSION.fullmatch(fields[2]):- devices = []- break- try:- memory_mib = int(fields[1])- except ValueError:- devices = []- break- if not 1 <= memory_mib <= 10_000_000:- devices = []- break- devices.append(- {"name": fields[0], "memoryMiB": memory_mib, "driver": fields[2]}- )+ devices = _nvidia_devices(result.stdout.splitlines()[:16])return {"schemaVersion": 1,"kind": "ods-host-gpu",@@ -129,6 +114,50 @@ def observe_gpu() -> dict:}+NOT_REPORTED = frozenset({"[N/A]", "N/A", "[Not Supported]", "Not Supported"})+++def _nvidia_devices(lines: Sequence[str]) -> list[dict]:+ """nvidia-smi rows as devices, or none when any row is unexpected.++ A GPU whose memory is not reported beside GPUs that report theirs is not a+ GPU for ODS (Windows on Arm lists an NVIDIA NPU that way) and is left out.+ When no row reports memory, the GPUs share system RAM (GB10, GB200). Both+ follow installers/lib/detection.sh.+ """+ rows: list[tuple[list[str], int | None]] = []+ for line in lines:+ fields = [field.strip() for field in line.split(",")]+ if len(fields) != 5 or not SAFE_NAME.fullmatch(fields[0]) or not SAFE_VERSION.fullmatch(fields[4]):+ return []+ if fields[1] in NOT_REPORTED:+ rows.append((fields, None))+ continue+ try:+ memory_mib = int(fields[1])+ except ValueError:+ return []+ if not 1 <= memory_mib <= 10_000_000:+ return []+ rows.append((fields, memory_mib))+ sized = [row for row in rows if row[1] is not None]+ devices: list[dict] = []+ for fields, memory_mib in sized or rows:+ if memory_mib is None:+ devices.append({"name": fields[0], "unifiedMemory": True, "driver": fields[4]})+ continue+ device = {"name": fields[0], "memoryMiB": memory_mib, "driver": fields[4]}+ # Live use at the time of the check, so "how much GPU memory is free"+ # has a host answer. A driver that reports [N/A] for either, or a+ # figure above the total, keeps the device without them.+ if fields[2].isdecimal() and fields[3].isdecimal():+ used, free = int(fields[2]), int(fields[3])+ if used <= memory_mib and free <= memory_mib:+ device.update(memoryUsedMiB=used, memoryFreeMiB=free)+ devices.append(device)+ return devices++def observe_metal() -> dict:devices = []executable = _trusted_executable(["/usr/sbin/system_profiler"])diff --git a/ods/extensions/services/pixel-agent/plugin/host-observe.mjs b/ods/extensions/services/pixel-agent/plugin/host-observe.mjsindex 8ac49bee4..45ad6fad4 100644--- a/ods/extensions/services/pixel-agent/plugin/host-observe.mjs+++ b/ods/extensions/services/pixel-agent/plugin/host-observe.mjs@@ -342,7 +342,7 @@ export function createHostObserveTool({return {name: "pixel_ods_host_observe",description:- "Read selected ODS host facts through the external Operations Broker and return their receipt. Use it for questions about this machine, such as its GPUs, memory, storage or services: your sandbox sees only its own container and no GPUs. Choose the typed host.* actions useful for this task, respecting the owner's exclusions. You can gather more facts in later calls. If a read times out, check its existing job ID before retrying. host.network-peer may resolve and probe one owner-named private LAN or Tailscale peer with bounded ports. This tool cannot scan a range, authenticate, execute commands, mutate a host, or approve plans.",+ "Read selected ODS host facts through the external Operations Broker and return their receipt. Use it for questions about this machine, such as its GPUs (host.gpu includes each GPU's free memory), RAM, storage or services: your sandbox sees only its own container and no GPUs. Choose the typed host.* actions useful for this task, respecting the owner's exclusions. You can gather more facts in later calls. If a read times out, check its existing job ID before retrying. host.network-peer may resolve and probe one owner-named private LAN or Tailscale peer with bounded ports. This tool cannot scan a range, authenticate, execute commands, mutate a host, or approve plans.",parameters: {type: "object",additionalProperties: false,diff --git a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjsindex 3d8f24047..a280181b2 100644--- a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs+++ b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs@@ -2641,6 +2641,7 @@ function gpuEvidence(step) {return undefined;}const devices = [];+ const measured = { count: 0, totalMiB: 0, freeMiB: 0 };for (const device of value.devices) {if (value.backend === "metal") {if (!exactKeys(device, ["metal", "name"])) return undefined;@@ -2649,13 +2650,33 @@ function gpuEvidence(step) {devices.push(`${name} (${device.metal})`);continue;}- if (!exactKeys(device, ["driver", "memoryMiB", "name"])) return undefined;+ // Free and in-use memory are present when the driver reports them, and a+ // unified-memory GPU (GB10, GB200) has no memory of its own to report+ // (host/system_observe.py).+ const live = exactKeys(device, ["driver", "memoryFreeMiB", "memoryMiB", "memoryUsedMiB", "name"]);+ const unified = exactKeys(device, ["driver", "name", "unifiedMemory"]);+ if (!live && !unified && !exactKeys(device, ["driver", "memoryMiB", "name"])) return undefined;const name = cleanSingleLine(device.name, /^[A-Za-z0-9][A-Za-z0-9 ._+()/@-]{0,95}$/, 96);const driver = cleanSingleLine(device.driver, /^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/, 64);- if (!name || !driver || !Number.isInteger(device.memoryMiB) || device.memoryMiB < 1 || device.memoryMiB > 10_000_000) {+ if (!name || !driver) return undefined;+ if (unified) {+ if (device.unifiedMemory !== true) return undefined;+ devices.push(`${name} (unified memory shared with system RAM; driver ${driver})`);+ continue;+ }+ if (!Number.isInteger(device.memoryMiB) || device.memoryMiB < 1 || device.memoryMiB > 10_000_000) return undefined;+ if (live && [device.memoryFreeMiB, device.memoryUsedMiB].some((mib) =>+ !Number.isInteger(mib) || mib < 0 || mib > device.memoryMiB)) {return undefined;}- devices.push(`${name} (${device.memoryMiB} MiB; driver ${driver})`);+ if (live) {+ measured.count += 1;+ measured.totalMiB += device.memoryMiB;+ measured.freeMiB += device.memoryFreeMiB;+ }+ devices.push(live+ ? `${name} (${device.memoryMiB} MiB total, ${device.memoryFreeMiB} MiB free, ${device.memoryUsedMiB} MiB in use; driver ${driver})`+ : `${name} (${device.memoryMiB} MiB; driver ${driver})`);}if (value.available !== (devices.length > 0)) return undefined;if (!value.available && (value.backend !== "unavailable" || devices.length > 0)) return undefined;@@ -2663,8 +2684,14 @@ function gpuEvidence(step) {if (value.available && value.backend === "metal") {return `GPU capability: ${devices.join("; ")}. Runtime Metal utilization was not measured. Device identifiers and serial numbers are omitted.`;}+ // Every GPU measured, two or more: the sums, so a reply copies them instead of+ // adding (Workstation06, 2026-10-27: "519.2 GiB free out of 346.2 GiB total").+ const together = measured.count >= 2 && measured.count === devices.length+ ? ` Together: ${measured.freeMiB} MiB free of ${measured.totalMiB} MiB ` ++ `(${formatHostBytes(measured.freeMiB * 1024 ** 2)} free of ${formatHostBytes(measured.totalMiB * 1024 ** 2)}).`+ : "";return value.available- ? `GPU: ${devices.join("; ")}. Device identifiers and serial numbers are omitted.`+ ? `GPU: ${devices.join("; ")}.${together}${measured.count ? " Free and in-use memory are as of this check." : ""} Device identifiers and serial numbers are omitted.`: "GPU telemetry is unavailable through the bounded host observer.";}@@ -3094,28 +3121,30 @@ function operationsHostEvidenceText(if (!value || osRelease.stderr.trim() || osRelease.riskSignals.length > 0) return undefined;lines.push(`- Operating system: \`${value}\` (job \`${osRelease.jobId}\`)`);}+ // Each renderer's text names its own fact ("Memory: ...", "GPU: ..."), so a+ // line carries no second label (Workstation06, 2026-10-27: "- Memory: Memory: ...").const renderers = [- ["host.uptime", "Uptime and load", uptimeEvidence],- ["host.cpu", "Hardware", cpuEvidence],- ["host.gpu", "GPU", gpuEvidence],- ["host.memory", "Memory", memoryEvidence],- ["host.storage", "Storage", storageEvidence],- ["host.processes", "Processes", processEvidence],- ["host.services", "Services", serviceEvidence],- ["host.network-addresses", "Addresses", networkAddressEvidence],- ["host.network-routes", "Routes", networkRouteEvidence],- ["host.listening-ports", "Listening ports", listeningPortEvidence],- ["host.tailscale", "Tailscale", tailscaleEvidence],- ["host.network-peer", "Network peer", networkPeerEvidence],+ ["host.uptime", uptimeEvidence],+ ["host.cpu", cpuEvidence],+ ["host.gpu", gpuEvidence],+ ["host.memory", memoryEvidence],+ ["host.storage", storageEvidence],+ ["host.processes", processEvidence],+ ["host.services", serviceEvidence],+ ["host.network-addresses", networkAddressEvidence],+ ["host.network-routes", networkRouteEvidence],+ ["host.listening-ports", listeningPortEvidence],+ ["host.tailscale", tailscaleEvidence],+ ["host.network-peer", networkPeerEvidence],];- for (const [action, label, renderer] of renderers) {+ for (const [action, renderer] of renderers) {const step = steps.get(action);if (!step) continue;const observations = action === "host.network-peer" && peerSteps.length ? peerSteps : [step];for (const observation of observations) {const value = renderer(observation);if (!value) return undefined;- lines.push(`- ${label}: ${value} (job \`${observation.jobId}\`)`);+ lines.push(`- ${value} (job \`${observation.jobId}\`)`);}}if (odsAppsProjection) {@@ -5190,10 +5219,10 @@ const HOST_OBSERVATION_FACETS = new Map([["host.uptime", "uptime|load averages?|system load"],["host.processes", "process|processes|process inventory"],["host.services", "systemd|system services?|service inventory"],- ["host.cpu", "cpu|processor|hardware"],- ["host.gpu", "gpu|graphics(?:\\s+(?:card|processor))?|video\\s+card"],+ ["host.cpu", "cpus?|processors?|hardware"],+ ["host.gpu", "gpus?|graphics(?:\\s+(?:cards?|processors?))?|video\\s+cards?"],["host.memory", "memory|ram|swap"],- ["host.storage", "disk|filesystem|storage|mounts?"],+ ["host.storage", "disks?|filesystems?|storage|mounts?"],["host.network-addresses", "network interfaces?|interfaces?|addresses?|ip addresses?"],["host.network-routes", "routes?|routing"],["host.listening-ports", "ports?|listeners?"],@@ -5885,10 +5914,10 @@ export function userMessageOperationsRequirements(messages, prompt = undefined)/\b(?:hostname|host identity|kernel|machine architecture|architecture|cpu architecture|host platform|operating[- ]system(?: signature)?|(?:host\s+)?os(?:\s+(?:signature|release))?|linux distribution|distro|uptime|load averages?|system load)\b/i,/\b(?:process|processes|process inventory)\b/i,/\b(?:systemd|system services?|service inventory)\b/i,- /\b(?:cpu|processor|hardware)\b/i,- /\b(?:gpu|graphics(?:\s+(?:card|processor))?|video\s+card)\b/i,+ /\b(?:cpus?|processors?|hardware)\b/i,+ /\b(?:gpus?|graphics(?:\s+(?:cards?|processors?))?|video\s+cards?)\b/i,/\b(?:memory|ram|swap)\b/i,- /\b(?:disk|filesystem|storage|mounts?)\b/i,+ /\b(?:disks?|filesystems?|storage|mounts?)\b/i,/\b(?:network|interfaces?|addresses?|ip addresses?|routes?|routing|ports?|listeners?)\b/i,/\btailscale\b/i,];@@ -5974,7 +6003,7 @@ export function userMessageOperationsRequirements(messages, prompt = undefined)!networkDiscoveryClause(clause) && !artifactOrExplanation.test(clause) &&!negatedObservationClause(clause) && !/^\s*(?:but\s+)?no\b/i.test(clause));const hardwareOverviewIntent = hostContext &&- !/\b(?:cpu|processor|gpu|graphics|video\s+card|memory|ram|swap|disk|filesystem|storage|mounts?)\b/i.test(hardwareRequestClauses.join(" ")) &&+ !/\b(?:cpus?|processors?|gpus?|graphics|video\s+cards?|memory|ram|swap|disks?|filesystems?|storage|mounts?)\b/i.test(hardwareRequestClauses.join(" ")) &&hardwareRequestClauses.some((clause) =>/\b(?:hardware|specs?|specifications?|components?)\b/i.test(clause) &&/\b(?:what|which|tell|show|report|describe|list|give|get|check|inspect)\b/i.test(clause) &&@@ -6023,16 +6052,16 @@ export function userMessageOperationsRequirements(messages, prompt = undefined)if (broadHostExploration || (hostContext && /\b(?:systemd|(?:system\s+)?services?|service inventory)\b/i.test(localHostFacetText))) {actions.push("host.services");}- if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:cpu|processor|hardware)\b/i.test(hostText))) {+ if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:cpus?|processors?|hardware)\b/i.test(hostText))) {actions.push("host.cpu");}- if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:gpu|graphics(?:\s+(?:card|processor))?|video\s+card)\b/i.test(hostText))) {+ if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:gpus?|graphics(?:\s+(?:cards?|processors?))?|video\s+cards?)\b/i.test(hostText))) {actions.push("host.gpu");}if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:memory|ram|swap)\b/i.test(hostText))) {actions.push("host.memory");}- if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:disk|filesystem|storage|mounts?)\b/i.test(hostText))) {+ if (broadHostExploration || hardwareOverviewIntent || (hostContext && /\b(?:disks?|filesystems?|storage|mounts?)\b/i.test(hostText))) {actions.push("host.storage");}if (broadHostExploration || networkDiscoveryRequested || localNetworkOverview || (hostContext && (networkInterfaceObservation || /\b(?:addresses?|ip addresses?)\b/i.test(hostText)))) {diff --git a/ods/extensions/services/pixel-agent/tests/host_device_observation_intent.test.mjs b/ods/extensions/services/pixel-agent/tests/host_device_observation_intent.test.mjsindex a55310997..64011c8ed 100644--- a/ods/extensions/services/pixel-agent/tests/host_device_observation_intent.test.mjs+++ b/ods/extensions/services/pixel-agent/tests/host_device_observation_intent.test.mjs@@ -67,6 +67,32 @@ for (const [facet,action] of [});}+// Workstation06, 2026-10-27: "the GPUs in this machine" required only+// host.memory, and plural CPUs, processors and disks required no host fact.+for (const [prompt, actions] of [+ ['How much free memory do the GPUs in this machine have right now?', ['host.gpu', 'host.memory']],+ ['How many CPUs does this machine have?', ['host.cpu']],+ ['What processors does this computer have?', ['host.cpu']],+ ['How much space is left on the disks of this machine?', ['host.storage']],+ ['Which video cards are in this computer?', ['host.gpu']],+]) {+ test('plural hardware nouns keep their host facet: ' + prompt, () => {+ assert.deepEqual(api.userMessageOperationsRequirements([], prompt), {required: true, actions});+ });+}++for (const prompt of ['Write a script that lists GPUs.', 'Explain what GPUs are.']) {+ test('plural hardware nouns outside a host request need no host work: ' + prompt, () => {+ assert.equal(api.userMessageOperationsRequirements([], prompt).required, false);+ });+}++test('an excluded plural facet stays excluded', () => {+ assert.deepEqual(api.userMessageOperationsRequirements([],+ 'Report the CPU and memory of this machine, but do not report the GPUs.'),+ {required: true, actions: ['host.cpu', 'host.memory']});+});+for (const device of ['Mac', 'MacBook', 'Mac Mini', 'computer', 'laptop']) {test('exact commands on ' + device + ' retain immutable approval', () => {const prompt = 'Run ' + quote + 'hostname' + quote + ' on this ' + device + '.';diff --git a/ods/extensions/services/pixel-agent/tests/test_system_observe.py b/ods/extensions/services/pixel-agent/tests/test_system_observe.pyindex bd6fb302c..090f03968 100644--- a/ods/extensions/services/pixel-agent/tests/test_system_observe.py+++ b/ods/extensions/services/pixel-agent/tests/test_system_observe.py@@ -124,17 +124,22 @@ class SystemObserveTests(unittest.TestCase):def test_gpu_output_is_bounded_and_omits_device_identifiers(self):result = mock.Mock(returncode=0,- stdout="NVIDIA GeForce RTX 5070 Laptop GPU, 8151, 573.22\n",+ stdout="NVIDIA GeForce RTX 5070 Laptop GPU, 8151, 1203, 6687, 573.22\n",stderr="",)with mock.patch.object(system_observe, "_trusted_executable", return_value="/usr/bin/nvidia-smi") as trusted, \- mock.patch.object(system_observe, "_run", return_value=result):+ mock.patch.object(system_observe, "_run", return_value=result) as run:value = system_observe.observe_gpu()trusted.assert_called_once_with(["/usr/lib/wsl/lib/nvidia-smi","/usr/bin/nvidia-smi","/usr/local/bin/nvidia-smi",])+ run.assert_called_once_with([+ "/usr/bin/nvidia-smi",+ "--query-gpu=name,memory.total,memory.used,memory.free,driver_version",+ "--format=csv,noheader,nounits",+ ])self.assertEqual(value,{@@ -145,6 +150,8 @@ class SystemObserveTests(unittest.TestCase):"devices": [{"name": "NVIDIA GeForce RTX 5070 Laptop GPU","memoryMiB": 8151,+ "memoryUsedMiB": 1203,+ "memoryFreeMiB": 6687,"driver": "573.22",}],},@@ -152,6 +159,42 @@ class SystemObserveTests(unittest.TestCase):self.assertNotIn("uuid", str(value).lower())self.assertNotIn("serial", str(value).lower())+ def test_gpu_without_live_memory_keeps_the_device(self):+ # A driver that cannot report use prints [N/A]; an impossible figure is+ # not reported either. The device and its total stay.+ result = mock.Mock(+ returncode=0,+ stdout="NVIDIA A100-SXM4-40GB, 40960, [N/A], [N/A], 550.54.15\nNVIDIA L4, 23034, 30000, 0, 550.54.15\n",+ stderr="",+ )+ with mock.patch.object(system_observe, "_trusted_executable", return_value="/usr/bin/nvidia-smi"), \+ mock.patch.object(system_observe, "_run", return_value=result):+ value = system_observe.observe_gpu()+ self.assertTrue(value["available"])+ self.assertEqual(value["devices"], [+ {"name": "NVIDIA A100-SXM4-40GB", "memoryMiB": 40960, "driver": "550.54.15"},+ {"name": "NVIDIA L4", "memoryMiB": 23034, "driver": "550.54.15"},+ ])++ def test_unified_memory_gpu_is_reported_and_a_memoryless_row_beside_gpus_is_not(self):+ # GB10 and GB200 share system RAM and report [N/A] for memory; such a+ # row beside a GPU with memory is not a GPU (installers/lib/detection.sh).+ cases = [+ ("NVIDIA GB10, [N/A], [N/A], [N/A], 580.95.05\n",+ [{"name": "NVIDIA GB10", "unifiedMemory": True, "driver": "580.95.05"}]),+ ("NVIDIA RTX PRO 500 Blackwell, 6144, 300, 5700, 581.42\nNVIDIA NPU, [N/A], [N/A], [N/A], 581.42\n",+ [{"name": "NVIDIA RTX PRO 500 Blackwell", "memoryMiB": 6144, "memoryUsedMiB": 300,+ "memoryFreeMiB": 5700, "driver": "581.42"}]),+ ]+ for stdout, devices in cases:+ result = mock.Mock(returncode=0, stdout=stdout, stderr="")+ with mock.patch.object(system_observe, "_trusted_executable", return_value="/usr/bin/nvidia-smi"), \+ mock.patch.object(system_observe, "_run", return_value=result):+ value = system_observe.observe_gpu()+ self.assertTrue(value["available"], stdout)+ self.assertEqual(value["backend"], "nvidia")+ self.assertEqual(value["devices"], devices)+def test_gpu_parser_fails_closed_on_unexpected_output(self):result = mock.Mock(returncode=0, stdout="GPU, 123, driver, extra\n", stderr="")with mock.patch.object(system_observe, "_trusted_executable", return_value="/usr/bin/nvidia-smi"), \diff --git a/ods/extensions/services/pixel-agent/tests/tool_loop_guard.test.mjs b/ods/extensions/services/pixel-agent/tests/tool_loop_guard.test.mjsindex 427286d21..b1758d067 100644--- a/ods/extensions/services/pixel-agent/tests/tool_loop_guard.test.mjs+++ b/ods/extensions/services/pixel-agent/tests/tool_loop_guard.test.mjs@@ -7047,6 +7047,67 @@ test("space-bearing process names do not admit markup or control characters", ()}});+// Workstation06, 2026-10-27: asked how much GPU memory was free, the agent got+// only totals from host.gpu, tried nine sandbox commands, and could not answer.+// Each host line also repeated its label ("- Memory: Memory: ...").+function hostGpuMemoryReply(devices) {+ const guard = createToolLoopGuard();+ const jobId = "ops-1234567890123-abcdef123456";+ guard.observeRun({agentId:"pixel",runId:"run-1",sessionId:"session-1"}, "pixel",+ {prompt:"How much free memory do the GPUs in this machine have right now?"});+ afterCall(guard, "pixel_ops_workflow_submit", {event:{+ params:{steps:[{id:"gpu",target:"ods-host",action:"host.gpu"},{id:"memory",target:"ods-host",action:"host.memory"}]},+ result:{details:{jobId,status:"submitted",kind:"workflow"}},+ }});+ const step = (stepId, action, stdout) => ({stepId,target:"ods-host",action,exitCode:0,stderr:"",+ outputTruncated:{stdout:false,stderr:false},riskSignals:[],stdout});+ afterCall(guard, "pixel_ops_job_wait", {event:{params:{jobId},result:{details:{+ jobId,status:"succeeded",waitTimedOut:false,+ steps:[+ step("gpu", "host.gpu", JSON.stringify({schemaVersion:1,kind:"ods-host-gpu",available:true,backend:"nvidia",devices})),+ step("memory", "host.memory", "total used free shared buff/cache available\nMem: 17179869184 8589934592 1073741824 0 7516192768 8589934592\nSwap: 4294967296 0 4294967296\n"),+ ],+ }}}});+ return reply(guard)?.payload?.text;+}++test("NVIDIA host evidence names each GPU's free and in-use memory, once per line", () => {+ const text = hostGpuMemoryReply([+ {name:"NVIDIA RTX PRO 6000 Blackwell Workstation Edition",memoryMiB:97887,memoryUsedMiB:13247,memoryFreeMiB:84018,driver:"610.57.04"},+ {name:"NVIDIA GB300",memoryMiB:256703,memoryUsedMiB:12837,memoryFreeMiB:242945,driver:"610.57.04"},+ ]);+ assert.match(text, new RegExp("\\n- GPU: NVIDIA RTX PRO 6000 Blackwell Workstation Edition \\(97887 MiB total, 84018 MiB free, " ++ "13247 MiB in use; driver 610\\.57\\.04\\); NVIDIA GB300 \\(256703 MiB total, 242945 MiB free, 12837 MiB in use; " ++ "driver 610\\.57\\.04\\)\\. Together: 326963 MiB free of 354590 MiB \\(319\\.3 GiB free of 346\\.3 GiB\\)\\. " ++ "Free and in-use memory are as of this check\\. Device identifiers"));+ assert.match(text, /\n- Memory: 8\.00 GiB used of 16\.0 GiB/);+ assert.doesNotMatch(text, /GPU: GPU:|Memory: Memory:/);+});++test("NVIDIA host evidence without live use keeps the totals; impossible live figures fail closed", () => {+ const total = {name:"NVIDIA GeForce RTX 5070 Laptop GPU",memoryMiB:8151,driver:"573.22"};+ const text = hostGpuMemoryReply([total]);+ assert.match(text, /\n- GPU: NVIDIA GeForce RTX 5070 Laptop GPU \(8151 MiB; driver 573\.22\)\. Device identifiers/);+ assert.doesNotMatch(text, /as of this check|Together/);+ // One GPU is its own total; a GPU without live figures leaves no sum to give.+ assert.doesNotMatch(hostGpuMemoryReply([{...total, memoryUsedMiB:1203, memoryFreeMiB:6687}]), /Together/);+ assert.doesNotMatch(hostGpuMemoryReply([{...total, memoryUsedMiB:1203, memoryFreeMiB:6687}, total]), /Together/);+ for (const live of [{memoryUsedMiB:1203,memoryFreeMiB:9000}, {memoryUsedMiB:-1,memoryFreeMiB:6687},+ {memoryUsedMiB:1203.5,memoryFreeMiB:6687}, {memoryUsedMiB:1203}]) {+ assert.doesNotMatch(hostGpuMemoryReply([{...total, ...live}]) ?? "", /MiB free|8151 MiB/, JSON.stringify(live));+ }+});++test("a unified-memory NVIDIA GPU is named as sharing system RAM", () => {+ const text = hostGpuMemoryReply([{name:"NVIDIA GB10",unifiedMemory:true,driver:"580.95.05"}]);+ assert.match(text, /\n- GPU: NVIDIA GB10 \(unified memory shared with system RAM; driver 580\.95\.05\)\. Device identifiers/);+ assert.match(text, /\n- Memory: 8\.00 GiB used of 16\.0 GiB/);+ for (const device of [{name:"NVIDIA GB10",unifiedMemory:"yes",driver:"580.95.05"},+ {name:"NVIDIA GB10",unifiedMemory:true,memoryMiB:8151,driver:"580.95.05"}]) {+ assert.doesNotMatch(hostGpuMemoryReply([device]) ?? "", /NVIDIA GB10/, JSON.stringify(device));+ }+});+test("Metal host evidence describes capability without claiming measured utilization", () => {const guard = createToolLoopGuard();const jobId = "ops-1234567890123-abcdef123456";