Report stalled agent lanes and bound health lock waits
This commit is contained in:
@@ -35,6 +35,21 @@ export interface HostAgentUpdate {
|
||||
checkedAt?: string;
|
||||
}
|
||||
|
||||
export interface HostAgentLane {
|
||||
name: 'health-1' | 'health-2' | 'read' | 'write';
|
||||
alive: boolean; busy: boolean; lastPollAt: string | null; pollAgeSeconds: number;
|
||||
}
|
||||
export function hostAgentLaneLabel(name: HostAgentLane['name']): string {
|
||||
return { 'health-1': 'Health check 1', 'health-2': 'Health check 2', read: 'File reads', write: 'Actions' }[name];
|
||||
}
|
||||
export function hostAgentLaneState(lane: HostAgentLane): 'stopped' | 'stalled' | 'busy' | 'starting' | 'polling' {
|
||||
if (!lane.alive) return 'stopped';
|
||||
// Reads and mutations can legitimately take minutes. Health work has a
|
||||
// bounded budget; an old poll there indicates a blocked worker even if busy.
|
||||
if (lane.pollAgeSeconds > 90 && (!lane.busy || lane.name.startsWith('health-'))) return 'stalled';
|
||||
return lane.busy ? 'busy' : lane.lastPollAt === null ? 'starting' : 'polling';
|
||||
}
|
||||
|
||||
export function hostAgentUpdatesEnabled(inventory: HostInventory): boolean {
|
||||
return inventory.agentUpdate?.enabled === true && inventory.capabilities?.includes('agent.update') === true;
|
||||
}
|
||||
@@ -68,6 +83,7 @@ export interface HostInventory {
|
||||
currentOperation?: string | null; [key: string]: unknown;
|
||||
capabilities?: string[];
|
||||
agentUpdate?: HostAgentUpdate;
|
||||
agentLanes?: HostAgentLane[];
|
||||
instanceResources?: InstanceResources[];
|
||||
instanceResourcesError?: string;
|
||||
instanceStates?: InstanceState[];
|
||||
|
||||
Reference in New Issue
Block a user