From 6469b1773660202af24b5fca552ce99ad3ce97f4 Mon Sep 17 00:00:00 2001 From: iliya Date: Fri, 20 Mar 2026 13:46:56 +0200 Subject: [PATCH] fix: enhance comment retrieval logic in getTaskComment function - Updated the getTaskComment function to first attempt an exact match for comment IDs, followed by a prefix match for improved flexibility in retrieving comments with short IDs. - This change ensures better handling of comment lookups, enhancing user experience when accessing task comments. --- agent-teams-controller/src/internal/tasks.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent-teams-controller/src/internal/tasks.js b/agent-teams-controller/src/internal/tasks.js index 5205c941..fffee3e7 100644 --- a/agent-teams-controller/src/internal/tasks.js +++ b/agent-teams-controller/src/internal/tasks.js @@ -172,7 +172,11 @@ function getTaskComment(context, taskId, commentId) { } const task = taskStore.readTask(context.paths, taskId, { includeDeleted: true }); const comments = Array.isArray(task.comments) ? task.comments : []; - const comment = comments.find((c) => c && c.id === normalizedCommentId); + + // Exact match first, then prefix match (allows short IDs like first 8 chars) + const comment = + comments.find((c) => c && c.id === normalizedCommentId) || + comments.find((c) => c && typeof c.id === 'string' && c.id.startsWith(normalizedCommentId)); if (!comment) { throw new Error(`Comment ${normalizedCommentId} not found on task #${task.displayId || task.id}`); }