* Build missing_data context string for display in failure issues/comments. * When cache-memory is enabled, a restore matched, and a cache_miss is detected, * appends a configuration-problem warning to the context. * @param {boolean} cacheMemoryEnabled - Whether cache-memory is configured for thi
(cacheMemoryEnabled, cacheMemoryRestored, items)
| 1093 | * @returns {string} Formatted missing data context |
| 1094 | */ |
| 1095 | function buildMissingDataContext(cacheMemoryEnabled, cacheMemoryRestored, items) { |
| 1096 | const missingDataMessages = loadMissingDataMessages(items); |
| 1097 | |
| 1098 | if (missingDataMessages.length === 0) { |
| 1099 | return ""; |
| 1100 | } |
| 1101 | |
| 1102 | core.info(`Found ${missingDataMessages.length} missing_data message(s)`); |
| 1103 | |
| 1104 | // Detect cache_miss: if cache-memory restore matched and the agent reported a cache miss, |
| 1105 | // this indicates the prompt is referencing an incorrect file path within the cache directory. |
| 1106 | const hasCacheMiss = missingDataMessages.some(m => m.reason === "cache_memory_miss"); |
| 1107 | |
| 1108 | // When cache-memory is configured and cache_miss is present, avoid repeating the same |
| 1109 | // signal in the generic "Missing Data" section. Keep the specialised cache warning below. |
| 1110 | const shouldShowCacheWarning = cacheMemoryEnabled && cacheMemoryRestored && hasCacheMiss; |
| 1111 | const displayableMissingData = shouldShowCacheWarning ? missingDataMessages.filter(m => m.reason !== "cache_memory_miss") : missingDataMessages; |
| 1112 | |
| 1113 | let context = ""; |
| 1114 | if (displayableMissingData.length > 0) { |
| 1115 | const formattedList = formatMissingData(displayableMissingData); |
| 1116 | context += buildWarningAlertLine("Missing Data Reported", "The agent reported missing data during execution.") + "\n**Missing Data:**\n"; |
| 1117 | context += formattedList; |
| 1118 | context += "\n\n"; |
| 1119 | } |
| 1120 | |
| 1121 | if (shouldShowCacheWarning) { |
| 1122 | core.info("Cache-miss detected after a successful cache restore — likely a configuration problem"); |
| 1123 | const templatePath = getPromptPath("cache_memory_miss.md"); |
| 1124 | context += "\n" + renderTemplateFromFile(templatePath, {}) + "\n"; |
| 1125 | } |
| 1126 | |
| 1127 | return context; |
| 1128 | } |
| 1129 | |
| 1130 | /** |
| 1131 | * Extract denied command entries from a missing_tool alternatives string. |
no test coverage detected