From 40bd868f65fa78efee681fd37e84c5ffc71c8a51 Mon Sep 17 00:00:00 2001 From: iris Date: Sat, 4 Jul 2026 12:44:25 +0200 Subject: [PATCH] fix(agent-term): guard edit_schedule targets_add/remove against empty arrays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty arrays are truthy in JS so 'if (input.targets_add)' would emit '+0 tgt' for an explicit []. Add .length guard so zero-element lists are silently skipped — consistent with fmtArgsGeneric's [N] handling. The MCP schema defaults both fields to null, making this theoretical, but the guard is cleaner. --- frontend/packages/agent/src/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/packages/agent/src/app.js b/frontend/packages/agent/src/app.js index 6717f90e..190e3cc1 100644 --- a/frontend/packages/agent/src/app.js +++ b/frontend/packages/agent/src/app.js @@ -1648,8 +1648,8 @@ window.marked = marked; if (input.body != null) parts.push('body'); if (input.interval_seconds != null) parts.push('interval'); if (input.next_fire_at_unix != null) parts.push('next'); - if (input.targets_add) parts.push('+' + input.targets_add.length + ' tgt'); - if (input.targets_remove) parts.push('-' + input.targets_remove.length + ' tgt'); + if (input.targets_add && input.targets_add.length) parts.push('+' + input.targets_add.length + ' tgt'); + if (input.targets_remove && input.targets_remove.length) parts.push('-' + input.targets_remove.length + ' tgt'); return short + ' ' + parts.join(' · '); } case 'mcp__hyperhive__request_schedule_prompt': {