Fix container resource sampling and surface collection failures

This commit is contained in:
2026-10-04 22:02:03 -04:00
parent 81f088739c
commit 148c74063b
9 changed files with 48 additions and 11 deletions
+1
View File
@@ -69,6 +69,7 @@ export interface HostInventory {
capabilities?: string[];
agentUpdate?: HostAgentUpdate;
instanceResources?: InstanceResources[];
instanceResourcesError?: string;
}
export interface InstanceResources {
instanceId: string; generation: number; uptimeSeconds: number; cpuCores: number; memoryBytes: number;
+2
View File
@@ -15,6 +15,8 @@ interface AllowanceRow {
function database() { const handle = db(); ensureHostSchema(handle); return handle; }
export function validateInstanceResources(inventory: HostInventory): void {
if (inventory.instanceResourcesError !== undefined && (typeof inventory.instanceResourcesError !== 'string'
|| inventory.instanceResourcesError.length > 500)) throw new Error('Invalid instance resource sampling error.');
const samples = inventory.instanceResources;
if (samples === undefined) return;
if (!Array.isArray(samples) || samples.length > 1000) throw new Error('Invalid instance resource samples.');