MCPcopy Create free account
hub / github.com/github/gh-aw / loadMissingDataMessages

Function loadMissingDataMessages

actions/setup/js/handle_agent_failure.cjs:1026–1059  ·  view source on GitHub ↗

* Load missing_data messages from agent output * @param {Array } [items] - Optional pre-loaded agent output items. When provided, avoids re-reading the output file. * @returns {Array<{data_type: string, reason: string, context?: string, alternatives?: string}>} Array of missing data messages

(items)

Source from the content-addressed store, hash-verified

1024 * @returns {Array<{data_type: string, reason: string, context?: string, alternatives?: string}>} Array of missing data messages
1025 */
1026function loadMissingDataMessages(items) {
1027 try {
1028 let resolvedItems = items;
1029 if (!resolvedItems) {
1030 const { loadAgentOutput } = require("./load_agent_output.cjs");
1031 const agentOutputResult = loadAgentOutput();
1032 if (!agentOutputResult.success || !agentOutputResult.items) {
1033 return [];
1034 }
1035 resolvedItems = agentOutputResult.items;
1036 }
1037
1038 // Extract missing_data messages from agent output
1039 const missingDataMessages = [];
1040 for (const item of resolvedItems) {
1041 if (item.type === "missing_data") {
1042 // Accept items with at least a reason; data_type may be absent for cache-miss signals
1043 if (item.reason) {
1044 missingDataMessages.push({
1045 data_type: item.data_type || "",
1046 reason: item.reason,
1047 context: item.context || null,
1048 alternatives: item.alternatives || null,
1049 });
1050 }
1051 }
1052 }
1053
1054 return missingDataMessages;
1055 } catch (error) {
1056 core.warning(`Failed to load missing_data messages: ${getErrorMessage(error)}`);
1057 return [];
1058 }
1059}
1060
1061/**
1062 * Resolve whether any cache-memory restore step matched a cache entry.

Callers 1

buildMissingDataContextFunction · 0.85

Calls 2

loadAgentOutputFunction · 0.85
getErrorMessageFunction · 0.70

Tested by

no test coverage detected